Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/notifications/desktop_notification_infobar_delegate.h> |
|
Peter Beverloo
2014/07/10 11:29:39
Includes of source files should use quotes, not br
Miguel Garcia
2014/07/17 17:24:48
Yeah sorry, eclipse decides <> are better not sure
| |
| 6 | |
| 7 #include "chrome/browser/content_settings/permission_queue_controller.h" | 6 #include "chrome/browser/content_settings/permission_queue_controller.h" |
| 8 #include "chrome/browser/content_settings/permission_request_id.h" | 7 #include "chrome/browser/content_settings/permission_request_id.h" |
| 9 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
| 10 #include "components/infobars/core/infobar.h" | 9 #include "components/infobars/core/infobar.h" |
| 11 #include "content/public/browser/navigation_entry.h" | 10 #include "content/public/browser/navigation_entry.h" |
| 12 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 13 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
| 14 #include "grit/locale_settings.h" | 13 #include "grit/locale_settings.h" |
| 15 #include "grit/theme_resources.h" | 14 #include "grit/theme_resources.h" |
| 16 #include "net/base/net_util.h" | 15 #include "net/base/net_util.h" |
| 17 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 18 | 17 |
| 19 // static | 18 // static |
| 20 infobars::InfoBar* MidiPermissionInfoBarDelegate::Create( | 19 infobars::InfoBar* DesktopNotificationInfoBarDelegate::Create( |
| 21 InfoBarService* infobar_service, | 20 InfoBarService* infobar_service, |
| 22 PermissionQueueController* controller, | 21 PermissionQueueController* controller, |
| 23 const PermissionRequestID& id, | 22 const PermissionRequestID& id, |
| 24 const GURL& requesting_frame, | 23 const GURL& requesting_frame, |
| 25 const std::string& display_languages) { | 24 const std::string& display_languages) { |
| 26 const content::NavigationEntry* committed_entry = | 25 const content::NavigationEntry* committed_entry = |
| 27 infobar_service->web_contents()->GetController().GetLastCommittedEntry(); | 26 infobar_service->web_contents()->GetController().GetLastCommittedEntry(); |
| 28 return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 27 return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( |
| 29 scoped_ptr<ConfirmInfoBarDelegate>(new MidiPermissionInfoBarDelegate( | 28 scoped_ptr<ConfirmInfoBarDelegate>(new DesktopNotificationInfoBarDelegate( |
| 30 controller, id, requesting_frame, | 29 controller, id, requesting_frame, |
| 31 committed_entry ? committed_entry->GetUniqueID() : 0, | 30 committed_entry ? committed_entry->GetUniqueID() : 0, |
| 32 display_languages)))); | 31 display_languages)))); |
| 33 } | 32 } |
| 34 | 33 |
| 35 MidiPermissionInfoBarDelegate::MidiPermissionInfoBarDelegate( | 34 DesktopNotificationInfoBarDelegate::DesktopNotificationInfoBarDelegate( |
| 36 PermissionQueueController* controller, | 35 PermissionQueueController* controller, |
| 37 const PermissionRequestID& id, | 36 const PermissionRequestID& id, |
| 38 const GURL& requesting_frame, | 37 const GURL& requesting_frame, |
| 39 int contents_unique_id, | 38 int contents_unique_id, |
| 40 const std::string& display_languages) | 39 const std::string& display_languages) |
| 41 : PermissionInfobarDelegate(controller, id, requesting_frame), | 40 : PermissionInfobarDelegate(controller, id, requesting_frame), |
|
Peter Beverloo
2014/07/10 11:29:39
nit: four space indent.
Miguel Garcia
2014/07/17 17:24:48
Done.
| |
| 42 requesting_frame_(requesting_frame), | 41 requesting_frame_(requesting_frame), |
| 43 display_languages_(display_languages) { | 42 display_languages_(display_languages) { |
| 43 | |
| 44 } | 44 } |
| 45 | 45 |
| 46 MidiPermissionInfoBarDelegate::~MidiPermissionInfoBarDelegate() { | 46 DesktopNotificationInfoBarDelegate::~DesktopNotificationInfoBarDelegate() { |
| 47 } | 47 } |
| 48 | 48 |
| 49 int MidiPermissionInfoBarDelegate::GetIconID() const { | 49 int DesktopNotificationInfoBarDelegate::GetIconID() const { |
| 50 return IDR_INFOBAR_MIDI; | 50 return IDR_INFOBAR_DESKTOP_NOTIFICATIONS; |
| 51 } | 51 } |
| 52 | 52 |
| 53 base::string16 MidiPermissionInfoBarDelegate::GetMessageText() const { | 53 base::string16 DesktopNotificationInfoBarDelegate::GetMessageText() const { |
| 54 return l10n_util::GetStringFUTF16( | 54 return l10n_util::GetStringFUTF16( |
| 55 IDS_MIDI_SYSEX_INFOBAR_QUESTION, | 55 IDS_NOTIFICATION_PERMISSIONS, |
| 56 net::FormatUrl(requesting_frame_.GetOrigin(), display_languages_, | 56 net::FormatUrl(requesting_frame_.GetOrigin(), display_languages_, |
| 57 net::kFormatUrlOmitUsernamePassword | | 57 net::kFormatUrlOmitUsernamePassword | |
| 58 net::kFormatUrlOmitTrailingSlashOnBareHostname, | 58 net::kFormatUrlOmitTrailingSlashOnBareHostname, |
| 59 net::UnescapeRule::SPACES, NULL, NULL, NULL)); | 59 net::UnescapeRule::SPACES, NULL, NULL, NULL)); |
| 60 } | 60 } |
| OLD | NEW |