| Index: chrome/browser/chromeos/extensions/file_browser_notifications.cc
|
| diff --git a/chrome/browser/chromeos/extensions/file_browser_notifications.cc b/chrome/browser/chromeos/extensions/file_browser_notifications.cc
|
| index 6122ec1545c34bf3755d9e744539869e005999c6..c88de5a8f72726bc3bfdab429fd635a938f0deac 100644
|
| --- a/chrome/browser/chromeos/extensions/file_browser_notifications.cc
|
| +++ b/chrome/browser/chromeos/extensions/file_browser_notifications.cc
|
| @@ -107,7 +107,7 @@ class FileBrowserNotifications::NotificationMessage {
|
| virtual void Error() OVERRIDE {}
|
| virtual void Close(bool by_user) OVERRIDE {
|
| if (host_)
|
| - host_->HideNotificationById(id_);
|
| + host_->RemoveNotificationById(id_);
|
| }
|
| virtual void Click() OVERRIDE {
|
| // TODO(tbarzic): Show more info page once we have one.
|
| @@ -140,8 +140,9 @@ class FileBrowserNotifications::NotificationMessage {
|
| const gfx::ImageSkia& icon =
|
| *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
|
| IDR_FILES_APP_ICON);
|
| + string16 replace_id = UTF8ToUTF16(notification_id_);
|
| notification_id_ = DesktopNotificationService::AddIconNotification(
|
| - GURL(), GetTitle(type_), message, icon,
|
| + GURL(), GetTitle(type_), message, icon, replace_id,
|
| new Delegate(host->AsWeakPtr(), notification_id_), profile_);
|
| } else {
|
| system_notification_.reset(
|
| @@ -388,13 +389,31 @@ void FileBrowserNotifications::ShowNotificationById(
|
| notification->Show();
|
| }
|
|
|
| -void FileBrowserNotifications::HideNotificationById(const std::string& id) {
|
| - NotificationMap::iterator it = notification_map_.find(id);
|
| +void FileBrowserNotifications::HideNotificationById(
|
| + const std::string& notification_id) {
|
| + NotificationMap::iterator it = notification_map_.find(notification_id);
|
| if (it != notification_map_.end()) {
|
| - delete it->second;
|
| - notification_map_.erase(it);
|
| + if (!CommandLine::ForCurrentProcess()->HasSwitch(
|
| + ash::switches::kAshNotifyDisabled)) {
|
| + // Will trigger Delegate::Close which will call RemoveNotificationById.
|
| + DesktopNotificationService::RemoveNotification(notification_id);
|
| + } else {
|
| + NotificationMessage* notification = it->second;
|
| + notification_map_.erase(it);
|
| + delete notification;
|
| + }
|
| } else {
|
| // Mark as hidden so it does not get shown from a delayed task.
|
| - hidden_notifications_.insert(id);
|
| + hidden_notifications_.insert(notification_id);
|
| + }
|
| +}
|
| +
|
| +void FileBrowserNotifications::RemoveNotificationById(
|
| + const std::string& notification_id) {
|
| + NotificationMap::iterator it = notification_map_.find(notification_id);
|
| + if (it != notification_map_.end()) {
|
| + NotificationMessage* notification = it->second;
|
| + notification_map_.erase(it);
|
| + delete notification;
|
| }
|
| }
|
|
|