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_PERMISSIONS_PERMISSION_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_DELEGATE_H_ |
7 | 7 |
8 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
9 #include "chrome/browser/permissions/permission_request_id.h" | 9 #include "chrome/browser/permissions/permission_request_id.h" |
10 #include "components/content_settings/core/common/content_settings_types.h" | 10 #include "components/content_settings/core/common/content_settings_types.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; | |
16 | 15 |
17 // Base class for permission infobars, it implements the default behavior | 16 // Base class for permission infobars, it implements the default behavior |
18 // so that the accept/deny buttons grant/deny the relevant permission. | 17 // so that the accept/deny buttons grant/deny the relevant permission. |
19 // A basic implementor only needs to implement the methods that | 18 // A basic implementor only needs to implement the methods that |
20 // provide an icon and a message text to the infobar. | 19 // provide an icon and a message text to the infobar. |
21 class PermissionInfobarDelegate : public ConfirmInfoBarDelegate { | 20 class PermissionInfobarDelegate : public ConfirmInfoBarDelegate { |
22 | 21 |
23 public: | 22 public: |
24 ContentSettingsType content_setting() const { return type_; } | 23 ContentSettingsType content_setting() const { return type_; } |
25 | 24 |
26 protected: | 25 protected: |
27 PermissionInfobarDelegate(PermissionQueueController* controller, | 26 PermissionInfobarDelegate(const PermissionRequestID& id, |
mlamouri (slow - plz ping)
2015/09/15 12:55:59
Do you still need this? |id| doesn't seem to be us
Lalit Maganti
2015/09/15 14:19:25
Done.
| |
28 const PermissionRequestID& id, | |
29 const GURL& requesting_origin, | 27 const GURL& requesting_origin, |
30 ContentSettingsType type); | 28 ContentSettingsType type, |
29 const base::Callback<void(bool, bool)>& callback); | |
mlamouri (slow - plz ping)
2015/09/15 12:55:59
nit: could you name the callback so readers know
Lalit Maganti
2015/09/15 14:19:24
Done.
| |
31 ~PermissionInfobarDelegate() override; | 30 ~PermissionInfobarDelegate() override; |
32 | 31 |
33 private: | 32 private: |
34 // ConfirmInfoBarDelegate: | 33 // ConfirmInfoBarDelegate: |
35 Type GetInfoBarType() const override; | 34 Type GetInfoBarType() const override; |
36 void InfoBarDismissed() override; | 35 void InfoBarDismissed() override; |
37 PermissionInfobarDelegate* AsPermissionInfobarDelegate() override; | 36 PermissionInfobarDelegate* AsPermissionInfobarDelegate() override; |
38 base::string16 GetButtonLabel(InfoBarButton button) const override; | 37 base::string16 GetButtonLabel(InfoBarButton button) const override; |
39 bool Accept() override; | 38 bool Accept() override; |
40 bool Cancel() override; | 39 bool Cancel() override; |
41 | 40 |
42 void SetPermission(bool update_content_setting, bool allowed); | 41 void SetPermission(bool update_content_setting, bool allowed); |
43 | 42 |
44 PermissionQueueController* controller_; // not owned by us | |
45 const PermissionRequestID id_; | 43 const PermissionRequestID id_; |
46 GURL requesting_origin_; | 44 GURL requesting_origin_; |
47 bool action_taken_; | 45 bool action_taken_; |
48 ContentSettingsType type_; | 46 ContentSettingsType type_; |
47 const base::Callback<void(bool, bool)> callback_; | |
49 | 48 |
50 DISALLOW_COPY_AND_ASSIGN(PermissionInfobarDelegate); | 49 DISALLOW_COPY_AND_ASSIGN(PermissionInfobarDelegate); |
51 }; | 50 }; |
52 | 51 |
53 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_DELEGATE_H_ | 52 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_DELEGATE_H_ |
OLD | NEW |