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