Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(798)

Side by Side Diff: chrome/browser/notifications/notification_permission_infobar_delegate.cc

Issue 1332293002: permissions: switch from explicitly passing queue controller to callbacks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unecessary includes Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 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/notifications/notification_permission_infobar_delegate. h" 5 #include "chrome/browser/notifications/notification_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 "net/base/escape.h" 12 #include "net/base/escape.h"
13 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
14 14
15 // static 15 // static
16 infobars::InfoBar* NotificationPermissionInfobarDelegate::Create( 16 infobars::InfoBar* NotificationPermissionInfobarDelegate::Create(
17 InfoBarService* infobar_service, 17 InfoBarService* infobar_service,
18 PermissionQueueController* controller,
19 const PermissionRequestID& id, 18 const PermissionRequestID& id,
20 const GURL& requesting_frame, 19 const GURL& requesting_frame,
21 const std::string& display_languages) { 20 const std::string& display_languages,
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>( 23 scoped_ptr<ConfirmInfoBarDelegate>(
24 new NotificationPermissionInfobarDelegate(controller, id, 24 new NotificationPermissionInfobarDelegate(id, requesting_frame,
25 requesting_frame, 25 display_languages,
26 display_languages)))); 26 callback))));
27 } 27 }
28 28
29 NotificationPermissionInfobarDelegate::NotificationPermissionInfobarDelegate( 29 NotificationPermissionInfobarDelegate::NotificationPermissionInfobarDelegate(
30 PermissionQueueController* controller,
31 const PermissionRequestID& id, 30 const PermissionRequestID& id,
32 const GURL& requesting_frame, 31 const GURL& requesting_frame,
33 const std::string& display_languages) 32 const std::string& display_languages,
34 : PermissionInfobarDelegate(controller, id, requesting_frame, 33 const base::Callback<void(bool, bool)>& callback)
35 CONTENT_SETTINGS_TYPE_NOTIFICATIONS), 34 : PermissionInfobarDelegate(id, requesting_frame,
35 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
36 callback),
36 requesting_frame_(requesting_frame), 37 requesting_frame_(requesting_frame),
37 display_languages_(display_languages) {} 38 display_languages_(display_languages) {}
38 39
39 NotificationPermissionInfobarDelegate::~NotificationPermissionInfobarDelegate() 40 NotificationPermissionInfobarDelegate::~NotificationPermissionInfobarDelegate()
40 {} 41 {}
41 42
42 int NotificationPermissionInfobarDelegate::GetIconId() const { 43 int NotificationPermissionInfobarDelegate::GetIconId() const {
43 return IDR_INFOBAR_DESKTOP_NOTIFICATIONS; 44 return IDR_INFOBAR_DESKTOP_NOTIFICATIONS;
44 } 45 }
45 46
46 base::string16 NotificationPermissionInfobarDelegate::GetMessageText() const { 47 base::string16 NotificationPermissionInfobarDelegate::GetMessageText() const {
47 return l10n_util::GetStringFUTF16( 48 return l10n_util::GetStringFUTF16(
48 IDS_NOTIFICATION_PERMISSIONS, 49 IDS_NOTIFICATION_PERMISSIONS,
49 url_formatter::FormatUrl( 50 url_formatter::FormatUrl(
50 requesting_frame_.GetOrigin(), display_languages_, 51 requesting_frame_.GetOrigin(), display_languages_,
51 url_formatter::kFormatUrlOmitUsernamePassword | 52 url_formatter::kFormatUrlOmitUsernamePassword |
52 url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, 53 url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname,
53 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr)); 54 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr));
54 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698