Chromium Code Reviews| 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" |
| 11 #include "content/public/browser/navigation_entry.h" | 11 #include "content/public/browser/navigation_entry.h" |
| 12 #include "grit/components_strings.h" | 12 #include "grit/components_strings.h" |
| 13 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
| 14 #include "net/base/net_util.h" | 14 #include "net/base/net_util.h" |
| 15 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
| 16 | 16 |
| 17 #if defined(OS_ANDROID) | 17 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
|
newt (away)
2015/04/30 17:47:17
remove this #ifdef too
knn
2015/04/30 18:42:43
Done.
| |
| 18 #include "chrome/browser/android/chromium_application.h" | |
| 19 #endif | |
| 20 | |
| 21 #if defined(OS_CHROMEOS) | |
| 22 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 23 #endif | 19 #endif |
| 24 | 20 |
| 25 // static | 21 // static |
| 26 infobars::InfoBar* ProtectedMediaIdentifierInfoBarDelegate::Create( | 22 infobars::InfoBar* ProtectedMediaIdentifierInfoBarDelegate::Create( |
| 27 InfoBarService* infobar_service, | 23 InfoBarService* infobar_service, |
| 28 PermissionQueueController* controller, | 24 PermissionQueueController* controller, |
| 29 const PermissionRequestID& id, | 25 const PermissionRequestID& id, |
| 30 const GURL& requesting_frame, | 26 const GURL& requesting_frame, |
| 31 const std::string& display_languages) { | 27 const std::string& display_languages) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 IDS_PROTECTED_MEDIA_IDENTIFIER_ALLOW_BUTTON : | 103 IDS_PROTECTED_MEDIA_IDENTIFIER_ALLOW_BUTTON : |
| 108 IDS_PROTECTED_MEDIA_IDENTIFIER_DENY_BUTTON); | 104 IDS_PROTECTED_MEDIA_IDENTIFIER_DENY_BUTTON); |
| 109 } | 105 } |
| 110 | 106 |
| 111 bool ProtectedMediaIdentifierInfoBarDelegate::Cancel() { | 107 bool ProtectedMediaIdentifierInfoBarDelegate::Cancel() { |
| 112 SetPermission(true, false); | 108 SetPermission(true, false); |
| 113 return true; | 109 return true; |
| 114 } | 110 } |
| 115 | 111 |
| 116 base::string16 ProtectedMediaIdentifierInfoBarDelegate::GetLinkText() const { | 112 base::string16 ProtectedMediaIdentifierInfoBarDelegate::GetLinkText() const { |
| 117 #if defined(OS_ANDROID) | |
| 118 return l10n_util::GetStringUTF16( | |
| 119 IDS_PROTECTED_MEDIA_IDENTIFIER_SETTINGS_LINK); | |
| 120 #else | |
| 121 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 113 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| 122 #endif | |
| 123 } | 114 } |
| 124 | 115 |
| 125 bool ProtectedMediaIdentifierInfoBarDelegate::LinkClicked( | 116 bool ProtectedMediaIdentifierInfoBarDelegate::LinkClicked( |
| 126 WindowOpenDisposition disposition) { | 117 WindowOpenDisposition disposition) { |
| 127 #if defined(OS_ANDROID) | |
| 128 chrome::android::ChromiumApplication::OpenProtectedContentSettings(); | |
| 129 #elif defined(OS_CHROMEOS) | |
| 130 const GURL learn_more_url(chrome::kEnhancedPlaybackNotificationLearnMoreURL); | 118 const GURL learn_more_url(chrome::kEnhancedPlaybackNotificationLearnMoreURL); |
| 131 InfoBarService::WebContentsFromInfoBar(infobar()) | 119 InfoBarService::WebContentsFromInfoBar(infobar()) |
| 132 ->OpenURL(content::OpenURLParams( | 120 ->OpenURL(content::OpenURLParams( |
| 133 learn_more_url, content::Referrer(), | 121 learn_more_url, content::Referrer(), |
| 134 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 122 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 135 ui::PAGE_TRANSITION_LINK, false)); | 123 ui::PAGE_TRANSITION_LINK, false)); |
| 136 #else | |
| 137 NOTIMPLEMENTED(); | |
| 138 #endif | |
| 139 return false; // Do not dismiss the info bar. | 124 return false; // Do not dismiss the info bar. |
| 140 } | 125 } |
| OLD | NEW |