| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/media/protected_media_identifier_infobar_delegate.h" | |
| 6 | |
| 7 #include "chrome/browser/android/android_theme_resources.h" | |
| 8 #include "chrome/browser/infobars/infobar_service.h" | |
| 9 #include "chrome/common/url_constants.h" | |
| 10 #include "chrome/grit/generated_resources.h" | |
| 11 #include "components/infobars/core/infobar.h" | |
| 12 #include "components/url_formatter/elide_url.h" | |
| 13 #include "grit/components_strings.h" | |
| 14 #include "ui/base/l10n/l10n_util.h" | |
| 15 | |
| 16 // static | |
| 17 infobars::InfoBar* ProtectedMediaIdentifierInfoBarDelegate::Create( | |
| 18 InfoBarService* infobar_service, | |
| 19 const GURL& requesting_frame, | |
| 20 const std::string& display_languages, | |
| 21 const PermissionSetCallback& callback) { | |
| 22 return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( | |
| 23 scoped_ptr<ConfirmInfoBarDelegate>( | |
| 24 new ProtectedMediaIdentifierInfoBarDelegate( | |
| 25 requesting_frame, display_languages, callback)))); | |
| 26 } | |
| 27 | |
| 28 ProtectedMediaIdentifierInfoBarDelegate:: | |
| 29 ProtectedMediaIdentifierInfoBarDelegate( | |
| 30 const GURL& requesting_frame, | |
| 31 const std::string& display_languages, | |
| 32 const PermissionSetCallback& callback) | |
| 33 : PermissionInfobarDelegate( | |
| 34 requesting_frame, | |
| 35 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, | |
| 36 callback), | |
| 37 requesting_frame_(requesting_frame), | |
| 38 display_languages_(display_languages) { | |
| 39 } | |
| 40 | |
| 41 ProtectedMediaIdentifierInfoBarDelegate:: | |
| 42 ~ProtectedMediaIdentifierInfoBarDelegate() { | |
| 43 } | |
| 44 | |
| 45 int ProtectedMediaIdentifierInfoBarDelegate::GetIconId() const { | |
| 46 return IDR_ANDROID_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; | |
| 47 } | |
| 48 | |
| 49 base::string16 ProtectedMediaIdentifierInfoBarDelegate::GetMessageText() const { | |
| 50 return l10n_util::GetStringFUTF16( | |
| 51 IDS_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_QUESTION, | |
| 52 url_formatter::FormatUrlForSecurityDisplay(requesting_frame_, | |
| 53 display_languages_)); | |
| 54 } | |
| 55 | |
| 56 base::string16 ProtectedMediaIdentifierInfoBarDelegate::GetLinkText() const { | |
| 57 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | |
| 58 } | |
| 59 | |
| 60 GURL ProtectedMediaIdentifierInfoBarDelegate::GetLinkURL() const { | |
| 61 return GURL(chrome::kEnhancedPlaybackNotificationLearnMoreURL); | |
| 62 } | |
| OLD | NEW |