| 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/common/url_constants.h" |
| 9 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| 10 #include "components/infobars/core/infobar.h" | 11 #include "components/infobars/core/infobar.h" |
| 11 #include "content/public/browser/navigation_entry.h" | 12 #include "content/public/browser/navigation_entry.h" |
| 12 #include "grit/components_strings.h" | 13 #include "grit/components_strings.h" |
| 13 #include "grit/theme_resources.h" | 14 #include "grit/theme_resources.h" |
| 14 #include "net/base/net_util.h" | 15 #include "net/base/net_util.h" |
| 15 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 16 | 17 |
| 17 #if defined(OS_ANDROID) | |
| 18 #include "chrome/browser/android/chromium_application.h" | |
| 19 #endif | |
| 20 | |
| 21 #if defined(OS_CHROMEOS) | |
| 22 #include "chrome/common/url_constants.h" | |
| 23 #endif | |
| 24 | |
| 25 // static | 18 // static |
| 26 infobars::InfoBar* ProtectedMediaIdentifierInfoBarDelegate::Create( | 19 infobars::InfoBar* ProtectedMediaIdentifierInfoBarDelegate::Create( |
| 27 InfoBarService* infobar_service, | 20 InfoBarService* infobar_service, |
| 28 PermissionQueueController* controller, | 21 PermissionQueueController* controller, |
| 29 const PermissionRequestID& id, | 22 const PermissionRequestID& id, |
| 30 const GURL& requesting_frame, | 23 const GURL& requesting_frame, |
| 31 const std::string& display_languages) { | 24 const std::string& display_languages) { |
| 32 const content::NavigationEntry* committed_entry = | 25 const content::NavigationEntry* committed_entry = |
| 33 infobar_service->web_contents()->GetController().GetLastCommittedEntry(); | 26 infobar_service->web_contents()->GetController().GetLastCommittedEntry(); |
| 34 return infobar_service->AddInfoBar( | 27 return infobar_service->AddInfoBar( |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 IDS_PROTECTED_MEDIA_IDENTIFIER_ALLOW_BUTTON : | 100 IDS_PROTECTED_MEDIA_IDENTIFIER_ALLOW_BUTTON : |
| 108 IDS_PROTECTED_MEDIA_IDENTIFIER_DENY_BUTTON); | 101 IDS_PROTECTED_MEDIA_IDENTIFIER_DENY_BUTTON); |
| 109 } | 102 } |
| 110 | 103 |
| 111 bool ProtectedMediaIdentifierInfoBarDelegate::Cancel() { | 104 bool ProtectedMediaIdentifierInfoBarDelegate::Cancel() { |
| 112 SetPermission(true, false); | 105 SetPermission(true, false); |
| 113 return true; | 106 return true; |
| 114 } | 107 } |
| 115 | 108 |
| 116 base::string16 ProtectedMediaIdentifierInfoBarDelegate::GetLinkText() const { | 109 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); | 110 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| 122 #endif | |
| 123 } | 111 } |
| 124 | 112 |
| 125 bool ProtectedMediaIdentifierInfoBarDelegate::LinkClicked( | 113 bool ProtectedMediaIdentifierInfoBarDelegate::LinkClicked( |
| 126 WindowOpenDisposition disposition) { | 114 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); | 115 const GURL learn_more_url(chrome::kEnhancedPlaybackNotificationLearnMoreURL); |
| 131 InfoBarService::WebContentsFromInfoBar(infobar()) | 116 InfoBarService::WebContentsFromInfoBar(infobar()) |
| 132 ->OpenURL(content::OpenURLParams( | 117 ->OpenURL(content::OpenURLParams( |
| 133 learn_more_url, content::Referrer(), | 118 learn_more_url, content::Referrer(), |
| 134 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 119 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 135 ui::PAGE_TRANSITION_LINK, false)); | 120 ui::PAGE_TRANSITION_LINK, false)); |
| 136 #else | |
| 137 NOTIMPLEMENTED(); | |
| 138 #endif | |
| 139 return false; // Do not dismiss the info bar. | 121 return false; // Do not dismiss the info bar. |
| 140 } | 122 } |
| OLD | NEW |