| 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 #include "chrome/browser/media/protected_media_identifier_infobar_delegate.h" | 5 #include "chrome/browser/media/protected_media_identifier_infobar_delegate_andro
id.h" |
| 6 | 6 |
| 7 #include "chrome/browser/android/android_theme_resources.h" | 7 #include "chrome/browser/android/android_theme_resources.h" |
| 8 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
| 9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| 11 #include "components/infobars/core/infobar.h" | 11 #include "components/infobars/core/infobar.h" |
| 12 #include "components/url_formatter/elide_url.h" | 12 #include "components/url_formatter/elide_url.h" |
| 13 #include "grit/components_strings.h" | 13 #include "grit/components_strings.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 15 | 15 |
| 16 // static | 16 // static |
| 17 infobars::InfoBar* ProtectedMediaIdentifierInfoBarDelegate::Create( | 17 infobars::InfoBar* ProtectedMediaIdentifierInfoBarDelegateAndroid::Create( |
| 18 InfoBarService* infobar_service, | 18 InfoBarService* infobar_service, |
| 19 const GURL& requesting_frame, | 19 const GURL& requesting_frame, |
| 20 const std::string& display_languages, | 20 const std::string& display_languages, |
| 21 const PermissionSetCallback& callback) { | 21 const PermissionSetCallback& callback) { |
| 22 return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( | 22 return infobar_service->AddInfoBar( |
| 23 scoped_ptr<ConfirmInfoBarDelegate>( | 23 infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( |
| 24 new ProtectedMediaIdentifierInfoBarDelegate( | 24 new ProtectedMediaIdentifierInfoBarDelegateAndroid( |
| 25 requesting_frame, display_languages, callback)))); | 25 requesting_frame, display_languages, callback)))); |
| 26 } | 26 } |
| 27 | 27 |
| 28 ProtectedMediaIdentifierInfoBarDelegate:: | 28 ProtectedMediaIdentifierInfoBarDelegateAndroid:: |
| 29 ProtectedMediaIdentifierInfoBarDelegate( | 29 ProtectedMediaIdentifierInfoBarDelegateAndroid( |
| 30 const GURL& requesting_frame, | 30 const GURL& requesting_frame, |
| 31 const std::string& display_languages, | 31 const std::string& display_languages, |
| 32 const PermissionSetCallback& callback) | 32 const PermissionSetCallback& callback) |
| 33 : PermissionInfobarDelegate( | 33 : PermissionInfobarDelegate( |
| 34 requesting_frame, | 34 requesting_frame, |
| 35 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, | 35 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, |
| 36 callback), | 36 callback), |
| 37 requesting_frame_(requesting_frame), | 37 requesting_frame_(requesting_frame), |
| 38 display_languages_(display_languages) { | 38 display_languages_(display_languages) {} |
| 39 } | |
| 40 | 39 |
| 41 ProtectedMediaIdentifierInfoBarDelegate:: | 40 ProtectedMediaIdentifierInfoBarDelegateAndroid:: |
| 42 ~ProtectedMediaIdentifierInfoBarDelegate() { | 41 ~ProtectedMediaIdentifierInfoBarDelegateAndroid() {} |
| 43 } | |
| 44 | 42 |
| 45 int ProtectedMediaIdentifierInfoBarDelegate::GetIconId() const { | 43 int ProtectedMediaIdentifierInfoBarDelegateAndroid::GetIconId() const { |
| 46 return IDR_ANDROID_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; | 44 return IDR_ANDROID_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; |
| 47 } | 45 } |
| 48 | 46 |
| 49 base::string16 ProtectedMediaIdentifierInfoBarDelegate::GetMessageText() const { | 47 base::string16 ProtectedMediaIdentifierInfoBarDelegateAndroid::GetMessageText() |
| 48 const { |
| 50 return l10n_util::GetStringFUTF16( | 49 return l10n_util::GetStringFUTF16( |
| 51 IDS_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_QUESTION, | 50 IDS_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_QUESTION, |
| 52 url_formatter::FormatUrlForSecurityDisplay(requesting_frame_, | 51 url_formatter::FormatUrlForSecurityDisplay(requesting_frame_, |
| 53 display_languages_)); | 52 display_languages_)); |
| 54 } | 53 } |
| 55 | 54 |
| 56 base::string16 ProtectedMediaIdentifierInfoBarDelegate::GetLinkText() const { | 55 base::string16 ProtectedMediaIdentifierInfoBarDelegateAndroid::GetLinkText() |
| 56 const { |
| 57 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 57 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| 58 } | 58 } |
| 59 | 59 |
| 60 GURL ProtectedMediaIdentifierInfoBarDelegate::GetLinkURL() const { | 60 GURL ProtectedMediaIdentifierInfoBarDelegateAndroid::GetLinkURL() const { |
| 61 return GURL(chrome::kEnhancedPlaybackNotificationLearnMoreURL); | 61 return GURL(chrome::kEnhancedPlaybackNotificationLearnMoreURL); |
| 62 } | 62 } |
| OLD | NEW |