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

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

Issue 2392343002: Plumbing in notification replies: PlatformNotificationService -> SW (Closed)
Patch Set: Remove todo as it doesn't seem necessary after all Created 4 years, 2 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/persistent_notification_delegate.h" 5 #include "chrome/browser/notifications/persistent_notification_delegate.h"
6 6
7 #include "base/strings/nullable_string16.h"
8 #include "base/strings/string16.h"
7 #include "chrome/browser/notifications/platform_notification_service_impl.h" 9 #include "chrome/browser/notifications/platform_notification_service_impl.h"
8 #include "url/gurl.h" 10 #include "url/gurl.h"
9 11
10 PersistentNotificationDelegate::PersistentNotificationDelegate( 12 PersistentNotificationDelegate::PersistentNotificationDelegate(
11 content::BrowserContext* browser_context, 13 content::BrowserContext* browser_context,
12 const std::string& notification_id, 14 const std::string& notification_id,
13 const GURL& origin, 15 const GURL& origin,
14 int notification_settings_index) 16 int notification_settings_index)
15 : WebNotificationDelegate(browser_context, notification_id, origin), 17 : WebNotificationDelegate(browser_context, notification_id, origin),
16 notification_settings_index_(notification_settings_index) {} 18 notification_settings_index_(notification_settings_index) {}
17 19
18 PersistentNotificationDelegate::~PersistentNotificationDelegate() {} 20 PersistentNotificationDelegate::~PersistentNotificationDelegate() {}
19 21
20 void PersistentNotificationDelegate::Display() {} 22 void PersistentNotificationDelegate::Display() {}
21 23
22 void PersistentNotificationDelegate::Close(bool by_user) { 24 void PersistentNotificationDelegate::Close(bool by_user) {
23 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClose( 25 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClose(
24 browser_context(), id(), origin(), by_user); 26 browser_context(), id(), origin(), by_user);
25 } 27 }
26 28
27 void PersistentNotificationDelegate::Click() { 29 void PersistentNotificationDelegate::Click() {
28 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClick( 30 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClick(
29 browser_context(), id(), origin(), -1 /* action_index */); 31 browser_context(), id(), origin(), -1 /* action_index */,
32 base::NullableString16() /* reply */);
30 } 33 }
31 34
32 void PersistentNotificationDelegate::ButtonClick(int button_index) { 35 void PersistentNotificationDelegate::ButtonClick(int button_index) {
33 DCHECK_GE(button_index, 0); 36 DCHECK_GE(button_index, 0);
34 if (button_index == notification_settings_index_) { 37 if (button_index == notification_settings_index_) {
35 NotificationCommon::OpenNotificationSettings(browser_context()); 38 NotificationCommon::OpenNotificationSettings(browser_context());
36 return; 39 return;
37 } 40 }
38 41
39 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClick( 42 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClick(
40 browser_context(), id(), origin(), button_index); 43 browser_context(), id(), origin(), button_index,
44 base::NullableString16() /* reply */);
41 } 45 }
46
47 void PersistentNotificationDelegate::ButtonClickWithReply(
48 int button_index,
49 const base::string16& reply) {
50 DCHECK_GE(button_index, 0);
51 if (button_index == notification_settings_index_) {
Peter Beverloo 2016/10/11 14:22:56 DCHECK_NE? Why would the site settings button take
awdf 2016/10/11 15:51:27 oops - this came from copy pasting the method abov
awdf 2016/10/12 10:44:58 I remember why it's gnarly now - it's because ther
awdf 2016/10/12 13:26:42 Done (removed the unnecessary settings check, but
52 NotificationCommon::OpenNotificationSettings(browser_context());
53 return;
54 }
55
56 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClick(
57 browser_context(), id(), origin(), button_index,
58 base::NullableString16(reply, false /* is_null */));
59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698