| 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_SERVICES_GCM_PERMISSION_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_INFOBAR_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_SERVICES_GCM_PERMISSION_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_INFOBAR_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/content_settings/permission_request_id.h" | 8 #include "chrome/browser/content_settings/permission_request_id.h" |
| 9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
| 10 #include "components/infobars/core/confirm_infobar_delegate.h" | 10 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 | 12 |
| 13 class NavigationDetails; | 13 class NavigationDetails; |
| 14 class PermissionQueueController; | 14 class PermissionQueueController; |
| 15 | 15 |
| 16 namespace gcm { | 16 // Base class for permission infobars, it implements the default behavior |
| 17 | |
| 18 // Base class for permission infobars, it implements the default behaviour | |
| 19 // so that the accept/deny buttons grant/deny the relevant permission. | 17 // so that the accept/deny buttons grant/deny the relevant permission. |
| 20 // A basic implementor only needs to implement the methods that | 18 // A basic implementor only needs to implement the methods that |
| 21 // provide an icon and a message text to the infobar. | 19 // provide an icon and a message text to the infobar. |
| 22 class PermissionInfobarDelegate : public ConfirmInfoBarDelegate { | 20 class PermissionInfobarDelegate : public ConfirmInfoBarDelegate { |
| 23 public: | 21 public: |
| 24 virtual ~PermissionInfobarDelegate(); | 22 virtual ~PermissionInfobarDelegate(); |
| 25 | 23 |
| 26 protected: | 24 protected: |
| 27 PermissionInfobarDelegate(PermissionQueueController* controller, | 25 PermissionInfobarDelegate(PermissionQueueController* controller, |
| 28 const PermissionRequestID& id, | 26 const PermissionRequestID& id, |
| 29 const GURL& requesting_frame); | 27 const GURL& requesting_origin); |
| 30 | 28 |
| 31 // ConfirmInfoBarDelegate: | 29 // ConfirmInfoBarDelegate: |
| 30 virtual base::string16 GetMessageText() const = 0; |
| 31 |
| 32 virtual void InfoBarDismissed() OVERRIDE; | 32 virtual void InfoBarDismissed() OVERRIDE; |
| 33 virtual infobars::InfoBarDelegate::Type GetInfoBarType() const OVERRIDE; | 33 virtual infobars::InfoBarDelegate::Type GetInfoBarType() const OVERRIDE; |
| 34 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 34 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| 35 virtual bool Accept() OVERRIDE; | 35 virtual bool Accept() OVERRIDE; |
| 36 virtual bool Cancel() OVERRIDE; | 36 virtual bool Cancel() OVERRIDE; |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 void SetPermission(bool update_content_setting, bool allowed); | 39 void SetPermission(bool update_content_setting, bool allowed); |
| 40 | 40 |
| 41 PermissionQueueController* controller_; // not owned by us | 41 PermissionQueueController* controller_; // not owned by us |
| 42 const PermissionRequestID id_; | 42 const PermissionRequestID id_; |
| 43 GURL requesting_frame_; | 43 GURL requesting_origin_; |
| 44 | 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(PermissionInfobarDelegate); | 45 DISALLOW_COPY_AND_ASSIGN(PermissionInfobarDelegate); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace gcm | 48 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_INFOBAR_DELEGATE_H_ |
| 49 #endif // CHROME_BROWSER_SERVICES_GCM_PERMISSION_INFOBAR_DELEGATE_H_ | |
| OLD | NEW |