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: ui/message_center/message_center_impl.cc

Issue 14127003: Fixes a crash caused for update of webkit notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ui/message_center/message_center_impl.h" 5 #include "ui/message_center/message_center_impl.h"
6 6
7 #include "base/observer_list.h" 7 #include "base/observer_list.h"
8 #include "ui/message_center/message_center_observer.h" 8 #include "ui/message_center/message_center_observer.h"
9 #include "ui/message_center/notification.h" 9 #include "ui/message_center/notification.h"
10 #include "ui/message_center/notification_list.h" 10 #include "ui/message_center/notification_list.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 100
101 void MessageCenterImpl::UpdateNotification( 101 void MessageCenterImpl::UpdateNotification(
102 const std::string& old_id, 102 const std::string& old_id,
103 const std::string& new_id, 103 const std::string& new_id,
104 const string16& title, 104 const string16& title,
105 const string16& message, 105 const string16& message,
106 const base::DictionaryValue* optional_fields) { 106 const base::DictionaryValue* optional_fields) {
107 notification_list_->UpdateNotificationMessage( 107 notification_list_->UpdateNotificationMessage(
108 old_id, new_id, title, message, optional_fields); 108 old_id, new_id, title, message, optional_fields);
109 FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_, 109 if (old_id == new_id) {
110 OnNotificationUpdated(new_id)); 110 FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_,
111 OnNotificationUpdated(new_id));
112 } else {
113 FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_,
114 OnNotificationRemoved(old_id, false));
115 FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_,
116 OnNotificationAdded(new_id));
117 }
111 } 118 }
112 119
113 void MessageCenterImpl::RemoveNotification(const std::string& id, 120 void MessageCenterImpl::RemoveNotification(const std::string& id,
114 bool by_user) { 121 bool by_user) {
115 // In many cases |id| is a reference to an existing notification instance 122 // In many cases |id| is a reference to an existing notification instance
116 // but the instance can be destructed in RemoveNotification(). Hence 123 // but the instance can be destructed in RemoveNotification(). Hence
117 // copies the id explicitly here. 124 // copies the id explicitly here.
118 std::string copied_id(id); 125 std::string copied_id(id);
119 notification_list_->RemoveNotification(copied_id); 126 notification_list_->RemoveNotification(copied_id);
120 FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_, 127 FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 void MessageCenterImpl::SetQuietMode(bool in_quiet_mode) { 242 void MessageCenterImpl::SetQuietMode(bool in_quiet_mode) {
236 notification_list_->SetQuietMode(in_quiet_mode); 243 notification_list_->SetQuietMode(in_quiet_mode);
237 } 244 }
238 245
239 void MessageCenterImpl::EnterQuietModeWithExpire( 246 void MessageCenterImpl::EnterQuietModeWithExpire(
240 const base::TimeDelta& expires_in) { 247 const base::TimeDelta& expires_in) {
241 notification_list_->EnterQuietModeWithExpire(expires_in); 248 notification_list_->EnterQuietModeWithExpire(expires_in);
242 } 249 }
243 250
244 } // namespace message_center 251 } // namespace message_center
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698