OLD | NEW |
---|---|
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 Loading... | |
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, BalloonCollection* balloons) { | |
John Gregg
2011/06/06 17:12:27
nit: i think the style preference here is one per
Satish
2011/06/06 20:36:43
Done.
| |
71 NotificationUIManager* instance = new NotificationUIManager(local_state); | 76 NotificationUIManager* instance = new NotificationUIManager(local_state); |
72 instance->Initialize(balloons); | 77 instance->Initialize(balloons); |
73 balloons->set_space_change_listener(instance); | 78 balloons->set_space_change_listener(instance); |
74 return instance; | 79 return instance; |
75 } | 80 } |
76 | 81 |
77 // static | 82 // static |
78 void NotificationUIManager::RegisterPrefs(PrefService* prefs) { | 83 void NotificationUIManager::RegisterPrefs(PrefService* prefs) { |
79 prefs->RegisterIntegerPref(prefs::kDesktopNotificationPosition, | 84 prefs->RegisterIntegerPref(prefs::kDesktopNotificationPosition, |
80 BalloonCollection::DEFAULT_POSITION); | 85 BalloonCollection::DEFAULT_POSITION); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 } else if (type == NotificationType::PREF_CHANGED) { | 239 } else if (type == NotificationType::PREF_CHANGED) { |
235 std::string* name = Details<std::string>(details).ptr(); | 240 std::string* name = Details<std::string>(details).ptr(); |
236 if (*name == prefs::kDesktopNotificationPosition) | 241 if (*name == prefs::kDesktopNotificationPosition) |
237 balloon_collection_->SetPositionPreference( | 242 balloon_collection_->SetPositionPreference( |
238 static_cast<BalloonCollection::PositionPreference>( | 243 static_cast<BalloonCollection::PositionPreference>( |
239 position_pref_.GetValue())); | 244 position_pref_.GetValue())); |
240 } else { | 245 } else { |
241 NOTREACHED(); | 246 NOTREACHED(); |
242 } | 247 } |
243 } | 248 } |
OLD | NEW |