Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Unified Diff: chrome/browser/permissions/permission_infobar_delegate.h

Issue 2446063002: Implement a modal permission dialog on Android gated by a feature. (Closed)
Patch Set: Move delegate creation and dispatch into constructor Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
« no previous file with comments | « chrome/browser/permissions/permission_dialog_delegate.cc ('k') | chrome/browser/permissions/permission_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698