| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/download/download_item_model.h" | 10 #include "chrome/browser/download/download_item_model.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 /////////////////////////////////////////////////////////////////////////////// | 72 /////////////////////////////////////////////////////////////////////////////// |
| 73 // DownloadNotificationManagerForProfile implementation: | 73 // DownloadNotificationManagerForProfile implementation: |
| 74 /////////////////////////////////////////////////////////////////////////////// | 74 /////////////////////////////////////////////////////////////////////////////// |
| 75 | 75 |
| 76 DownloadNotificationManagerForProfile::DownloadNotificationManagerForProfile( | 76 DownloadNotificationManagerForProfile::DownloadNotificationManagerForProfile( |
| 77 Profile* profile, | 77 Profile* profile, |
| 78 DownloadNotificationManager* parent_manager) | 78 DownloadNotificationManager* parent_manager) |
| 79 : profile_(profile), | 79 : profile_(profile), |
| 80 parent_manager_(parent_manager), | 80 parent_manager_(parent_manager), |
| 81 message_center_(g_browser_process->message_center()), |
| 81 items_deleter_(&items_) { | 82 items_deleter_(&items_) { |
| 82 } | 83 } |
| 83 | 84 |
| 84 DownloadNotificationManagerForProfile:: | 85 DownloadNotificationManagerForProfile:: |
| 85 ~DownloadNotificationManagerForProfile() { | 86 ~DownloadNotificationManagerForProfile() { |
| 86 for (const auto& download : items_) { | 87 for (const auto& download : items_) { |
| 87 download.first->RemoveObserver(this); | 88 download.first->RemoveObserver(this); |
| 88 } | 89 } |
| 89 } | 90 } |
| 90 | 91 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 for (auto& item : items_) { | 147 for (auto& item : items_) { |
| 147 content::DownloadItem* download_item = item.first; | 148 content::DownloadItem* download_item = item.first; |
| 148 DownloadItemNotification* download_notification = item.second; | 149 DownloadItemNotification* download_notification = item.second; |
| 149 if (download_item->GetState() == content::DownloadItem::IN_PROGRESS) | 150 if (download_item->GetState() == content::DownloadItem::IN_PROGRESS) |
| 150 download_notification->DisablePopup(); | 151 download_notification->DisablePopup(); |
| 151 } | 152 } |
| 152 | 153 |
| 153 DownloadItemNotification* item = new DownloadItemNotification(download, this); | 154 DownloadItemNotification* item = new DownloadItemNotification(download, this); |
| 154 items_.insert(std::make_pair(download, item)); | 155 items_.insert(std::make_pair(download, item)); |
| 155 } | 156 } |
| 157 |
| 158 void DownloadNotificationManagerForProfile::OverrideMessageCenterForTest( |
| 159 message_center::MessageCenter* message_center) { |
| 160 DCHECK(message_center); |
| 161 message_center_ = message_center; |
| 162 } |
| OLD | NEW |