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

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

Issue 1005393003: [Download Notification] Use NotificationUIManager instead of MessageCenter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use NotificationUIManager instead of message_center::MessageCenter Created 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/message_center_notification_manager.h" 5 #include "chrome/browser/notifications/message_center_notification_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/prefs/pref_registry_simple.h" 9 #include "base/prefs/pref_registry_simple.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 ProfileID profile_id) const { 194 ProfileID profile_id) const {
195 // The profile pointer can be weak, the instance may have been destroyed, so 195 // The profile pointer can be weak, the instance may have been destroyed, so
196 // no profile method should be called inside this function. 196 // no profile method should be called inside this function.
197 197
198 std::string profile_notification_id = 198 std::string profile_notification_id =
199 ProfileNotification::GetProfileNotificationId(delegate_id, profile_id); 199 ProfileNotification::GetProfileNotificationId(delegate_id, profile_id);
200 NotificationMap::const_iterator iter = 200 NotificationMap::const_iterator iter =
201 profile_notifications_.find(profile_notification_id); 201 profile_notifications_.find(profile_notification_id);
202 if (iter == profile_notifications_.end()) 202 if (iter == profile_notifications_.end())
203 return NULL; 203 return NULL;
204 return &(iter->second->notification()); 204
205 // Update |notification| with the latest information from the message center.
Jun Mukai 2015/03/31 19:59:47 This is weird. Is there some case where the state
yoshiki 2015/04/01 04:10:49 "shown_as_popup" and "read" flags are changed in t
Jun Mukai 2015/04/01 18:02:11 Commented on the other part. I believe FindById sh
yoshiki 2015/04/06 02:22:18 Thank you for the suggestion but we can't do it. F
206 ProfileNotification* profile_notification = iter->second;
207 profile_notification->CopyNotificationState(
208 message_center_->FindVisibleNotificationById(
209 iter->second->notification().id()));
210
211 return &(profile_notification->notification());
205 } 212 }
206 213
207 bool MessageCenterNotificationManager::CancelById( 214 bool MessageCenterNotificationManager::CancelById(
208 const std::string& delegate_id, 215 const std::string& delegate_id,
209 ProfileID profile_id) { 216 ProfileID profile_id) {
210 // The profile pointer can be weak, the instance may have been destroyed, so 217 // The profile pointer can be weak, the instance may have been destroyed, so
211 // no profile method should be called inside this function. 218 // no profile method should be called inside this function.
212 219
213 std::string profile_notification_id = 220 std::string profile_notification_id =
214 ProfileNotification::GetProfileNotificationId(delegate_id, profile_id); 221 ProfileNotification::GetProfileNotificationId(delegate_id, profile_id);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 it != registry->enabled_extensions().end(); 409 it != registry->enabled_extensions().end();
403 ++it) { 410 ++it) {
404 if ((*it->get()).permissions_data()->HasAPIPermission( 411 if ((*it->get()).permissions_data()->HasAPIPermission(
405 extensions::APIPermission::ID::kNotificationProvider)) { 412 extensions::APIPermission::ID::kNotificationProvider)) {
406 extension_id = (*it->get()).id(); 413 extension_id = (*it->get()).id();
407 return extension_id; 414 return extension_id;
408 } 415 }
409 } 416 }
410 return extension_id; 417 return extension_id;
411 } 418 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698