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.h" |
6 | 6 |
7 #include "chrome/browser/content_settings/permission_queue_controller.h" | 7 #include "chrome/browser/content_settings/permission_queue_controller.h" |
8 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
9 #include "chrome/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
10 #include "components/infobars/core/infobar.h" | 10 #include "components/infobars/core/infobar.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 InfoBarService::WebContentsFromInfoBar(infobar()); | 71 InfoBarService::WebContentsFromInfoBar(infobar()); |
72 controller_->OnPermissionSet(id_, requesting_frame_, | 72 controller_->OnPermissionSet(id_, requesting_frame_, |
73 web_contents->GetLastCommittedURL().GetOrigin(), | 73 web_contents->GetLastCommittedURL().GetOrigin(), |
74 update_content_setting, allowed); | 74 update_content_setting, allowed); |
75 } | 75 } |
76 | 76 |
77 void ProtectedMediaIdentifierInfoBarDelegate::InfoBarDismissed() { | 77 void ProtectedMediaIdentifierInfoBarDelegate::InfoBarDismissed() { |
78 SetPermission(false, false); | 78 SetPermission(false, false); |
79 } | 79 } |
80 | 80 |
81 int ProtectedMediaIdentifierInfoBarDelegate::GetIconID() const { | |
82 return IDR_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; | |
83 } | |
84 | |
85 infobars::InfoBarDelegate::Type | 81 infobars::InfoBarDelegate::Type |
86 ProtectedMediaIdentifierInfoBarDelegate::GetInfoBarType() const { | 82 ProtectedMediaIdentifierInfoBarDelegate::GetInfoBarType() const { |
87 return PAGE_ACTION_TYPE; | 83 return PAGE_ACTION_TYPE; |
88 } | 84 } |
89 | 85 |
90 bool ProtectedMediaIdentifierInfoBarDelegate::ShouldExpireInternal( | 86 bool ProtectedMediaIdentifierInfoBarDelegate::ShouldExpireInternal( |
91 const NavigationDetails& details) const { | 87 const NavigationDetails& details) const { |
92 // This implementation matches InfoBarDelegate::ShouldExpireInternal(), but | 88 // This implementation matches InfoBarDelegate::ShouldExpireInternal(), but |
93 // uses the unique ID we set in the constructor instead of that stored in the | 89 // uses the unique ID we set in the constructor instead of that stored in the |
94 // base class. | 90 // base class. |
95 return (contents_unique_id_ != details.entry_id) || details.is_reload; | 91 return (contents_unique_id_ != details.entry_id) || details.is_reload; |
96 } | 92 } |
97 | 93 |
| 94 int ProtectedMediaIdentifierInfoBarDelegate::GetIconID() const { |
| 95 return IDR_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; |
| 96 } |
| 97 |
98 base::string16 ProtectedMediaIdentifierInfoBarDelegate::GetMessageText() const { | 98 base::string16 ProtectedMediaIdentifierInfoBarDelegate::GetMessageText() const { |
99 return l10n_util::GetStringFUTF16( | 99 return l10n_util::GetStringFUTF16( |
100 IDS_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_QUESTION, | 100 IDS_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_QUESTION, |
101 net::FormatUrl(requesting_frame_.GetOrigin(), display_languages_)); | 101 net::FormatUrl(requesting_frame_.GetOrigin(), display_languages_)); |
102 } | 102 } |
103 | 103 |
104 base::string16 ProtectedMediaIdentifierInfoBarDelegate::GetButtonLabel( | 104 base::string16 ProtectedMediaIdentifierInfoBarDelegate::GetButtonLabel( |
105 InfoBarButton button) const { | 105 InfoBarButton button) const { |
106 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? | 106 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
107 IDS_PROTECTED_MEDIA_IDENTIFIER_ALLOW_BUTTON : | 107 IDS_PROTECTED_MEDIA_IDENTIFIER_ALLOW_BUTTON : |
(...skipping 23 matching lines...) Expand all Loading... |
131 InfoBarService::WebContentsFromInfoBar(infobar()) | 131 InfoBarService::WebContentsFromInfoBar(infobar()) |
132 ->OpenURL(content::OpenURLParams( | 132 ->OpenURL(content::OpenURLParams( |
133 learn_more_url, content::Referrer(), | 133 learn_more_url, content::Referrer(), |
134 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 134 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
135 ui::PAGE_TRANSITION_LINK, false)); | 135 ui::PAGE_TRANSITION_LINK, false)); |
136 #else | 136 #else |
137 NOTIMPLEMENTED(); | 137 NOTIMPLEMENTED(); |
138 #endif | 138 #endif |
139 return false; // Do not dismiss the info bar. | 139 return false; // Do not dismiss the info bar. |
140 } | 140 } |
OLD | NEW |