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

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

Issue 10968064: Move the NOTIFICATION_APP_TERMINATING notification from content to chrome, since it's fired by chro… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: cros compile Created 8 years, 2 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/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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 // Non owned pointer to the user's profile. 43 // Non owned pointer to the user's profile.
44 Profile* profile_; 44 Profile* profile_;
45 45
46 DISALLOW_COPY_AND_ASSIGN(QueuedNotification); 46 DISALLOW_COPY_AND_ASSIGN(QueuedNotification);
47 }; 47 };
48 48
49 NotificationUIManagerImpl::NotificationUIManagerImpl(PrefService* local_state) 49 NotificationUIManagerImpl::NotificationUIManagerImpl(PrefService* local_state)
50 : balloon_collection_(NULL), 50 : balloon_collection_(NULL),
51 is_user_active_(true) { 51 is_user_active_(true) {
52 registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, 52 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING,
53 content::NotificationService::AllSources()); 53 content::NotificationService::AllSources());
54 position_pref_.Init(prefs::kDesktopNotificationPosition, local_state, this); 54 position_pref_.Init(prefs::kDesktopNotificationPosition, local_state, this);
55 #if defined(OS_MACOSX) 55 #if defined(OS_MACOSX)
56 InitFullScreenMonitor(); 56 InitFullScreenMonitor();
57 #endif 57 #endif
58 } 58 }
59 59
60 NotificationUIManagerImpl::~NotificationUIManagerImpl() { 60 NotificationUIManagerImpl::~NotificationUIManagerImpl() {
61 STLDeleteElements(&show_queue_); 61 STLDeleteElements(&show_queue_);
62 #if defined(OS_MACOSX) 62 #if defined(OS_MACOSX)
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 for (queued_iter = show_queue_.begin(); queued_iter != show_queue_.end(); 224 for (queued_iter = show_queue_.begin(); queued_iter != show_queue_.end();
225 ++queued_iter) { 225 ++queued_iter) {
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 == content::NOTIFICATION_APP_TERMINATING) { 234 if (type == chrome::NOTIFICATION_APP_TERMINATING) {
235 CancelAll(); 235 CancelAll();
236 } else if (type == chrome::NOTIFICATION_PREF_CHANGED) { 236 } else if (type == chrome::NOTIFICATION_PREF_CHANGED) {
237 std::string* name = content::Details<std::string>(details).ptr(); 237 std::string* name = content::Details<std::string>(details).ptr();
238 if (*name == prefs::kDesktopNotificationPosition) 238 if (*name == prefs::kDesktopNotificationPosition)
239 balloon_collection_->SetPositionPreference( 239 balloon_collection_->SetPositionPreference(
240 static_cast<BalloonCollection::PositionPreference>( 240 static_cast<BalloonCollection::PositionPreference>(
241 position_pref_.GetValue())); 241 position_pref_.GetValue()));
242 } else { 242 } else {
243 NOTREACHED(); 243 NOTREACHED();
244 } 244 }
245 } 245 }
OLDNEW
« no previous file with comments | « chrome/browser/lifetime/application_lifetime.cc ('k') | chrome/browser/prerender/prerender_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698