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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 void ProtectedMediaIdentifierInfoBarDelegate::SetPermission( | 67 void ProtectedMediaIdentifierInfoBarDelegate::SetPermission( |
68 bool update_content_setting, | 68 bool update_content_setting, |
69 bool allowed) { | 69 bool allowed) { |
70 content::WebContents* web_contents = | 70 content::WebContents* web_contents = |
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() { | |
78 SetPermission(false, false); | |
79 } | |
80 | |
81 int ProtectedMediaIdentifierInfoBarDelegate::GetIconID() const { | |
82 return IDR_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; | |
83 } | |
84 | |
85 infobars::InfoBarDelegate::Type | 77 infobars::InfoBarDelegate::Type |
86 ProtectedMediaIdentifierInfoBarDelegate::GetInfoBarType() const { | 78 ProtectedMediaIdentifierInfoBarDelegate::GetInfoBarType() const { |
87 return PAGE_ACTION_TYPE; | 79 return PAGE_ACTION_TYPE; |
88 } | 80 } |
89 | 81 |
| 82 int ProtectedMediaIdentifierInfoBarDelegate::GetIconID() const { |
| 83 return IDR_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; |
| 84 } |
| 85 |
| 86 void ProtectedMediaIdentifierInfoBarDelegate::InfoBarDismissed() { |
| 87 SetPermission(false, false); |
| 88 } |
| 89 |
90 bool ProtectedMediaIdentifierInfoBarDelegate::ShouldExpireInternal( | 90 bool ProtectedMediaIdentifierInfoBarDelegate::ShouldExpireInternal( |
91 const NavigationDetails& details) const { | 91 const NavigationDetails& details) const { |
92 // This implementation matches InfoBarDelegate::ShouldExpireInternal(), but | 92 // This implementation matches InfoBarDelegate::ShouldExpireInternal(), but |
93 // uses the unique ID we set in the constructor instead of that stored in the | 93 // uses the unique ID we set in the constructor instead of that stored in the |
94 // base class. | 94 // base class. |
95 return (contents_unique_id_ != details.entry_id) || details.is_reload; | 95 return (contents_unique_id_ != details.entry_id) || details.is_reload; |
96 } | 96 } |
97 | 97 |
98 base::string16 ProtectedMediaIdentifierInfoBarDelegate::GetMessageText() const { | 98 base::string16 ProtectedMediaIdentifierInfoBarDelegate::GetMessageText() const { |
99 return l10n_util::GetStringFUTF16( | 99 return l10n_util::GetStringFUTF16( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |