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

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

Issue 7053041: Add a Create method to DesktopNotificationHandler and stubs for the notification objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 6 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/notification_ui_manager.h" 5 #include "chrome/browser/notifications/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-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 NotificationUIManager::~NotificationUIManager() { 61 NotificationUIManager::~NotificationUIManager() {
62 STLDeleteElements(&show_queue_); 62 STLDeleteElements(&show_queue_);
63 #if defined(OS_MACOSX) 63 #if defined(OS_MACOSX)
64 StopFullScreenMonitor(); 64 StopFullScreenMonitor();
65 #endif 65 #endif
66 } 66 }
67 67
68 // static 68 // static
69 NotificationUIManager* NotificationUIManager::Create(PrefService* local_state) { 69 NotificationUIManager* NotificationUIManager::Create(PrefService* local_state) {
70 BalloonCollection* balloons = BalloonCollection::Create(); 70 return Create(local_state, BalloonCollection::Create());
71 }
72
73 // static
74 NotificationUIManager* NotificationUIManager::Create(
75 PrefService* local_state,
76 BalloonCollection* balloons) {
71 NotificationUIManager* instance = new NotificationUIManager(local_state); 77 NotificationUIManager* instance = new NotificationUIManager(local_state);
72 instance->Initialize(balloons); 78 instance->Initialize(balloons);
73 balloons->set_space_change_listener(instance); 79 balloons->set_space_change_listener(instance);
74 return instance; 80 return instance;
75 } 81 }
76 82
77 // static 83 // static
78 void NotificationUIManager::RegisterPrefs(PrefService* prefs) { 84 void NotificationUIManager::RegisterPrefs(PrefService* prefs) {
79 prefs->RegisterIntegerPref(prefs::kDesktopNotificationPosition, 85 prefs->RegisterIntegerPref(prefs::kDesktopNotificationPosition,
80 BalloonCollection::DEFAULT_POSITION); 86 BalloonCollection::DEFAULT_POSITION);
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 } else if (type == NotificationType::PREF_CHANGED) { 240 } else if (type == NotificationType::PREF_CHANGED) {
235 std::string* name = Details<std::string>(details).ptr(); 241 std::string* name = Details<std::string>(details).ptr();
236 if (*name == prefs::kDesktopNotificationPosition) 242 if (*name == prefs::kDesktopNotificationPosition)
237 balloon_collection_->SetPositionPreference( 243 balloon_collection_->SetPositionPreference(
238 static_cast<BalloonCollection::PositionPreference>( 244 static_cast<BalloonCollection::PositionPreference>(
239 position_pref_.GetValue())); 245 position_pref_.GetValue()));
240 } else { 246 } else {
241 NOTREACHED(); 247 NOTREACHED();
242 } 248 }
243 } 249 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698