| 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/midi_permission_infobar_delegate.h" | 5 #include "chrome/browser/media/midi_permission_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "chrome/browser/infobars/infobar_service.h" | 7 #include "chrome/browser/infobars/infobar_service.h" |
| 8 #include "chrome/grit/generated_resources.h" | 8 #include "chrome/grit/generated_resources.h" |
| 9 #include "components/infobars/core/infobar.h" | 9 #include "components/infobars/core/infobar.h" |
| 10 #include "components/url_formatter/url_formatter.h" | 10 #include "components/url_formatter/url_formatter.h" |
| 11 #include "grit/theme_resources.h" | 11 #include "grit/theme_resources.h" |
| 12 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 infobars::InfoBar* MidiPermissionInfoBarDelegate::Create( | 15 infobars::InfoBar* MidiPermissionInfoBarDelegate::Create( |
| 16 InfoBarService* infobar_service, | 16 InfoBarService* infobar_service, |
| 17 PermissionQueueController* controller, | |
| 18 const PermissionRequestID& id, | 17 const PermissionRequestID& id, |
| 19 const GURL& requesting_frame, | 18 const GURL& requesting_frame, |
| 20 const std::string& display_languages, | 19 const std::string& display_languages, |
| 21 ContentSettingsType type) { | 20 ContentSettingsType type, |
| 21 const base::Callback<void(bool, bool)>& callback) { |
| 22 return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( | 22 return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( |
| 23 scoped_ptr<ConfirmInfoBarDelegate>(new MidiPermissionInfoBarDelegate( | 23 scoped_ptr<ConfirmInfoBarDelegate>(new MidiPermissionInfoBarDelegate( |
| 24 controller, id, requesting_frame, display_languages, type)))); | 24 id, requesting_frame, display_languages, type, callback)))); |
| 25 } | 25 } |
| 26 | 26 |
| 27 MidiPermissionInfoBarDelegate::MidiPermissionInfoBarDelegate( | 27 MidiPermissionInfoBarDelegate::MidiPermissionInfoBarDelegate( |
| 28 PermissionQueueController* controller, | |
| 29 const PermissionRequestID& id, | 28 const PermissionRequestID& id, |
| 30 const GURL& requesting_frame, | 29 const GURL& requesting_frame, |
| 31 const std::string& display_languages, | 30 const std::string& display_languages, |
| 32 ContentSettingsType type) | 31 ContentSettingsType type, |
| 33 : PermissionInfobarDelegate(controller, id, requesting_frame, type), | 32 const base::Callback<void(bool, bool)>& callback) |
| 33 : PermissionInfobarDelegate(id, requesting_frame, type, callback), |
| 34 requesting_frame_(requesting_frame), | 34 requesting_frame_(requesting_frame), |
| 35 display_languages_(display_languages) { | 35 display_languages_(display_languages) { |
| 36 } | 36 } |
| 37 | 37 |
| 38 MidiPermissionInfoBarDelegate::~MidiPermissionInfoBarDelegate() { | 38 MidiPermissionInfoBarDelegate::~MidiPermissionInfoBarDelegate() { |
| 39 } | 39 } |
| 40 | 40 |
| 41 int MidiPermissionInfoBarDelegate::GetIconId() const { | 41 int MidiPermissionInfoBarDelegate::GetIconId() const { |
| 42 return IDR_INFOBAR_MIDI; | 42 return IDR_INFOBAR_MIDI; |
| 43 } | 43 } |
| 44 | 44 |
| 45 base::string16 MidiPermissionInfoBarDelegate::GetMessageText() const { | 45 base::string16 MidiPermissionInfoBarDelegate::GetMessageText() const { |
| 46 return l10n_util::GetStringFUTF16( | 46 return l10n_util::GetStringFUTF16( |
| 47 IDS_MIDI_SYSEX_INFOBAR_QUESTION, | 47 IDS_MIDI_SYSEX_INFOBAR_QUESTION, |
| 48 url_formatter::FormatUrl( | 48 url_formatter::FormatUrl( |
| 49 requesting_frame_.GetOrigin(), display_languages_, | 49 requesting_frame_.GetOrigin(), display_languages_, |
| 50 url_formatter::kFormatUrlOmitUsernamePassword | | 50 url_formatter::kFormatUrlOmitUsernamePassword | |
| 51 url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, | 51 url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, |
| 52 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr)); | 52 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr)); |
| 53 } | 53 } |
| OLD | NEW |