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

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

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix PrefNotifierImpl Created 8 years, 1 month 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/notification_ui_manager_impl.h" 5 #include "chrome/browser/notifications/notification_ui_manager_impl.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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 notifications->push_back(&(*queued_iter)->notification()); 226 notifications->push_back(&(*queued_iter)->notification());
227 } 227 }
228 } 228 }
229 229
230 void NotificationUIManagerImpl::Observe( 230 void NotificationUIManagerImpl::Observe(
231 int type, 231 int type,
232 const content::NotificationSource& source, 232 const content::NotificationSource& source,
233 const content::NotificationDetails& details) { 233 const content::NotificationDetails& details) {
234 if (type == chrome::NOTIFICATION_APP_TERMINATING) { 234 if (type == chrome::NOTIFICATION_APP_TERMINATING) {
235 CancelAll(); 235 CancelAll();
236 } else if (type == chrome::NOTIFICATION_PREF_CHANGED) {
237 std::string* name = content::Details<std::string>(details).ptr();
238 if (*name == prefs::kDesktopNotificationPosition)
239 balloon_collection_->SetPositionPreference(
240 static_cast<BalloonCollection::PositionPreference>(
241 position_pref_.GetValue()));
242 } else { 236 } else {
243 NOTREACHED(); 237 NOTREACHED();
244 } 238 }
245 } 239 }
240
241 void NotificationUIManagerImpl::OnPreferenceChanged(
242 PrefServiceBase* service,
243 const std::string& pref_name) {
244 if (pref_name == prefs::kDesktopNotificationPosition) {
245 balloon_collection_->SetPositionPreference(
246 static_cast<BalloonCollection::PositionPreference>(
247 position_pref_.GetValue()));
248 }
249 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698