| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/download/notification/download_notification_manager.h" | 5 #include "chrome/browser/download/notification/download_notification_manager.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "chrome/browser/download/download_item_model.h" | 8 #include "chrome/browser/download/download_item_model.h" |
| 9 #include "chrome/browser/download/notification/download_notification_item.h" | 9 #include "chrome/browser/download/notification/download_notification_item.h" |
| 10 #include "chrome/grit/chromium_strings.h" | 10 #include "chrome/grit/chromium_strings.h" |
| 11 #include "content/public/browser/download_item.h" | 11 #include "content/public/browser/download_item.h" |
| 12 #include "grit/theme_resources.h" | 12 #include "grit/theme_resources.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
| 15 #include "ui/message_center/message_center.h" | 15 #include "ui/message_center/message_center.h" |
| 16 #include "ui/message_center/notification.h" | 16 #include "ui/message_center/notification.h" |
| 17 #include "ui/message_center/notification_delegate.h" | 17 #include "ui/message_center/notification_delegate.h" |
| 18 | 18 |
| 19 using message_center::Notification; | |
| 20 | |
| 21 DownloadNotificationManager::DownloadNotificationManager(Profile* profile) | 19 DownloadNotificationManager::DownloadNotificationManager(Profile* profile) |
| 22 : items_deleter_(&items_) { | 20 : profile_(profile), items_deleter_(&items_) { |
| 23 } | 21 } |
| 24 | 22 |
| 25 DownloadNotificationManager::~DownloadNotificationManager() { | 23 DownloadNotificationManager::~DownloadNotificationManager() { |
| 26 } | 24 } |
| 27 | 25 |
| 28 void DownloadNotificationManager::OnDownloadStarted( | 26 void DownloadNotificationManager::OnDownloadStarted( |
| 29 DownloadNotificationItem* item) { | 27 DownloadNotificationItem* item) { |
| 30 downloading_items_.insert(item); | 28 downloading_items_.insert(item); |
| 31 } | 29 } |
| 32 | 30 |
| 33 void DownloadNotificationManager::OnDownloadStopped( | 31 void DownloadNotificationManager::OnDownloadStopped( |
| 34 DownloadNotificationItem* item) { | 32 DownloadNotificationItem* item) { |
| 35 downloading_items_.erase(item); | 33 downloading_items_.erase(item); |
| 36 } | 34 } |
| 37 | 35 |
| 38 void DownloadNotificationManager::OnDownloadRemoved( | 36 void DownloadNotificationManager::OnDownloadRemoved( |
| 39 DownloadNotificationItem* item) { | 37 DownloadNotificationItem* item) { |
| 40 downloading_items_.erase(item); | 38 downloading_items_.erase(item); |
| 41 items_.erase(item); | 39 items_.erase(item); |
| 42 } | 40 } |
| 43 | 41 |
| 44 void DownloadNotificationManager::OnNewDownloadReady( | 42 void DownloadNotificationManager::OnNewDownloadReady( |
| 45 content::DownloadItem* download) { | 43 content::DownloadItem* download) { |
| 46 DownloadNotificationItem* item = new DownloadNotificationItem(download, this); | 44 DownloadNotificationItem* item = |
| 45 new DownloadNotificationItem(download, profile_, this); |
| 47 items_.insert(item); | 46 items_.insert(item); |
| 48 } | 47 } |
| OLD | NEW |