| 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/chromeos/extensions/file_browser_notifications.h" | 5 #include "chrome/browser/chromeos/extensions/file_browser_notifications.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 NotificationMessage(FileBrowserNotifications* host, | 129 NotificationMessage(FileBrowserNotifications* host, |
| 130 Profile* profile, | 130 Profile* profile, |
| 131 NotificationType type, | 131 NotificationType type, |
| 132 const std::string& notification_id, | 132 const std::string& notification_id, |
| 133 const string16& message) | 133 const string16& message) |
| 134 : profile_(profile), | 134 : profile_(profile), |
| 135 type_(type), | 135 type_(type), |
| 136 notification_id_(notification_id), | 136 notification_id_(notification_id), |
| 137 message_(message) { | 137 message_(message) { |
| 138 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 138 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 139 ash::switches::kAshNotifyDisabled)) { | 139 ash::switches::kAshNotify)) { |
| 140 const gfx::ImageSkia& icon = | 140 const gfx::ImageSkia& icon = |
| 141 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 141 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 142 IDR_FILES_APP_ICON); | 142 IDR_FILES_APP_ICON); |
| 143 notification_id_ = DesktopNotificationService::AddIconNotification( | 143 notification_id_ = DesktopNotificationService::AddIconNotification( |
| 144 GURL(), GetTitle(type_), message, icon, | 144 GURL(), GetTitle(type_), message, icon, |
| 145 new Delegate(host->AsWeakPtr(), notification_id_), profile_); | 145 new Delegate(host->AsWeakPtr(), notification_id_), profile_); |
| 146 } else { | 146 } else { |
| 147 system_notification_.reset( | 147 system_notification_.reset( |
| 148 new chromeos::SystemNotification(profile_, | 148 new chromeos::SystemNotification(profile_, |
| 149 notification_id_, | 149 notification_id_, |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 void FileBrowserNotifications::HideNotificationById(const std::string& id) { | 391 void FileBrowserNotifications::HideNotificationById(const std::string& id) { |
| 392 NotificationMap::iterator it = notification_map_.find(id); | 392 NotificationMap::iterator it = notification_map_.find(id); |
| 393 if (it != notification_map_.end()) { | 393 if (it != notification_map_.end()) { |
| 394 delete it->second; | 394 delete it->second; |
| 395 notification_map_.erase(it); | 395 notification_map_.erase(it); |
| 396 } else { | 396 } else { |
| 397 // Mark as hidden so it does not get shown from a delayed task. | 397 // Mark as hidden so it does not get shown from a delayed task. |
| 398 hidden_notifications_.insert(id); | 398 hidden_notifications_.insert(id); |
| 399 } | 399 } |
| 400 } | 400 } |
| OLD | NEW |