ExtensionSyncService cleanup: process uninstalls in one step
[chromium-blink-merge.git] / chrome / browser / notifications / notification_permission_infobar_delegate.cc
blob54ccf0bb7b32fff3ced4e4a3921e2a955dca9cd9
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
3 // found in the LICENSE file.
5 #include "chrome/browser/notifications/notification_permission_infobar_delegate.h"
7 #include "chrome/browser/infobars/infobar_service.h"
8 #include "chrome/grit/generated_resources.h"
9 #include "components/infobars/core/infobar.h"
10 #include "grit/theme_resources.h"
11 #include "net/base/net_util.h"
12 #include "ui/base/l10n/l10n_util.h"
14 // static
15 infobars::InfoBar* NotificationPermissionInfobarDelegate::Create(
16 InfoBarService* infobar_service,
17 PermissionQueueController* controller,
18 const PermissionRequestID& id,
19 const GURL& requesting_frame,
20 const std::string& display_languages) {
21 return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar(
22 scoped_ptr<ConfirmInfoBarDelegate>(
23 new NotificationPermissionInfobarDelegate(controller, id,
24 requesting_frame,
25 display_languages))));
28 NotificationPermissionInfobarDelegate::NotificationPermissionInfobarDelegate(
29 PermissionQueueController* controller,
30 const PermissionRequestID& id,
31 const GURL& requesting_frame,
32 const std::string& display_languages)
33 : PermissionInfobarDelegate(controller, id, requesting_frame,
34 CONTENT_SETTINGS_TYPE_NOTIFICATIONS),
35 requesting_frame_(requesting_frame),
36 display_languages_(display_languages) {}
38 NotificationPermissionInfobarDelegate::~NotificationPermissionInfobarDelegate()
41 int NotificationPermissionInfobarDelegate::GetIconID() const {
42 return IDR_INFOBAR_DESKTOP_NOTIFICATIONS;
45 base::string16 NotificationPermissionInfobarDelegate::GetMessageText() const {
46 return l10n_util::GetStringFUTF16(
47 IDS_NOTIFICATION_PERMISSIONS,
48 net::FormatUrl(requesting_frame_.GetOrigin(), display_languages_,
49 net::kFormatUrlOmitUsernamePassword |
50 net::kFormatUrlOmitTrailingSlashOnBareHostname,
51 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr));