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

Side by Side Diff: chrome/browser/push_messaging/push_messaging_notification_manager.cc

Issue 2300093002: Make //content responsible for generating notification Ids (Closed)
Patch Set: Make //content responsible for generating notification Ids Created 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/push_messaging/push_messaging_notification_manager.h" 5 #include "chrome/browser/push_messaging/push_messaging_notification_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <bitset> 9 #include <bitset>
10 10
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 message_handled_closure))); 321 message_handled_closure)));
322 } 322 }
323 323
324 // static 324 // static
325 void PushMessagingNotificationManager::DidWriteNotificationDataIOProxy( 325 void PushMessagingNotificationManager::DidWriteNotificationDataIOProxy(
326 const base::WeakPtr<PushMessagingNotificationManager>& ui_weak_ptr, 326 const base::WeakPtr<PushMessagingNotificationManager>& ui_weak_ptr,
327 const GURL& origin, 327 const GURL& origin,
328 const PlatformNotificationData& notification_data, 328 const PlatformNotificationData& notification_data,
329 const base::Closure& message_handled_closure, 329 const base::Closure& message_handled_closure,
330 bool success, 330 bool success,
331 int64_t persistent_notification_id) { 331 const std::string& notification_id) {
332 DCHECK_CURRENTLY_ON(BrowserThread::IO); 332 DCHECK_CURRENTLY_ON(BrowserThread::IO);
333 BrowserThread::PostTask( 333 BrowserThread::PostTask(
334 BrowserThread::UI, FROM_HERE, 334 BrowserThread::UI, FROM_HERE,
335 base::Bind(&PushMessagingNotificationManager::DidWriteNotificationData, 335 base::Bind(&PushMessagingNotificationManager::DidWriteNotificationData,
336 ui_weak_ptr, origin, notification_data, 336 ui_weak_ptr, origin, notification_data,
337 message_handled_closure, success, persistent_notification_id)); 337 message_handled_closure, success, notification_id));
338 } 338 }
339 339
340 void PushMessagingNotificationManager::DidWriteNotificationData( 340 void PushMessagingNotificationManager::DidWriteNotificationData(
341 const GURL& origin, 341 const GURL& origin,
342 const PlatformNotificationData& notification_data, 342 const PlatformNotificationData& notification_data,
343 const base::Closure& message_handled_closure, 343 const base::Closure& message_handled_closure,
344 bool success, 344 bool success,
345 int64_t persistent_notification_id) { 345 const std::string& notification_id) {
346 DCHECK_CURRENTLY_ON(BrowserThread::UI); 346 DCHECK_CURRENTLY_ON(BrowserThread::UI);
347 if (!success) { 347 if (!success) {
348 DLOG(ERROR) << "Writing forced notification to database should not fail"; 348 DLOG(ERROR) << "Writing forced notification to database should not fail";
349 message_handled_closure.Run(); 349 message_handled_closure.Run();
350 return; 350 return;
351 } 351 }
352 352
353 // Do not pass service worker scope. The origin will be used instead of the 353 // Do not pass service worker scope. The origin will be used instead of the
354 // service worker scope to determine whether a notification should be 354 // service worker scope to determine whether a notification should be
355 // attributed to a WebAPK on Android. This is OK because this code path is hit 355 // attributed to a WebAPK on Android. This is OK because this code path is hit
356 // rarely. 356 // rarely.
357 PlatformNotificationServiceImpl::GetInstance()->DisplayPersistentNotification( 357 PlatformNotificationServiceImpl::GetInstance()->DisplayPersistentNotification(
358 profile_, persistent_notification_id, GURL() /* service_worker_scope */, 358 profile_, notification_id, GURL() /* service_worker_scope */, origin,
359 origin, notification_data, NotificationResources()); 359 notification_data, NotificationResources());
360 360
361 message_handled_closure.Run(); 361 message_handled_closure.Run();
362 } 362 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698