OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_INFOBAR_DELEGATE_H_ |
7 | 7 |
8 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
9 #include "components/content_settings/core/common/content_settings_types.h" | 9 #include "components/content_settings/core/common/content_settings_types.h" |
10 #include "components/content_settings/core/common/permission_request_id.h" | 10 #include "components/content_settings/core/common/permission_request_id.h" |
11 #include "components/infobars/core/confirm_infobar_delegate.h" | 11 #include "components/infobars/core/confirm_infobar_delegate.h" |
12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
13 | 13 |
14 class NavigationDetails; | 14 class NavigationDetails; |
15 class PermissionQueueController; | 15 class PermissionQueueController; |
16 | 16 |
17 // Base class for permission infobars, it implements the default behavior | 17 // Base class for permission infobars, it implements the default behavior |
18 // so that the accept/deny buttons grant/deny the relevant permission. | 18 // so that the accept/deny buttons grant/deny the relevant permission. |
19 // A basic implementor only needs to implement the methods that | 19 // A basic implementor only needs to implement the methods that |
20 // provide an icon and a message text to the infobar. | 20 // provide an icon and a message text to the infobar. |
21 class PermissionInfobarDelegate : public ConfirmInfoBarDelegate { | 21 class PermissionInfobarDelegate : public ConfirmInfoBarDelegate { |
22 | 22 |
23 protected: | 23 protected: |
24 PermissionInfobarDelegate(PermissionQueueController* controller, | 24 PermissionInfobarDelegate(PermissionQueueController* controller, |
25 const PermissionRequestID& id, | 25 const PermissionRequestID& id, |
26 const GURL& requesting_origin, | 26 const GURL& requesting_origin, |
27 ContentSettingsType type); | 27 ContentSettingsType type); |
28 ~PermissionInfobarDelegate() override; | 28 ~PermissionInfobarDelegate() override; |
29 | 29 |
30 private: | |
30 // ConfirmInfoBarDelegate: | 31 // ConfirmInfoBarDelegate: |
31 base::string16 GetMessageText() const override = 0; | 32 void InfoBarDismissed() override; |
Peter Kasting
2015/02/13 03:22:26
This is already pure in the base class, so there's
| |
32 | 33 Type GetInfoBarType() const override; |
33 infobars::InfoBarDelegate::Type GetInfoBarType() const override; | |
34 base::string16 GetButtonLabel(InfoBarButton button) const override; | 34 base::string16 GetButtonLabel(InfoBarButton button) const override; |
35 | |
36 // Remember to call RegisterActionTaken for these methods if you are | |
37 // overriding them. | |
Peter Kasting
2015/02/13 03:22:26
No one overrides these, so no need for a comment.
| |
38 void InfoBarDismissed() override; | |
39 bool Accept() override; | 35 bool Accept() override; |
40 bool Cancel() override; | 36 bool Cancel() override; |
41 | 37 |
42 private: | |
43 void SetPermission(bool update_content_setting, bool allowed); | 38 void SetPermission(bool update_content_setting, bool allowed); |
44 | 39 |
45 PermissionQueueController* controller_; // not owned by us | 40 PermissionQueueController* controller_; // not owned by us |
46 const PermissionRequestID id_; | 41 const PermissionRequestID id_; |
47 GURL requesting_origin_; | 42 GURL requesting_origin_; |
48 bool action_taken_; | 43 bool action_taken_; |
49 ContentSettingsType type_; | 44 ContentSettingsType type_; |
50 | 45 |
51 DISALLOW_COPY_AND_ASSIGN(PermissionInfobarDelegate); | 46 DISALLOW_COPY_AND_ASSIGN(PermissionInfobarDelegate); |
52 }; | 47 }; |
53 | 48 |
54 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_INFOBAR_DELEGATE_H_ | 49 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_INFOBAR_DELEGATE_H_ |
OLD | NEW |