| 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/infobars/infobar_service.h" | 7 #include "chrome/browser/infobars/infobar_service.h" |
| 8 #include "chrome/browser/permissions/permission_queue_controller.h" | |
| 9 #include "chrome/browser/permissions/permission_request_id.h" | |
| 10 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
| 11 #include "chrome/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
| 12 #include "components/infobars/core/infobar.h" | 10 #include "components/infobars/core/infobar.h" |
| 13 #include "components/url_formatter/url_formatter.h" | 11 #include "components/url_formatter/url_formatter.h" |
| 14 #include "grit/components_strings.h" | 12 #include "grit/components_strings.h" |
| 15 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 17 | 15 |
| 18 // static | 16 // static |
| 19 infobars::InfoBar* ProtectedMediaIdentifierInfoBarDelegate::Create( | 17 infobars::InfoBar* ProtectedMediaIdentifierInfoBarDelegate::Create( |
| 20 InfoBarService* infobar_service, | 18 InfoBarService* infobar_service, |
| 21 PermissionQueueController* controller, | |
| 22 const PermissionRequestID& id, | |
| 23 const GURL& requesting_frame, | 19 const GURL& requesting_frame, |
| 24 const std::string& display_languages) { | 20 const std::string& display_languages, |
| 21 const PermissionSetCallback& callback) { |
| 25 return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( | 22 return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( |
| 26 scoped_ptr<ConfirmInfoBarDelegate>( | 23 scoped_ptr<ConfirmInfoBarDelegate>( |
| 27 new ProtectedMediaIdentifierInfoBarDelegate( | 24 new ProtectedMediaIdentifierInfoBarDelegate( |
| 28 controller, id, requesting_frame, display_languages)))); | 25 requesting_frame, display_languages, callback)))); |
| 29 } | 26 } |
| 30 | 27 |
| 31 ProtectedMediaIdentifierInfoBarDelegate:: | 28 ProtectedMediaIdentifierInfoBarDelegate:: |
| 32 ProtectedMediaIdentifierInfoBarDelegate( | 29 ProtectedMediaIdentifierInfoBarDelegate( |
| 33 PermissionQueueController* controller, | |
| 34 const PermissionRequestID& id, | |
| 35 const GURL& requesting_frame, | 30 const GURL& requesting_frame, |
| 36 const std::string& display_languages) | 31 const std::string& display_languages, |
| 32 const PermissionSetCallback& callback) |
| 37 : PermissionInfobarDelegate( | 33 : PermissionInfobarDelegate( |
| 38 controller, id, requesting_frame, | 34 requesting_frame, |
| 39 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER), | 35 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, |
| 36 callback), |
| 40 requesting_frame_(requesting_frame), | 37 requesting_frame_(requesting_frame), |
| 41 display_languages_(display_languages) { | 38 display_languages_(display_languages) { |
| 42 } | 39 } |
| 43 | 40 |
| 44 ProtectedMediaIdentifierInfoBarDelegate:: | 41 ProtectedMediaIdentifierInfoBarDelegate:: |
| 45 ~ProtectedMediaIdentifierInfoBarDelegate() { | 42 ~ProtectedMediaIdentifierInfoBarDelegate() { |
| 46 } | 43 } |
| 47 | 44 |
| 48 int ProtectedMediaIdentifierInfoBarDelegate::GetIconId() const { | 45 int ProtectedMediaIdentifierInfoBarDelegate::GetIconId() const { |
| 49 return IDR_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; | 46 return IDR_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 63 bool ProtectedMediaIdentifierInfoBarDelegate::LinkClicked( | 60 bool ProtectedMediaIdentifierInfoBarDelegate::LinkClicked( |
| 64 WindowOpenDisposition disposition) { | 61 WindowOpenDisposition disposition) { |
| 65 InfoBarService::WebContentsFromInfoBar(infobar()) | 62 InfoBarService::WebContentsFromInfoBar(infobar()) |
| 66 ->OpenURL(content::OpenURLParams( | 63 ->OpenURL(content::OpenURLParams( |
| 67 GURL(chrome::kEnhancedPlaybackNotificationLearnMoreURL), | 64 GURL(chrome::kEnhancedPlaybackNotificationLearnMoreURL), |
| 68 content::Referrer(), | 65 content::Referrer(), |
| 69 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 66 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 70 ui::PAGE_TRANSITION_LINK, false)); | 67 ui::PAGE_TRANSITION_LINK, false)); |
| 71 return false; // Do not dismiss the info bar. | 68 return false; // Do not dismiss the info bar. |
| 72 } | 69 } |
| OLD | NEW |