Index: chrome/browser/permissions/permission_infobar_delegate.h |
diff --git a/chrome/browser/permissions/permission_infobar_delegate.h b/chrome/browser/permissions/permission_infobar_delegate.h |
index 6f2ef7940e4fbb74d9dbe71907d94e420fe53481..f8cf3811dce183079b6123bfa0a69e392d5fd86f 100644 |
--- a/chrome/browser/permissions/permission_infobar_delegate.h |
+++ b/chrome/browser/permissions/permission_infobar_delegate.h |
@@ -23,25 +23,37 @@ class InfoBar; |
class InfoBarService; |
class Profile; |
-// Base class for permission infobars, it implements the default behavior |
-// so that the accept/deny buttons grant/deny the relevant permission. |
-// A basic implementor only needs to implement the methods that |
+// Base delegate class for permission prompts on Android. The default behavior |
+// is that the accept/deny buttons grant/deny the relevant permission |
+// respectively. A basic implementor only needs to implement the methods that |
// provide an icon and a message text to the infobar. |
+// |
+// By default, the user is presented with an infobar to make their choice. If |
+// the experimental ModalPermissionPrompts feature is active, they will instead |
+// see a modal dialog. Currently, this class is used for both; future |
+// refactoring will be undertaken based on whether support for infobars is |
+// retained following the modal prompt experiment. |
class PermissionInfoBarDelegate : public ConfirmInfoBarDelegate { |
- |
public: |
using PermissionSetCallback = base::Callback<void(bool, PermissionAction)>; |
// Creates an infobar for |type|. The returned pointer is owned by |
// |infobar_service| and manages its own lifetime; callers must only use it |
// for calls to |infobar_service|. |
- static infobars::InfoBar* Create(content::PermissionType type, |
- InfoBarService* infobar_service, |
+ static infobars::InfoBar* Create(InfoBarService* infobar_service, |
+ content::PermissionType type, |
const GURL& requesting_frame, |
bool user_gesture, |
Profile* profile, |
const PermissionSetCallback& callback); |
+ static std::unique_ptr<PermissionInfoBarDelegate> CreateDelegate( |
+ content::PermissionType type, |
+ const GURL& requesting_frame, |
+ bool user_gesture, |
+ Profile* profile, |
+ const PermissionSetCallback& callback); |
+ |
~PermissionInfoBarDelegate() override; |
virtual std::vector<int> content_settings() const; |
@@ -55,6 +67,10 @@ class PermissionInfoBarDelegate : public ConfirmInfoBarDelegate { |
bool persist() const { return persist_; } |
// ConfirmInfoBarDelegate: |
+ bool Accept() override; |
+ bool Cancel() override; |
+ void InfoBarDismissed() override; |
+ base::string16 GetButtonLabel(InfoBarButton button) const override; |
base::string16 GetMessageText() const override; |
protected: |
@@ -68,11 +84,7 @@ class PermissionInfoBarDelegate : public ConfirmInfoBarDelegate { |
private: |
// ConfirmInfoBarDelegate: |
Type GetInfoBarType() const override; |
- void InfoBarDismissed() override; |
PermissionInfoBarDelegate* AsPermissionInfoBarDelegate() override; |
- base::string16 GetButtonLabel(InfoBarButton button) const override; |
- bool Accept() override; |
- bool Cancel() override; |
virtual int GetMessageResourceId() const = 0; |
void SetPermission(bool update_content_setting, PermissionAction decision); |