| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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() | 49 NotificationUIManagerImpl::NotificationUIManagerImpl() |
| 50 : is_user_active_(true) { | 50 : is_user_active_(true) { |
| 51 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, | 51 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, |
| 52 content::NotificationService::AllSources()); | 52 content::NotificationService::AllSources()); |
| 53 #if defined(OS_MACOSX) | 53 #if defined(OS_MACOSX) |
| 54 InitFullScreenMonitor(); | |
| 55 InitIdleMonitor(); | 54 InitIdleMonitor(); |
| 56 #endif | 55 #endif |
| 57 } | 56 } |
| 58 | 57 |
| 59 NotificationUIManagerImpl::~NotificationUIManagerImpl() { | 58 NotificationUIManagerImpl::~NotificationUIManagerImpl() { |
| 60 STLDeleteElements(&show_queue_); | 59 STLDeleteElements(&show_queue_); |
| 61 #if defined(OS_MACOSX) | 60 #if defined(OS_MACOSX) |
| 62 StopIdleMonitor(); | 61 StopIdleMonitor(); |
| 63 StopFullScreenMonitor(); | |
| 64 #endif | 62 #endif |
| 65 } | 63 } |
| 66 | 64 |
| 67 void NotificationUIManagerImpl::Add(const Notification& notification, | 65 void NotificationUIManagerImpl::Add(const Notification& notification, |
| 68 Profile* profile) { | 66 Profile* profile) { |
| 69 if (TryReplacement(notification, profile)) { | 67 if (TryReplacement(notification, profile)) { |
| 70 return; | 68 return; |
| 71 } | 69 } |
| 72 | 70 |
| 73 VLOG(1) << "Added notification. URL: " | 71 VLOG(1) << "Added notification. URL: " |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 void NotificationUIManagerImpl::Observe( | 193 void NotificationUIManagerImpl::Observe( |
| 196 int type, | 194 int type, |
| 197 const content::NotificationSource& source, | 195 const content::NotificationSource& source, |
| 198 const content::NotificationDetails& details) { | 196 const content::NotificationDetails& details) { |
| 199 if (type == chrome::NOTIFICATION_APP_TERMINATING) { | 197 if (type == chrome::NOTIFICATION_APP_TERMINATING) { |
| 200 CancelAll(); | 198 CancelAll(); |
| 201 } else { | 199 } else { |
| 202 NOTREACHED(); | 200 NOTREACHED(); |
| 203 } | 201 } |
| 204 } | 202 } |
| OLD | NEW |