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_andro
id.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* ProtectedMediaIdentifierInfoBarDelegateAndroid::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, | |
21 const PermissionSetCallback& callback) { | 20 const PermissionSetCallback& callback) { |
22 return infobar_service->AddInfoBar( | 21 return infobar_service->AddInfoBar( |
23 infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( | 22 infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( |
24 new ProtectedMediaIdentifierInfoBarDelegateAndroid( | 23 new ProtectedMediaIdentifierInfoBarDelegateAndroid( |
25 requesting_frame, display_languages, callback)))); | 24 requesting_frame, callback)))); |
26 } | 25 } |
27 | 26 |
28 ProtectedMediaIdentifierInfoBarDelegateAndroid:: | 27 ProtectedMediaIdentifierInfoBarDelegateAndroid:: |
29 ProtectedMediaIdentifierInfoBarDelegateAndroid( | 28 ProtectedMediaIdentifierInfoBarDelegateAndroid( |
30 const GURL& requesting_frame, | 29 const GURL& requesting_frame, |
31 const std::string& display_languages, | |
32 const PermissionSetCallback& callback) | 30 const PermissionSetCallback& callback) |
33 : PermissionInfobarDelegate( | 31 : PermissionInfobarDelegate( |
34 requesting_frame, | 32 requesting_frame, |
35 content::PermissionType::PROTECTED_MEDIA_IDENTIFIER, | 33 content::PermissionType::PROTECTED_MEDIA_IDENTIFIER, |
36 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, | 34 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, |
37 callback), | 35 callback), |
38 requesting_frame_(requesting_frame), | 36 requesting_frame_(requesting_frame) {} |
39 display_languages_(display_languages) {} | |
40 | 37 |
41 ProtectedMediaIdentifierInfoBarDelegateAndroid:: | 38 ProtectedMediaIdentifierInfoBarDelegateAndroid:: |
42 ~ProtectedMediaIdentifierInfoBarDelegateAndroid() {} | 39 ~ProtectedMediaIdentifierInfoBarDelegateAndroid() {} |
43 | 40 |
44 infobars::InfoBarDelegate::InfoBarIdentifier | 41 infobars::InfoBarDelegate::InfoBarIdentifier |
45 ProtectedMediaIdentifierInfoBarDelegateAndroid::GetIdentifier() const { | 42 ProtectedMediaIdentifierInfoBarDelegateAndroid::GetIdentifier() const { |
46 return PROTECTED_MEDIA_IDENTIFIER_INFOBAR_DELEGATE_ANDROID; | 43 return PROTECTED_MEDIA_IDENTIFIER_INFOBAR_DELEGATE_ANDROID; |
47 } | 44 } |
48 | 45 |
49 int ProtectedMediaIdentifierInfoBarDelegateAndroid::GetIconId() const { | 46 int ProtectedMediaIdentifierInfoBarDelegateAndroid::GetIconId() const { |
50 return IDR_ANDROID_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; | 47 return IDR_ANDROID_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; |
51 } | 48 } |
52 | 49 |
53 base::string16 ProtectedMediaIdentifierInfoBarDelegateAndroid::GetMessageText() | 50 base::string16 ProtectedMediaIdentifierInfoBarDelegateAndroid::GetMessageText() |
54 const { | 51 const { |
55 return l10n_util::GetStringFUTF16( | 52 return l10n_util::GetStringFUTF16( |
56 IDS_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_QUESTION, | 53 IDS_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_QUESTION, |
57 url_formatter::FormatUrlForSecurityDisplay(requesting_frame_, | 54 url_formatter::FormatUrlForSecurityDisplay(requesting_frame_)); |
58 display_languages_)); | |
59 } | 55 } |
60 | 56 |
61 base::string16 ProtectedMediaIdentifierInfoBarDelegateAndroid::GetLinkText() | 57 base::string16 ProtectedMediaIdentifierInfoBarDelegateAndroid::GetLinkText() |
62 const { | 58 const { |
63 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 59 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
64 } | 60 } |
65 | 61 |
66 GURL ProtectedMediaIdentifierInfoBarDelegateAndroid::GetLinkURL() const { | 62 GURL ProtectedMediaIdentifierInfoBarDelegateAndroid::GetLinkURL() const { |
67 return GURL(chrome::kEnhancedPlaybackNotificationLearnMoreURL); | 63 return GURL(chrome::kEnhancedPlaybackNotificationLearnMoreURL); |
68 } | 64 } |
OLD | NEW |