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

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

Issue 2392343002: Plumbing in notification replies: PlatformNotificationService -> SW (Closed)
Patch Set: include base/logging.h for NOTIMPLEMENTED 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/platform_notification_service_impl.h" 5 #include "chrome/browser/notifications/platform_notification_service_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 pending_click_dispatch_events_ = 0; 100 pending_click_dispatch_events_ = 0;
101 #endif 101 #endif
102 } 102 }
103 103
104 PlatformNotificationServiceImpl::~PlatformNotificationServiceImpl() {} 104 PlatformNotificationServiceImpl::~PlatformNotificationServiceImpl() {}
105 105
106 void PlatformNotificationServiceImpl::OnPersistentNotificationClick( 106 void PlatformNotificationServiceImpl::OnPersistentNotificationClick(
107 BrowserContext* browser_context, 107 BrowserContext* browser_context,
108 const std::string& notification_id, 108 const std::string& notification_id,
109 const GURL& origin, 109 const GURL& origin,
110 int action_index) { 110 int action_index,
111 const base::NullableString16& reply) {
111 DCHECK_CURRENTLY_ON(BrowserThread::UI); 112 DCHECK_CURRENTLY_ON(BrowserThread::UI);
112 blink::mojom::PermissionStatus permission_status = 113 blink::mojom::PermissionStatus permission_status =
113 CheckPermissionOnUIThread(browser_context, origin, 114 CheckPermissionOnUIThread(browser_context, origin,
114 kInvalidRenderProcessId); 115 kInvalidRenderProcessId);
115 116
116 // TODO(peter): Change this to a CHECK() when Issue 555572 is resolved. 117 // TODO(peter): Change this to a CHECK() when Issue 555572 is resolved.
117 // Also change this method to be const again. 118 // Also change this method to be const again.
118 if (permission_status != blink::mojom::PermissionStatus::GRANTED) { 119 if (permission_status != blink::mojom::PermissionStatus::GRANTED) {
119 content::RecordAction(base::UserMetricsAction( 120 content::RecordAction(base::UserMetricsAction(
120 "Notifications.Persistent.ClickedWithoutPermission")); 121 "Notifications.Persistent.ClickedWithoutPermission"));
(...skipping 12 matching lines...) Expand all
133 // Ensure the browser stays alive while the event is processed. 134 // Ensure the browser stays alive while the event is processed.
134 if (pending_click_dispatch_events_++ == 0) { 135 if (pending_click_dispatch_events_++ == 0) {
135 click_dispatch_keep_alive_.reset( 136 click_dispatch_keep_alive_.reset(
136 new ScopedKeepAlive(KeepAliveOrigin::PENDING_NOTIFICATION_CLICK_EVENT, 137 new ScopedKeepAlive(KeepAliveOrigin::PENDING_NOTIFICATION_CLICK_EVENT,
137 KeepAliveRestartOption::DISABLED)); 138 KeepAliveRestartOption::DISABLED));
138 } 139 }
139 #endif 140 #endif
140 141
141 content::NotificationEventDispatcher::GetInstance() 142 content::NotificationEventDispatcher::GetInstance()
142 ->DispatchNotificationClickEvent( 143 ->DispatchNotificationClickEvent(
143 browser_context, notification_id, origin, action_index, 144 browser_context, notification_id, origin, action_index, reply,
144 base::Bind( 145 base::Bind(
145 &PlatformNotificationServiceImpl::OnClickEventDispatchComplete, 146 &PlatformNotificationServiceImpl::OnClickEventDispatchComplete,
146 base::Unretained(this))); 147 base::Unretained(this)));
147 } 148 }
148 149
149 void PlatformNotificationServiceImpl::OnPersistentNotificationClose( 150 void PlatformNotificationServiceImpl::OnPersistentNotificationClose(
150 BrowserContext* browser_context, 151 BrowserContext* browser_context,
151 const std::string& notification_id, 152 const std::string& notification_id,
152 const GURL& origin, 153 const GURL& origin,
153 bool by_user) { 154 bool by_user) {
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 } 496 }
496 #endif 497 #endif
497 498
498 return base::string16(); 499 return base::string16();
499 } 500 }
500 501
501 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( 502 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting(
502 NotificationDisplayService* display_service) { 503 NotificationDisplayService* display_service) {
503 test_display_service_ = display_service; 504 test_display_service_ = display_service;
504 } 505 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698