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

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

Issue 11958025: Start delegating notifications to MessageCenter on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added USE_ASH guard to test code as well Created 7 years, 11 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
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/balloon_notification_ui_manager.h" 5 #include "chrome/browser/notifications/balloon_notification_ui_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/stl_util.h" 9 #include "base/stl_util.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return false; 84 return false;
85 balloon_collection_->Add(notification, profile); 85 balloon_collection_->Add(notification, profile);
86 return true; 86 return true;
87 } 87 }
88 88
89 void BalloonNotificationUIManager::OnBalloonSpaceChanged() { 89 void BalloonNotificationUIManager::OnBalloonSpaceChanged() {
90 CheckAndShowNotifications(); 90 CheckAndShowNotifications();
91 } 91 }
92 92
93 bool BalloonNotificationUIManager::UpdateNotification( 93 bool BalloonNotificationUIManager::UpdateNotification(
94 const Notification& notification) { 94 const Notification& notification, Profile* profile) {
sky 2013/01/22 19:29:00 When you wrap each arg on its own line.
Dmitry Titov 2013/01/22 21:01:07 Done.
95 const GURL& origin = notification.origin_url(); 95 const GURL& origin = notification.origin_url();
96 const string16& replace_id = notification.replace_id(); 96 const string16& replace_id = notification.replace_id();
97 97
98 DCHECK(!replace_id.empty()); 98 DCHECK(!replace_id.empty());
99 99
100 const BalloonCollection::Balloons& balloons = 100 const BalloonCollection::Balloons& balloons =
101 balloon_collection_->GetActiveBalloons(); 101 balloon_collection_->GetActiveBalloons();
102 for (BalloonCollection::Balloons::const_iterator iter = balloons.begin(); 102 for (BalloonCollection::Balloons::const_iterator iter = balloons.begin();
103 iter != balloons.end(); ++iter) { 103 iter != balloons.end(); ++iter) {
104 if (origin == (*iter)->notification().origin_url() && 104 if (profile == (*iter)->profile() &&
105 origin == (*iter)->notification().origin_url() &&
105 replace_id == (*iter)->notification().replace_id()) { 106 replace_id == (*iter)->notification().replace_id()) {
106 (*iter)->Update(notification); 107 (*iter)->Update(notification);
107 return true; 108 return true;
108 } 109 }
109 } 110 }
110 111
111 return false; 112 return false;
112 } 113 }
113 114
114 BalloonCollection::PositionPreference 115 BalloonCollection::PositionPreference
(...skipping 23 matching lines...) Expand all
138 if (NotificationUIManager::DelegatesToMessageCenter()) { 139 if (NotificationUIManager::DelegatesToMessageCenter()) {
139 LOG(ERROR) << "Attempt to run a test that requires " 140 LOG(ERROR) << "Attempt to run a test that requires "
140 << "BalloonNotificationUIManager while delegating to a " 141 << "BalloonNotificationUIManager while delegating to a "
141 << "native MessageCenter. Test will fail. Ask dimich@"; 142 << "native MessageCenter. Test will fail. Ask dimich@";
142 return NULL; 143 return NULL;
143 } 144 }
144 return static_cast<BalloonNotificationUIManager*>( 145 return static_cast<BalloonNotificationUIManager*>(
145 g_browser_process->notification_ui_manager()); 146 g_browser_process->notification_ui_manager());
146 } 147 }
147 148
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698