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/midi_permission_infobar_delegate.h" | 5 #include "chrome/browser/durable_storage_permission_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | |
| 7 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
| 8 #include "chrome/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
| 9 #include "components/infobars/core/infobar.h" | 10 #include "components/infobars/core/infobar.h" |
| 10 #include "grit/theme_resources.h" | 11 #include "grit/theme_resources.h" |
| 11 #include "net/base/net_util.h" | 12 #include "net/base/net_util.h" |
| 12 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 13 | 14 |
| 14 // static | 15 // static |
| 15 infobars::InfoBar* MidiPermissionInfoBarDelegate::Create( | 16 infobars::InfoBar* DurableStoragePermissionInfoBarDelegate::Create( |
| 16 InfoBarService* infobar_service, | 17 InfoBarService* infobar_service, |
| 17 PermissionQueueController* controller, | 18 PermissionQueueController* controller, |
| 18 const PermissionRequestID& id, | 19 const PermissionRequestID& id, |
| 19 const GURL& requesting_frame, | 20 const GURL& requesting_frame, |
| 20 const std::string& display_languages, | 21 const std::string& display_languages, |
| 21 ContentSettingsType type) { | 22 ContentSettingsType type) { |
| 22 return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( | 23 return infobar_service->AddInfoBar( |
| 23 scoped_ptr<ConfirmInfoBarDelegate>(new MidiPermissionInfoBarDelegate( | 24 infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( |
| 24 controller, id, requesting_frame, display_languages, type)))); | 25 new DurableStoragePermissionInfoBarDelegate( |
| 26 controller, id, requesting_frame, display_languages, type)))); | |
| 25 } | 27 } |
| 26 | 28 |
| 27 MidiPermissionInfoBarDelegate::MidiPermissionInfoBarDelegate( | 29 DurableStoragePermissionInfoBarDelegate:: |
| 28 PermissionQueueController* controller, | 30 DurableStoragePermissionInfoBarDelegate( |
| 29 const PermissionRequestID& id, | 31 PermissionQueueController* controller, |
| 30 const GURL& requesting_frame, | 32 const PermissionRequestID& id, |
| 31 const std::string& display_languages, | 33 const GURL& requesting_frame, |
| 32 ContentSettingsType type) | 34 const std::string& display_languages, |
| 35 ContentSettingsType type) | |
| 33 : PermissionInfobarDelegate(controller, id, requesting_frame, type), | 36 : PermissionInfobarDelegate(controller, id, requesting_frame, type), |
| 34 requesting_frame_(requesting_frame), | 37 requesting_frame_(requesting_frame), |
| 35 display_languages_(display_languages) { | 38 display_languages_(display_languages) { |
| 36 } | 39 } |
| 37 | 40 |
| 38 MidiPermissionInfoBarDelegate::~MidiPermissionInfoBarDelegate() { | 41 base::string16 DurableStoragePermissionInfoBarDelegate::GetMessageText() const { |
| 39 } | |
| 40 | |
| 41 int MidiPermissionInfoBarDelegate::GetIconID() const { | |
|
mlamouri (slow - plz ping)
2015/08/10 14:41:15
You will need an icon for the InfoBarDelegate. You
dgrogan
2015/08/10 22:39:19
Acknowledged.
| |
| 42 return IDR_INFOBAR_MIDI; | |
| 43 } | |
| 44 | |
| 45 base::string16 MidiPermissionInfoBarDelegate::GetMessageText() const { | |
| 46 return l10n_util::GetStringFUTF16( | 42 return l10n_util::GetStringFUTF16( |
| 47 IDS_MIDI_SYSEX_INFOBAR_QUESTION, | 43 IDS_DURABLE_STORAGE_INFOBAR_QUESTION, |
| 48 net::FormatUrl(requesting_frame_.GetOrigin(), display_languages_, | 44 net::FormatUrl(requesting_frame_.GetOrigin(), display_languages_, |
| 49 net::kFormatUrlOmitUsernamePassword | | 45 net::kFormatUrlOmitUsernamePassword | |
| 50 net::kFormatUrlOmitTrailingSlashOnBareHostname, | 46 net::kFormatUrlOmitTrailingSlashOnBareHostname, |
| 51 net::UnescapeRule::SPACES, NULL, NULL, NULL)); | 47 net::UnescapeRule::SPACES, NULL, NULL, NULL)); |
| 52 } | 48 } |
| OLD | NEW |