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

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

Issue 2828503005: Add NotificationDisplayServiceProxy (Closed)
Patch Set: Created 3 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/native_notification_display_service.h" 5 #include "chrome/browser/notifications/native_notification_display_service.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/strings/nullable_string16.h" 8 #include "base/strings/nullable_string16.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/notifications/non_persistent_notification_handler.h" 10 #include "chrome/browser/notifications/non_persistent_notification_handler.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 notification_bridge_->Close(GetProfileId(profile_), notification_id); 64 notification_bridge_->Close(GetProfileId(profile_), notification_id);
65 65
66 // TODO(miguelg): Figure out something better here, passing an empty 66 // TODO(miguelg): Figure out something better here, passing an empty
67 // origin works because only non persistent notifications care about 67 // origin works because only non persistent notifications care about
68 // this method for JS generated close calls and they don't require 68 // this method for JS generated close calls and they don't require
69 // the origin. 69 // the origin.
70 handler->OnClose(profile_, "", notification_id, false /* by user */); 70 handler->OnClose(profile_, "", notification_id, false /* by user */);
71 } 71 }
72 72
73 void NativeNotificationDisplayService::GetDisplayed( 73 void NativeNotificationDisplayService::GetDisplayed(
74 const DisplayedNotificationsCallback& callback) const { 74 const DisplayedNotificationsCallback& callback) {
75 return notification_bridge_->GetDisplayed( 75 return notification_bridge_->GetDisplayed(
76 GetProfileId(profile_), profile_->IsOffTheRecord(), callback); 76 GetProfileId(profile_), profile_->IsOffTheRecord(), callback);
77 } 77 }
78 78
79 void NativeNotificationDisplayService::ProcessNotificationOperation( 79 void NativeNotificationDisplayService::ProcessNotificationOperation(
80 NotificationCommon::Operation operation, 80 NotificationCommon::Operation operation,
81 NotificationCommon::Type notification_type, 81 NotificationCommon::Type notification_type,
82 const std::string& origin, 82 const std::string& origin,
83 const std::string& notification_id, 83 const std::string& notification_id,
84 int action_index, 84 int action_index,
(...skipping 26 matching lines...) Expand all
111 notification_handlers_.erase(notification_type); 111 notification_handlers_.erase(notification_type);
112 } 112 }
113 113
114 NotificationHandler* NativeNotificationDisplayService::GetNotificationHandler( 114 NotificationHandler* NativeNotificationDisplayService::GetNotificationHandler(
115 NotificationCommon::Type notification_type) { 115 NotificationCommon::Type notification_type) {
116 DCHECK(notification_handlers_.find(notification_type) != 116 DCHECK(notification_handlers_.find(notification_type) !=
117 notification_handlers_.end()) 117 notification_handlers_.end())
118 << notification_type << " is not registered."; 118 << notification_type << " is not registered.";
119 return notification_handlers_[notification_type].get(); 119 return notification_handlers_[notification_type].get();
120 } 120 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698