| 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/message_center_notification_manager.h" | 5 #include "chrome/browser/notifications/message_center_notification_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/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "extensions/browser/info_map.h" | 26 #include "extensions/browser/info_map.h" |
| 27 #include "extensions/common/extension_set.h" | 27 #include "extensions/common/extension_set.h" |
| 28 #include "ui/gfx/image/image_skia.h" | 28 #include "ui/gfx/image/image_skia.h" |
| 29 #include "ui/message_center/message_center_style.h" | 29 #include "ui/message_center/message_center_style.h" |
| 30 #include "ui/message_center/message_center_tray.h" | 30 #include "ui/message_center/message_center_tray.h" |
| 31 #include "ui/message_center/message_center_types.h" | 31 #include "ui/message_center/message_center_types.h" |
| 32 #include "ui/message_center/notifier_settings.h" | 32 #include "ui/message_center/notifier_settings.h" |
| 33 | 33 |
| 34 #if defined(OS_CHROMEOS) | 34 #if defined(OS_CHROMEOS) |
| 35 #include "chrome/browser/notifications/login_state_notification_blocker_chromeos
.h" | 35 #include "chrome/browser/notifications/login_state_notification_blocker_chromeos
.h" |
| 36 #include "chrome/browser/notifications/multi_user_notification_blocker_chromeos.
h" | |
| 37 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 36 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 38 #endif | 37 #endif |
| 39 | 38 |
| 40 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
| 41 // The first-run balloon will be shown |kFirstRunIdleDelaySeconds| after all | 40 // The first-run balloon will be shown |kFirstRunIdleDelaySeconds| after all |
| 42 // popups go away and the user has notifications in the message center. | 41 // popups go away and the user has notifications in the message center. |
| 43 const int kFirstRunIdleDelaySeconds = 1; | 42 const int kFirstRunIdleDelaySeconds = 1; |
| 44 #endif | 43 #endif |
| 45 | 44 |
| 46 MessageCenterNotificationManager::MessageCenterNotificationManager( | 45 MessageCenterNotificationManager::MessageCenterNotificationManager( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 59 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
| 60 first_run_pref_.Init(prefs::kMessageCenterShowedFirstRunBalloon, local_state); | 59 first_run_pref_.Init(prefs::kMessageCenterShowedFirstRunBalloon, local_state); |
| 61 #endif | 60 #endif |
| 62 | 61 |
| 63 message_center_->AddObserver(this); | 62 message_center_->AddObserver(this); |
| 64 message_center_->SetNotifierSettingsProvider(settings_provider_.get()); | 63 message_center_->SetNotifierSettingsProvider(settings_provider_.get()); |
| 65 | 64 |
| 66 #if defined(OS_CHROMEOS) | 65 #if defined(OS_CHROMEOS) |
| 67 blockers_.push_back( | 66 blockers_.push_back( |
| 68 new LoginStateNotificationBlockerChromeOS(message_center)); | 67 new LoginStateNotificationBlockerChromeOS(message_center)); |
| 69 blockers_.push_back(new MultiUserNotificationBlockerChromeOS(message_center)); | |
| 70 #else | 68 #else |
| 71 blockers_.push_back(new ScreenLockNotificationBlocker(message_center)); | 69 blockers_.push_back(new ScreenLockNotificationBlocker(message_center)); |
| 72 #endif | 70 #endif |
| 73 blockers_.push_back(new FullscreenNotificationBlocker(message_center)); | 71 blockers_.push_back(new FullscreenNotificationBlocker(message_center)); |
| 74 | 72 |
| 75 #if defined(OS_WIN) || defined(OS_MACOSX) \ | 73 #if defined(OS_WIN) || defined(OS_MACOSX) \ |
| 76 || (defined(USE_AURA) && !defined(USE_ASH)) | 74 || (defined(USE_AURA) && !defined(USE_ASH)) |
| 77 // On Windows, Linux and Mac, the notification manager owns the tray icon and | 75 // On Windows, Linux and Mac, the notification manager owns the tray icon and |
| 78 // views.Other platforms have global ownership and Create will return NULL. | 76 // views.Other platforms have global ownership and Create will return NULL. |
| 79 tray_.reset(message_center::CreateMessageCenterTray()); | 77 tray_.reset(message_center::CreateMessageCenterTray()); |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 | 471 |
| 474 MessageCenterNotificationManager::ProfileNotification* | 472 MessageCenterNotificationManager::ProfileNotification* |
| 475 MessageCenterNotificationManager::FindProfileNotification( | 473 MessageCenterNotificationManager::FindProfileNotification( |
| 476 const std::string& id) const { | 474 const std::string& id) const { |
| 477 NotificationMap::const_iterator iter = profile_notifications_.find(id); | 475 NotificationMap::const_iterator iter = profile_notifications_.find(id); |
| 478 if (iter == profile_notifications_.end()) | 476 if (iter == profile_notifications_.end()) |
| 479 return NULL; | 477 return NULL; |
| 480 | 478 |
| 481 return (*iter).second; | 479 return (*iter).second; |
| 482 } | 480 } |
| OLD | NEW |