| 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()), | |
| 82 items_deleter_(&items_) { | 81 items_deleter_(&items_) { |
| 83 } | 82 } |
| 84 | 83 |
| 85 DownloadNotificationManagerForProfile:: | 84 DownloadNotificationManagerForProfile:: |
| 86 ~DownloadNotificationManagerForProfile() { | 85 ~DownloadNotificationManagerForProfile() { |
| 87 for (const auto& download : items_) { | 86 for (const auto& download : items_) { |
| 88 download.first->RemoveObserver(this); | 87 download.first->RemoveObserver(this); |
| 89 } | 88 } |
| 90 } | 89 } |
| 91 | 90 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 for (auto& item : items_) { | 146 for (auto& item : items_) { |
| 148 content::DownloadItem* download_item = item.first; | 147 content::DownloadItem* download_item = item.first; |
| 149 DownloadItemNotification* download_notification = item.second; | 148 DownloadItemNotification* download_notification = item.second; |
| 150 if (download_item->GetState() == content::DownloadItem::IN_PROGRESS) | 149 if (download_item->GetState() == content::DownloadItem::IN_PROGRESS) |
| 151 download_notification->DisablePopup(); | 150 download_notification->DisablePopup(); |
| 152 } | 151 } |
| 153 | 152 |
| 154 DownloadItemNotification* item = new DownloadItemNotification(download, this); | 153 DownloadItemNotification* item = new DownloadItemNotification(download, this); |
| 155 items_.insert(std::make_pair(download, item)); | 154 items_.insert(std::make_pair(download, item)); |
| 156 } | 155 } |
| 157 | |
| 158 void DownloadNotificationManagerForProfile::OverrideMessageCenterForTest( | |
| 159 message_center::MessageCenter* message_center) { | |
| 160 DCHECK(message_center); | |
| 161 message_center_ = message_center; | |
| 162 } | |
| OLD | NEW |