OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. | 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. |
6 | 6 |
7 #include "chrome/browser/download/download_shelf.h" | 7 #include "chrome/browser/download/download_shelf.h" |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
16 #include "base/threading/thread_task_runner_handle.h" | 16 #include "base/threading/thread_task_runner_handle.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "cc/paint/paint_flags.h" | 18 #include "cc/paint/paint_flags.h" |
| 19 #include "chrome/browser/download/download_core_service.h" |
| 20 #include "chrome/browser/download/download_core_service_factory.h" |
19 #include "chrome/browser/download/download_item_model.h" | 21 #include "chrome/browser/download/download_item_model.h" |
20 #include "chrome/browser/download/download_service.h" | |
21 #include "chrome/browser/download/download_service_factory.h" | |
22 #include "chrome/browser/download/download_started_animation.h" | 22 #include "chrome/browser/download/download_started_animation.h" |
23 #include "chrome/browser/platform_util.h" | 23 #include "chrome/browser/platform_util.h" |
24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/browser/themes/theme_properties.h" | 25 #include "chrome/browser/themes/theme_properties.h" |
26 #include "chrome/browser/ui/browser.h" | 26 #include "chrome/browser/ui/browser.h" |
27 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 27 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
28 #include "content/public/browser/browser_context.h" | 28 #include "content/public/browser/browser_context.h" |
29 #include "content/public/browser/download_item.h" | 29 #include "content/public/browser/download_item.h" |
30 #include "content/public/browser/download_manager.h" | 30 #include "content/public/browser/download_manager.h" |
31 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 } | 190 } |
191 | 191 |
192 content::DownloadManager* DownloadShelf::GetDownloadManager() { | 192 content::DownloadManager* DownloadShelf::GetDownloadManager() { |
193 return content::BrowserContext::GetDownloadManager(browser()->profile()); | 193 return content::BrowserContext::GetDownloadManager(browser()->profile()); |
194 } | 194 } |
195 | 195 |
196 void DownloadShelf::ShowDownload(DownloadItem* download) { | 196 void DownloadShelf::ShowDownload(DownloadItem* download) { |
197 if (download->GetState() == DownloadItem::COMPLETE && | 197 if (download->GetState() == DownloadItem::COMPLETE && |
198 DownloadItemModel(download).ShouldRemoveFromShelfWhenComplete()) | 198 DownloadItemModel(download).ShouldRemoveFromShelfWhenComplete()) |
199 return; | 199 return; |
200 if (!DownloadServiceFactory::GetForBrowserContext( | 200 if (!DownloadCoreServiceFactory::GetForBrowserContext( |
201 download->GetBrowserContext())->IsShelfEnabled()) | 201 download->GetBrowserContext()) |
| 202 ->IsShelfEnabled()) |
202 return; | 203 return; |
203 | 204 |
204 if (is_hidden_) | 205 if (is_hidden_) |
205 Unhide(); | 206 Unhide(); |
206 Open(); | 207 Open(); |
207 DoAddDownload(download); | 208 DoAddDownload(download); |
208 | 209 |
209 // browser() can be NULL for tests. | 210 // browser() can be NULL for tests. |
210 if (!browser()) | 211 if (!browser()) |
211 return; | 212 return; |
(...skipping 18 matching lines...) Expand all Loading... |
230 content::DownloadManager* download_manager = GetDownloadManager(); | 231 content::DownloadManager* download_manager = GetDownloadManager(); |
231 if (!download_manager) | 232 if (!download_manager) |
232 return; | 233 return; |
233 | 234 |
234 DownloadItem* download = download_manager->GetDownload(download_id); | 235 DownloadItem* download = download_manager->GetDownload(download_id); |
235 if (!download) | 236 if (!download) |
236 return; | 237 return; |
237 | 238 |
238 ShowDownload(download); | 239 ShowDownload(download); |
239 } | 240 } |
OLD | NEW |