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 "grit/components_strings.h" | 12 #include "grit/components_strings.h" |
13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
14 | 14 |
15 // static | 15 // static |
16 infobars::InfoBar* ProtectedMediaIdentifierInfoBarDelegateAndroid::Create( | 16 infobars::InfoBar* ProtectedMediaIdentifierInfoBarDelegateAndroid::Create( |
17 InfoBarService* infobar_service, | 17 InfoBarService* infobar_service, |
18 const GURL& requesting_frame, | 18 const GURL& requesting_frame, |
19 bool user_gesture, | 19 bool user_gesture, |
20 Profile* profile, | 20 Profile* profile, |
21 const PermissionSetCallback& callback) { | 21 const PermissionSetCallback& callback) { |
22 return infobar_service->AddInfoBar( | 22 return infobar_service->AddInfoBar( |
23 CreatePermissionInfoBar(std::unique_ptr<PermissionInfobarDelegate>( | 23 CreatePermissionInfoBar(std::unique_ptr<PermissionInfoBarDelegate>( |
24 new ProtectedMediaIdentifierInfoBarDelegateAndroid( | 24 new ProtectedMediaIdentifierInfoBarDelegateAndroid( |
25 requesting_frame, user_gesture, profile, callback)))); | 25 requesting_frame, user_gesture, profile, callback)))); |
26 } | 26 } |
27 | 27 |
28 ProtectedMediaIdentifierInfoBarDelegateAndroid:: | 28 ProtectedMediaIdentifierInfoBarDelegateAndroid:: |
29 ProtectedMediaIdentifierInfoBarDelegateAndroid( | 29 ProtectedMediaIdentifierInfoBarDelegateAndroid( |
30 const GURL& requesting_frame, | 30 const GURL& requesting_frame, |
31 bool user_gesture, | 31 bool user_gesture, |
32 Profile* profile, | 32 Profile* profile, |
33 const PermissionSetCallback& callback) | 33 const PermissionSetCallback& callback) |
34 : PermissionInfobarDelegate( | 34 : PermissionInfoBarDelegate( |
35 requesting_frame, | 35 requesting_frame, |
36 content::PermissionType::PROTECTED_MEDIA_IDENTIFIER, | 36 content::PermissionType::PROTECTED_MEDIA_IDENTIFIER, |
37 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, | 37 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, |
38 user_gesture, | 38 user_gesture, |
39 profile, | 39 profile, |
40 callback), | 40 callback) {} |
41 requesting_frame_(requesting_frame) {} | |
42 | 41 |
43 ProtectedMediaIdentifierInfoBarDelegateAndroid:: | 42 ProtectedMediaIdentifierInfoBarDelegateAndroid:: |
44 ~ProtectedMediaIdentifierInfoBarDelegateAndroid() {} | 43 ~ProtectedMediaIdentifierInfoBarDelegateAndroid() {} |
45 | 44 |
46 infobars::InfoBarDelegate::InfoBarIdentifier | 45 infobars::InfoBarDelegate::InfoBarIdentifier |
47 ProtectedMediaIdentifierInfoBarDelegateAndroid::GetIdentifier() const { | 46 ProtectedMediaIdentifierInfoBarDelegateAndroid::GetIdentifier() const { |
48 return PROTECTED_MEDIA_IDENTIFIER_INFOBAR_DELEGATE_ANDROID; | 47 return PROTECTED_MEDIA_IDENTIFIER_INFOBAR_DELEGATE_ANDROID; |
49 } | 48 } |
50 | 49 |
51 int ProtectedMediaIdentifierInfoBarDelegateAndroid::GetIconId() const { | 50 int ProtectedMediaIdentifierInfoBarDelegateAndroid::GetIconId() const { |
52 return IDR_ANDROID_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; | 51 return IDR_ANDROID_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; |
53 } | 52 } |
54 | 53 |
55 int ProtectedMediaIdentifierInfoBarDelegateAndroid::GetMessageResourceId() | |
56 const { | |
57 return IDS_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_QUESTION; | |
58 } | |
59 | |
60 base::string16 ProtectedMediaIdentifierInfoBarDelegateAndroid::GetLinkText() | 54 base::string16 ProtectedMediaIdentifierInfoBarDelegateAndroid::GetLinkText() |
61 const { | 55 const { |
62 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 56 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
63 } | 57 } |
64 | 58 |
65 GURL ProtectedMediaIdentifierInfoBarDelegateAndroid::GetLinkURL() const { | 59 GURL ProtectedMediaIdentifierInfoBarDelegateAndroid::GetLinkURL() const { |
66 return GURL(chrome::kEnhancedPlaybackNotificationLearnMoreURL); | 60 return GURL(chrome::kEnhancedPlaybackNotificationLearnMoreURL); |
67 } | 61 } |
| 62 |
| 63 int ProtectedMediaIdentifierInfoBarDelegateAndroid::GetMessageResourceId() |
| 64 const { |
| 65 return IDS_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_QUESTION; |
| 66 } |
OLD | NEW |