Index: chrome/browser/download/notification/download_notification_manager.cc |
diff --git a/chrome/browser/download/notification/download_notification_manager.cc b/chrome/browser/download/notification/download_notification_manager.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2ddfc25d3459a921a760d30c12fb51a505cbe124 |
--- /dev/null |
+++ b/chrome/browser/download/notification/download_notification_manager.cc |
@@ -0,0 +1,53 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/download/notification/download_notification_manager.h" |
+ |
+#include "base/strings/string_number_conversions.h" |
+#include "chrome/browser/download/download_item_model.h" |
+#include "chrome/browser/download/notification/download_notification_item.h" |
+#include "chrome/grit/chromium_strings.h" |
+#include "content/public/browser/download_item.h" |
+#include "grit/theme_resources.h" |
+#include "ui/base/l10n/l10n_util.h" |
+#include "ui/base/resource/resource_bundle.h" |
+#include "ui/message_center/message_center.h" |
+#include "ui/message_center/notification.h" |
+#include "ui/message_center/notification_delegate.h" |
+ |
+using message_center::Notification; |
+ |
+DownloadNotificationManager::DownloadNotificationManager(Profile* profile) |
+ : profile_(profile) { |
+} |
+ |
+DownloadNotificationManager::~DownloadNotificationManager() { |
+} |
+ |
+void DownloadNotificationManager::OnDownloadStarted( |
+ DownloadNotificationItem* item) { |
+ downloading_items_.insert(item); |
+} |
+ |
+void DownloadNotificationManager::OnDownloadStopped( |
+ DownloadNotificationItem* item) { |
+ downloading_items_.erase(item); |
+} |
+ |
+void DownloadNotificationManager::OnDownloadRemoved( |
+ DownloadNotificationItem* item) { |
+ std::set<scoped_refptr<DownloadNotificationItem>>::iterator it = |
+ items_.find(item); |
+ CHECK(it != items_.end()); |
+ |
+ downloading_items_.erase(item); |
+ items_.erase(*it); |
+} |
+ |
+void DownloadNotificationManager::OnNewDownloadReady( |
+ content::DownloadItem* download) { |
+ scoped_refptr<DownloadNotificationItem> item( |
+ new DownloadNotificationItem(download, profile_, this)); |
+ items_.insert(item); |
+} |