OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/download/download_manager.h" | 5 #include "content/browser/download/download_manager.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/i18n/case_conversion.h" | 12 #include "base/i18n/case_conversion.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
17 #include "base/sys_string_conversions.h" | 17 #include "base/sys_string_conversions.h" |
18 #include "base/task.h" | 18 #include "base/task.h" |
19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
20 #include "content/browser/browser_context.h" | 20 #include "content/browser/browser_context.h" |
21 #include "content/browser/browser_thread.h" | 21 #include "content/browser/browser_thread.h" |
22 #include "content/browser/content_browser_client.h" | |
23 #include "content/browser/download/download_create_info.h" | 22 #include "content/browser/download/download_create_info.h" |
24 #include "content/browser/download/download_file_manager.h" | 23 #include "content/browser/download/download_file_manager.h" |
25 #include "content/browser/download/download_item.h" | 24 #include "content/browser/download/download_item.h" |
26 #include "content/browser/download/download_manager_delegate.h" | 25 #include "content/browser/download/download_manager_delegate.h" |
27 #include "content/browser/download/download_persistent_store_info.h" | 26 #include "content/browser/download/download_persistent_store_info.h" |
28 #include "content/browser/download/download_stats.h" | 27 #include "content/browser/download/download_stats.h" |
29 #include "content/browser/download/download_status_updater.h" | 28 #include "content/browser/download/download_status_updater.h" |
30 #include "content/browser/download/interrupt_reasons.h" | 29 #include "content/browser/download/interrupt_reasons.h" |
31 #include "content/browser/renderer_host/render_process_host.h" | 30 #include "content/browser/renderer_host/render_process_host.h" |
32 #include "content/browser/renderer_host/render_view_host.h" | 31 #include "content/browser/renderer_host/render_view_host.h" |
33 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 32 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
34 #include "content/browser/tab_contents/tab_contents.h" | 33 #include "content/browser/tab_contents/tab_contents.h" |
35 #include "content/common/notification_service.h" | 34 #include "content/common/notification_service.h" |
| 35 #include "content/public/browser/content_browser_client.h" |
36 #include "content/public/browser/notification_types.h" | 36 #include "content/public/browser/notification_types.h" |
37 | 37 |
38 namespace { | 38 namespace { |
39 | 39 |
40 void BeginDownload( | 40 void BeginDownload( |
41 const GURL& url, | 41 const GURL& url, |
42 const GURL& referrer, | 42 const GURL& referrer, |
43 const DownloadSaveInfo& save_info, | 43 const DownloadSaveInfo& save_info, |
44 ResourceDispatcherHost* resource_dispatcher_host, | 44 ResourceDispatcherHost* resource_dispatcher_host, |
45 int render_process_id, | 45 int render_process_id, |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 void DownloadManager::MarkDownloadOpened(DownloadItem* download) { | 1083 void DownloadManager::MarkDownloadOpened(DownloadItem* download) { |
1084 delegate_->UpdateItemInPersistentStore(download); | 1084 delegate_->UpdateItemInPersistentStore(download); |
1085 int num_unopened = 0; | 1085 int num_unopened = 0; |
1086 for (DownloadMap::iterator it = history_downloads_.begin(); | 1086 for (DownloadMap::iterator it = history_downloads_.begin(); |
1087 it != history_downloads_.end(); ++it) { | 1087 it != history_downloads_.end(); ++it) { |
1088 if (it->second->IsComplete() && !it->second->opened()) | 1088 if (it->second->IsComplete() && !it->second->opened()) |
1089 ++num_unopened; | 1089 ++num_unopened; |
1090 } | 1090 } |
1091 download_stats::RecordOpensOutstanding(num_unopened); | 1091 download_stats::RecordOpensOutstanding(num_unopened); |
1092 } | 1092 } |
OLD | NEW |