Chromium Code Reviews| 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 a605229d6f487d4658f1584b1ebe1b051b3b7fbc..c4e1bdfc1af8272ad74c23d8875a8ece56296c28 100644 |
| --- a/chrome/browser/permissions/permission_infobar_delegate.h |
| +++ b/chrome/browser/permissions/permission_infobar_delegate.h |
| @@ -5,12 +5,14 @@ |
| #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_DELEGATE_H_ |
| #define CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_DELEGATE_H_ |
| +#include <memory> |
| + |
| +#include "base/callback.h" |
| #include "base/macros.h" |
| -#include "chrome/browser/infobars/infobar_service.h" |
| +#include "chrome/browser/permissions/permission_uma_util.h" |
|
raymes
2016/08/16 03:39:29
nit: permission_util.h
dominickn
2016/08/16 04:15:42
Done.
|
| #include "components/content_settings/core/common/content_settings_types.h" |
| #include "components/infobars/core/confirm_infobar_delegate.h" |
| #include "content/public/browser/permission_type.h" |
| -#include "content/public/browser/web_contents.h" |
| class NavigationDetails; |
| class Profile; |
| @@ -22,9 +24,21 @@ class Profile; |
| class PermissionInfobarDelegate : public ConfirmInfoBarDelegate { |
| public: |
| - using PermissionSetCallback = base::Callback<void(bool, bool)>; |
| + using PermissionSetCallback = base::Callback<void(bool, PermissionAction)>; |
| + |
| + ~PermissionInfobarDelegate() override; |
| ContentSettingsType content_setting() const { return content_settings_type_; } |
| + // Returns true if the infobar should display a toggle to allow users to |
| + // opt-out of persisting their accept/deny decision. |
| + bool ShouldShowPersistenceToggle() const; |
| + |
| + // Sets whether or not a decided permission should be persisted to content |
| + // settings. |
| + void SetPersist(bool persist) { persist_ = persist; } |
|
raymes
2016/08/16 03:39:29
nit: setters like this are generally styled:
void
dominickn
2016/08/16 04:15:42
Done.
|
| + |
| + base::string16 GetMessageText() const override; |
|
raymes
2016/08/16 03:39:29
nit: add // ConfirmInfoBarDelegate:
dominickn
2016/08/16 04:15:42
Done.
|
| + |
| protected: |
| PermissionInfobarDelegate(const GURL& requesting_origin, |
| content::PermissionType permission_type, |
| @@ -32,7 +46,6 @@ class PermissionInfobarDelegate : public ConfirmInfoBarDelegate { |
| bool user_gesture, |
| Profile* profile, |
| const PermissionSetCallback& callback); |
| - ~PermissionInfobarDelegate() override; |
| virtual int GetMessageResourceId() const = 0; |
| @@ -42,21 +55,25 @@ class PermissionInfobarDelegate : public ConfirmInfoBarDelegate { |
| void InfoBarDismissed() override; |
| PermissionInfobarDelegate* AsPermissionInfobarDelegate() override; |
| base::string16 GetButtonLabel(InfoBarButton button) const override; |
| - base::string16 GetMessageText() const override; |
| bool Accept() override; |
| bool Cancel() override; |
| - void SetPermission(bool update_content_setting, bool allowed); |
| + void SetPermission(bool update_content_setting, PermissionAction decision); |
| GURL requesting_origin_; |
| - bool action_taken_; |
| content::PermissionType permission_type_; |
| ContentSettingsType content_settings_type_; |
| - bool user_gesture_; |
| Profile* const profile_; |
| const PermissionSetCallback callback_; |
| + bool action_taken_; |
| + bool user_gesture_; |
| + bool persist_; |
| DISALLOW_COPY_AND_ASSIGN(PermissionInfobarDelegate); |
| }; |
| +// Implemented in platform-specific code. |
| +std::unique_ptr<infobars::InfoBar> CreatePermissionInfoBar( |
| + std::unique_ptr<PermissionInfobarDelegate> delegate); |
| + |
| #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_DELEGATE_H_ |