Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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, content::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_CHROMEOS) |
| 56 // Option menu for changing desktop notification position on ChromeOS is | |
| 57 // disabled. Force preference to default. | |
| 58 local_state->SetInteger(prefs::kDesktopNotificationPosition, | |
| 59 BalloonCollection::DEFAULT_POSITION); | |
|
sky
2012/05/08 17:49:05
Should this be in notification_prefs_manager.cc ?
| |
| 60 #elif defined(OS_MACOSX) | |
|
stevenjb
2012/05/08 16:57:44
nit: These should be two separate #if clauses, sin
| |
| 56 InitFullScreenMonitor(); | 61 InitFullScreenMonitor(); |
| 57 #endif | 62 #endif |
| 58 } | 63 } |
| 59 | 64 |
| 60 NotificationUIManagerImpl::~NotificationUIManagerImpl() { | 65 NotificationUIManagerImpl::~NotificationUIManagerImpl() { |
| 61 STLDeleteElements(&show_queue_); | 66 STLDeleteElements(&show_queue_); |
| 62 #if defined(OS_MACOSX) | 67 #if defined(OS_MACOSX) |
| 63 StopFullScreenMonitor(); | 68 StopFullScreenMonitor(); |
| 64 #endif | 69 #endif |
| 65 } | 70 } |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 } else if (type == chrome::NOTIFICATION_PREF_CHANGED) { | 241 } else if (type == chrome::NOTIFICATION_PREF_CHANGED) { |
| 237 std::string* name = content::Details<std::string>(details).ptr(); | 242 std::string* name = content::Details<std::string>(details).ptr(); |
| 238 if (*name == prefs::kDesktopNotificationPosition) | 243 if (*name == prefs::kDesktopNotificationPosition) |
| 239 balloon_collection_->SetPositionPreference( | 244 balloon_collection_->SetPositionPreference( |
| 240 static_cast<BalloonCollection::PositionPreference>( | 245 static_cast<BalloonCollection::PositionPreference>( |
| 241 position_pref_.GetValue())); | 246 position_pref_.GetValue())); |
| 242 } else { | 247 } else { |
| 243 NOTREACHED(); | 248 NOTREACHED(); |
| 244 } | 249 } |
| 245 } | 250 } |
| OLD | NEW |