blob: d1c95c13e7a365b75ca58aa97ccd96f006af4800 [file] [log] [blame]
Avi Drissman8ba1bad2022-09-13 19:22:361// Copyright 2019 The Chromium Authors
Francois Beaufort51f9ee32019-11-05 06:48:162// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Michael van Ouwerkerkc71455e2021-03-30 10:34:375#ifndef COMPONENTS_PERMISSIONS_CONTEXTS_NFC_PERMISSION_CONTEXT_H_
6#define COMPONENTS_PERMISSIONS_CONTEXTS_NFC_PERMISSION_CONTEXT_H_
Francois Beaufort51f9ee32019-11-05 06:48:167
Michael van Ouwerkerk9783ec612021-03-29 11:51:518#include "build/build_config.h"
Florian Jacky9f8c3962025-06-10 09:50:369#include "components/permissions/content_setting_permission_context_base.h"
Francois Beaufort51f9ee32019-11-05 06:48:1610
Michael van Ouwerkerkc71455e2021-03-30 10:34:3711namespace permissions {
12
Florian Jacky9f8c3962025-06-10 09:50:3613class NfcPermissionContext : public ContentSettingPermissionContextBase {
Francois Beaufort51f9ee32019-11-05 06:48:1614 public:
Michael van Ouwerkerk9783ec612021-03-29 11:51:5115 // The delegate allows embedders to modify the permission context logic.
16 class Delegate {
17 public:
18 virtual ~Delegate() = default;
19
Xiaohan Wange813582302022-01-14 14:50:4620#if BUILDFLAG(IS_ANDROID)
Michael van Ouwerkerk9783ec612021-03-29 11:51:5121 // Returns whether or not this |web_contents| is interactable.
22 virtual bool IsInteractable(content::WebContents* web_contents) = 0;
23#endif
24 };
25
26 NfcPermissionContext(content::BrowserContext* browser_context,
27 std::unique_ptr<Delegate> delegate);
Francois Beaufort51f9ee32019-11-05 06:48:1628
29 NfcPermissionContext(const NfcPermissionContext&) = delete;
30 NfcPermissionContext& operator=(const NfcPermissionContext&) = delete;
31
32 ~NfcPermissionContext() override;
33
Michael van Ouwerkerk9783ec612021-03-29 11:51:5134 protected:
35 std::unique_ptr<Delegate> delegate_;
36
Francois Beaufort51f9ee32019-11-05 06:48:1637 private:
Florian Jacky9f8c3962025-06-10 09:50:3638 // ContentSettingPermissionContextBase:
Xiaohan Wange813582302022-01-14 14:50:4639#if !BUILDFLAG(IS_ANDROID)
Florian Jacky61cf70f2025-06-11 11:39:1140 ContentSetting GetContentSettingStatusInternal(
Francois Beaufort51f9ee32019-11-05 06:48:1641 content::RenderFrameHost* render_frame_host,
42 const GURL& requesting_origin,
43 const GURL& embedding_origin) const override;
Francois Beaufortdbb86fd2019-11-22 14:29:0944#endif
Florian Jacky61cf70f2025-06-11 11:39:1145
46 // PermissionContextBase:
Florian Jacky7f3e3ca1b2025-05-05 16:19:2047 void DecidePermission(std::unique_ptr<PermissionRequestData> request_data,
Michael van Ouwerkerkc71455e2021-03-30 10:34:3748 BrowserPermissionCallback callback) override;
49 void UpdateTabContext(const PermissionRequestID& id,
Francois Beaufort51f9ee32019-11-05 06:48:1650 const GURL& requesting_frame,
51 bool allowed) override;
Francois Beaufort51f9ee32019-11-05 06:48:1652};
53
Michael van Ouwerkerkc71455e2021-03-30 10:34:3754} // namespace permissions
55
56#endif // COMPONENTS_PERMISSIONS_CONTEXTS_NFC_PERMISSION_CONTEXT_H_