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