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 #include "chrome/browser/extensions/api/downloads/downloads_api.h" | 5 #include "chrome/browser/extensions/api/downloads/downloads_api.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cctype> | 8 #include <cctype> |
9 #include <iterator> | 9 #include <iterator> |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/bind_helpers.h" | 15 #include "base/bind_helpers.h" |
16 #include "base/callback.h" | 16 #include "base/callback.h" |
17 #include "base/file_util.h" | 17 #include "base/file_util.h" |
18 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
19 #include "base/json/json_writer.h" | 19 #include "base/json/json_writer.h" |
20 #include "base/lazy_instance.h" | 20 #include "base/lazy_instance.h" |
21 #include "base/logging.h" | 21 #include "base/logging.h" |
22 #include "base/memory/weak_ptr.h" | 22 #include "base/memory/weak_ptr.h" |
23 #include "base/metrics/histogram.h" | 23 #include "base/metrics/histogram.h" |
24 #include "base/stl_util.h" | 24 #include "base/stl_util.h" |
25 #include "base/strings/string16.h" | 25 #include "base/strings/string16.h" |
26 #include "base/strings/string_split.h" | 26 #include "base/strings/string_split.h" |
27 #include "base/strings/string_util.h" | 27 #include "base/strings/string_util.h" |
28 #include "base/strings/stringprintf.h" | 28 #include "base/strings/stringprintf.h" |
| 29 #include "base/task/cancelable_task_tracker.h" |
29 #include "base/values.h" | 30 #include "base/values.h" |
30 #include "chrome/browser/browser_process.h" | 31 #include "chrome/browser/browser_process.h" |
31 #include "chrome/browser/chrome_notification_types.h" | 32 #include "chrome/browser/chrome_notification_types.h" |
32 #include "chrome/browser/download/download_danger_prompt.h" | 33 #include "chrome/browser/download/download_danger_prompt.h" |
33 #include "chrome/browser/download/download_file_icon_extractor.h" | 34 #include "chrome/browser/download/download_file_icon_extractor.h" |
34 #include "chrome/browser/download/download_prefs.h" | 35 #include "chrome/browser/download/download_prefs.h" |
35 #include "chrome/browser/download/download_query.h" | 36 #include "chrome/browser/download/download_query.h" |
36 #include "chrome/browser/download/download_service.h" | 37 #include "chrome/browser/download/download_service.h" |
37 #include "chrome/browser/download/download_service_factory.h" | 38 #include "chrome/browser/download/download_service_factory.h" |
38 #include "chrome/browser/download/download_shelf.h" | 39 #include "chrome/browser/download/download_shelf.h" |
39 #include "chrome/browser/download/download_stats.h" | 40 #include "chrome/browser/download/download_stats.h" |
40 #include "chrome/browser/download/drag_download_item.h" | 41 #include "chrome/browser/download/drag_download_item.h" |
41 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 42 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
42 #include "chrome/browser/extensions/extension_service.h" | 43 #include "chrome/browser/extensions/extension_service.h" |
43 #include "chrome/browser/extensions/extension_warning_service.h" | 44 #include "chrome/browser/extensions/extension_warning_service.h" |
44 #include "chrome/browser/extensions/extension_warning_set.h" | 45 #include "chrome/browser/extensions/extension_warning_set.h" |
45 #include "chrome/browser/icon_loader.h" | 46 #include "chrome/browser/icon_loader.h" |
46 #include "chrome/browser/icon_manager.h" | 47 #include "chrome/browser/icon_manager.h" |
47 #include "chrome/browser/platform_util.h" | 48 #include "chrome/browser/platform_util.h" |
48 #include "chrome/browser/profiles/profile.h" | 49 #include "chrome/browser/profiles/profile.h" |
49 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" | 50 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
50 #include "chrome/browser/ui/browser.h" | 51 #include "chrome/browser/ui/browser.h" |
51 #include "chrome/browser/ui/browser_list.h" | 52 #include "chrome/browser/ui/browser_list.h" |
52 #include "chrome/browser/ui/browser_window.h" | 53 #include "chrome/browser/ui/browser_window.h" |
53 #include "chrome/common/cancelable_task_tracker.h" | |
54 #include "chrome/common/extensions/api/downloads.h" | 54 #include "chrome/common/extensions/api/downloads.h" |
55 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 55 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
56 #include "content/public/browser/download_interrupt_reasons.h" | 56 #include "content/public/browser/download_interrupt_reasons.h" |
57 #include "content/public/browser/download_item.h" | 57 #include "content/public/browser/download_item.h" |
58 #include "content/public/browser/download_save_info.h" | 58 #include "content/public/browser/download_save_info.h" |
59 #include "content/public/browser/download_url_parameters.h" | 59 #include "content/public/browser/download_url_parameters.h" |
60 #include "content/public/browser/notification_details.h" | 60 #include "content/public/browser/notification_details.h" |
61 #include "content/public/browser/notification_service.h" | 61 #include "content/public/browser/notification_service.h" |
62 #include "content/public/browser/notification_source.h" | 62 #include "content/public/browser/notification_source.h" |
63 #include "content/public/browser/render_process_host.h" | 63 #include "content/public/browser/render_process_host.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 virtual ~DownloadFileIconExtractorImpl() {} | 304 virtual ~DownloadFileIconExtractorImpl() {} |
305 | 305 |
306 virtual bool ExtractIconURLForPath(const base::FilePath& path, | 306 virtual bool ExtractIconURLForPath(const base::FilePath& path, |
307 float scale, | 307 float scale, |
308 IconLoader::IconSize icon_size, | 308 IconLoader::IconSize icon_size, |
309 IconURLCallback callback) OVERRIDE; | 309 IconURLCallback callback) OVERRIDE; |
310 private: | 310 private: |
311 void OnIconLoadComplete( | 311 void OnIconLoadComplete( |
312 float scale, const IconURLCallback& callback, gfx::Image* icon); | 312 float scale, const IconURLCallback& callback, gfx::Image* icon); |
313 | 313 |
314 CancelableTaskTracker cancelable_task_tracker_; | 314 base::CancelableTaskTracker cancelable_task_tracker_; |
315 }; | 315 }; |
316 | 316 |
317 bool DownloadFileIconExtractorImpl::ExtractIconURLForPath( | 317 bool DownloadFileIconExtractorImpl::ExtractIconURLForPath( |
318 const base::FilePath& path, | 318 const base::FilePath& path, |
319 float scale, | 319 float scale, |
320 IconLoader::IconSize icon_size, | 320 IconLoader::IconSize icon_size, |
321 IconURLCallback callback) { | 321 IconURLCallback callback) { |
322 IconManager* im = g_browser_process->icon_manager(); | 322 IconManager* im = g_browser_process->icon_manager(); |
323 // The contents of the file at |path| may have changed since a previous | 323 // The contents of the file at |path| may have changed since a previous |
324 // request, in which case the associated icon may also have changed. | 324 // request, in which case the associated icon may also have changed. |
(...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1899 extensions::UnloadedExtensionInfo* unloaded = | 1899 extensions::UnloadedExtensionInfo* unloaded = |
1900 content::Details<extensions::UnloadedExtensionInfo>(details).ptr(); | 1900 content::Details<extensions::UnloadedExtensionInfo>(details).ptr(); |
1901 std::set<const extensions::Extension*>::iterator iter = | 1901 std::set<const extensions::Extension*>::iterator iter = |
1902 shelf_disabling_extensions_.find(unloaded->extension); | 1902 shelf_disabling_extensions_.find(unloaded->extension); |
1903 if (iter != shelf_disabling_extensions_.end()) | 1903 if (iter != shelf_disabling_extensions_.end()) |
1904 shelf_disabling_extensions_.erase(iter); | 1904 shelf_disabling_extensions_.erase(iter); |
1905 break; | 1905 break; |
1906 } | 1906 } |
1907 } | 1907 } |
1908 } | 1908 } |
OLD | NEW |