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

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

Issue 20136004: Allow partial update for notification update API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix trybots Created 7 years, 5 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/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 26 matching lines...) Expand all
37 DCHECK(!balloon_collection_.get() || 37 DCHECK(!balloon_collection_.get() ||
38 balloon_collection_->GetActiveBalloons().size() == 0); 38 balloon_collection_->GetActiveBalloons().size() == 0);
39 DCHECK(balloon_collection); 39 DCHECK(balloon_collection);
40 balloon_collection_.reset(balloon_collection); 40 balloon_collection_.reset(balloon_collection);
41 balloon_collection_->SetPositionPreference( 41 balloon_collection_->SetPositionPreference(
42 static_cast<BalloonCollection::PositionPreference>( 42 static_cast<BalloonCollection::PositionPreference>(
43 position_pref_.GetValue())); 43 position_pref_.GetValue()));
44 balloon_collection_->set_space_change_listener(this); 44 balloon_collection_->set_space_change_listener(this);
45 } 45 }
46 46
47 bool BalloonNotificationUIManager::DoesIdExist(const std::string& id) { 47 bool BalloonNotificationUIManager::DoesIdExist(
48 if (NotificationUIManagerImpl::DoesIdExist(id)) 48 const std::string& id, Notification* matched_notification) {
49 if (NotificationUIManagerImpl::DoesIdExist(id, matched_notification))
49 return true; 50 return true;
50 return balloon_collection_->DoesIdExist(id); 51 return balloon_collection_->DoesIdExist(id, matched_notification);
51 } 52 }
52 53
53 bool BalloonNotificationUIManager::CancelById(const std::string& id) { 54 bool BalloonNotificationUIManager::CancelById(const std::string& id) {
54 // See if this ID hasn't been shown yet. 55 // See if this ID hasn't been shown yet.
55 if (NotificationUIManagerImpl::CancelById(id)) 56 if (NotificationUIManagerImpl::CancelById(id))
56 return true; 57 return true;
57 // If it has been shown, remove it from the balloon collections. 58 // If it has been shown, remove it from the balloon collections.
58 return balloon_collection_->RemoveById(id); 59 return balloon_collection_->RemoveById(id);
59 } 60 }
60 61
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 BalloonNotificationUIManager::GetInstanceForTesting() { 167 BalloonNotificationUIManager::GetInstanceForTesting() {
167 if (NotificationUIManager::DelegatesToMessageCenter()) { 168 if (NotificationUIManager::DelegatesToMessageCenter()) {
168 LOG(ERROR) << "Attempt to run a test that requires " 169 LOG(ERROR) << "Attempt to run a test that requires "
169 << "BalloonNotificationUIManager while delegating to a " 170 << "BalloonNotificationUIManager while delegating to a "
170 << "native MessageCenter. Test will fail. Ask dimich@"; 171 << "native MessageCenter. Test will fail. Ask dimich@";
171 return NULL; 172 return NULL;
172 } 173 }
173 return static_cast<BalloonNotificationUIManager*>( 174 return static_cast<BalloonNotificationUIManager*>(
174 g_browser_process->notification_ui_manager()); 175 g_browser_process->notification_ui_manager());
175 } 176 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698