// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_PERMISSIONS_CONTEXTS_NFC_PERMISSION_CONTEXT_H_
#define COMPONENTS_PERMISSIONS_CONTEXTS_NFC_PERMISSION_CONTEXT_H_

#include "build/build_config.h"
#include "components/permissions/content_setting_permission_context_base.h"

namespace permissions {

class NfcPermissionContext : public ContentSettingPermissionContextBase {
 public:
  // The delegate allows embedders to modify the permission context logic.
  class Delegate {
   public:
    virtual ~Delegate() = default;

#if BUILDFLAG(IS_ANDROID)
    // Returns whether or not this |web_contents| is interactable.
    virtual bool IsInteractable(content::WebContents* web_contents) = 0;
#endif
  };

  NfcPermissionContext(content::BrowserContext* browser_context,
                       std::unique_ptr<Delegate> delegate);

  NfcPermissionContext(const NfcPermissionContext&) = delete;
  NfcPermissionContext& operator=(const NfcPermissionContext&) = delete;

  ~NfcPermissionContext() override;

 protected:
  std::unique_ptr<Delegate> delegate_;

 private:
  ContentSetting GetContentSettingStatusInternal(
      content::RenderFrameHost* render_frame_host,
      const GURL& requesting_origin,
      const GURL& embedding_origin) const override;

  // PermissionContextBase:
  void DecidePermission(std::unique_ptr<PermissionRequestData> request_data,
                        BrowserPermissionCallback callback) override;
  void UpdateTabContext(const PermissionRequestData& request_data,
                        bool allowed) override;
};

}  // namespace permissions

#endif  // COMPONENTS_PERMISSIONS_CONTEXTS_NFC_PERMISSION_CONTEXT_H_
