| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_MEDIA_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/content_settings/permission_request_id.h" | 10 #include "chrome/browser/content_settings/permission_request_id.h" |
| 11 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 11 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
| 12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 13 | 13 |
| 14 class PermissionQueueController; | 14 class PermissionQueueController; |
| 15 class InfoBarService; | 15 class InfoBarService; |
| 16 | 16 |
| 17 // TODO(toyoshim): Much more code can be shared with GeolocationInfoBarDelegate. |
| 18 // http://crbug.com/266743 |
| 19 |
| 17 class ProtectedMediaIdentifierInfoBarDelegate : public ConfirmInfoBarDelegate { | 20 class ProtectedMediaIdentifierInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 18 public: | 21 public: |
| 19 // Creates a protected media identifier infobar delegate and adds it to | 22 // Creates a protected media identifier infobar and delegate and adds the |
| 20 // |infobar_service|. | 23 // infobar to |infobar_service|. Returns the infobar if it was successfully |
| 21 // Returns the delegate if it was successfully added. | 24 // added. |
| 22 static InfoBarDelegate* Create(InfoBarService* infobar_service, | 25 static InfoBar* Create(InfoBarService* infobar_service, |
| 23 PermissionQueueController* controller, | 26 PermissionQueueController* controller, |
| 24 const PermissionRequestID& id, | 27 const PermissionRequestID& id, |
| 25 const GURL& requesting_frame, | 28 const GURL& requesting_frame, |
| 26 const std::string& display_languages); | 29 const std::string& display_languages); |
| 27 protected: | 30 protected: |
| 28 ProtectedMediaIdentifierInfoBarDelegate(InfoBarService* infobar_service, | 31 ProtectedMediaIdentifierInfoBarDelegate(PermissionQueueController* controller, |
| 29 PermissionQueueController* controller, | |
| 30 const PermissionRequestID& id, | 32 const PermissionRequestID& id, |
| 31 const GURL& requesting_frame, | 33 const GURL& requesting_frame, |
| 32 int contents_unique_id, | 34 int contents_unique_id, |
| 33 const std::string& display_languages); | 35 const std::string& display_languages); |
| 34 virtual ~ProtectedMediaIdentifierInfoBarDelegate(); | 36 virtual ~ProtectedMediaIdentifierInfoBarDelegate(); |
| 35 | 37 |
| 36 // Call back to the controller, to inform of the user's decision. | 38 // Calls back to the controller to inform it of the user's decision. |
| 37 void SetPermission(bool update_content_setting, bool allowed); | 39 void SetPermission(bool update_content_setting, bool allowed); |
| 38 | 40 |
| 39 private: | 41 private: |
| 40 // ConfirmInfoBarDelegate: | 42 // ConfirmInfoBarDelegate: |
| 41 virtual void InfoBarDismissed() OVERRIDE; | 43 virtual void InfoBarDismissed() OVERRIDE; |
| 42 virtual int GetIconID() const OVERRIDE; | 44 virtual int GetIconID() const OVERRIDE; |
| 43 virtual Type GetInfoBarType() const OVERRIDE; | 45 virtual Type GetInfoBarType() const OVERRIDE; |
| 44 virtual bool ShouldExpireInternal( | 46 virtual bool ShouldExpireInternal( |
| 45 const content::LoadCommittedDetails& details) const OVERRIDE; | 47 const content::LoadCommittedDetails& details) const OVERRIDE; |
| 46 virtual string16 GetMessageText() const OVERRIDE; | 48 virtual string16 GetMessageText() const OVERRIDE; |
| 47 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 49 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| 48 virtual bool Accept() OVERRIDE; | 50 virtual bool Accept() OVERRIDE; |
| 49 virtual bool Cancel() OVERRIDE; | 51 virtual bool Cancel() OVERRIDE; |
| 50 | 52 |
| 51 PermissionQueueController* controller_; | 53 PermissionQueueController* controller_; |
| 52 const PermissionRequestID id_; | 54 const PermissionRequestID id_; |
| 53 GURL requesting_frame_; | 55 GURL requesting_frame_; |
| 54 int contents_unique_id_; | 56 int contents_unique_id_; |
| 55 std::string display_languages_; | 57 std::string display_languages_; |
| 56 | 58 |
| 57 DISALLOW_COPY_AND_ASSIGN(ProtectedMediaIdentifierInfoBarDelegate); | 59 DISALLOW_COPY_AND_ASSIGN(ProtectedMediaIdentifierInfoBarDelegate); |
| 58 }; | 60 }; |
| 59 | 61 |
| 60 #endif // CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_DELEGATE_H_ | 62 #endif // CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_DELEGATE_H_ |
| OLD | NEW |