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/ui/webui/md_downloads/md_downloads_dom_handler.h" | 5 #include "chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "chrome/browser/ui/webui/fileicon_source.h" | 32 #include "chrome/browser/ui/webui/fileicon_source.h" |
33 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
34 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
35 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
36 #include "components/prefs/pref_service.h" | 36 #include "components/prefs/pref_service.h" |
37 #include "content/public/browser/browser_thread.h" | 37 #include "content/public/browser/browser_thread.h" |
38 #include "content/public/browser/download_danger_type.h" | 38 #include "content/public/browser/download_danger_type.h" |
39 #include "content/public/browser/download_item.h" | 39 #include "content/public/browser/download_item.h" |
40 #include "content/public/browser/download_manager.h" | 40 #include "content/public/browser/download_manager.h" |
41 #include "content/public/browser/url_data_source.h" | 41 #include "content/public/browser/url_data_source.h" |
42 #include "content/public/browser/user_metrics.h" | |
43 #include "content/public/browser/web_contents.h" | 42 #include "content/public/browser/web_contents.h" |
44 #include "content/public/browser/web_ui.h" | 43 #include "content/public/browser/web_ui.h" |
45 #include "net/base/filename_util.h" | 44 #include "net/base/filename_util.h" |
46 #include "ui/base/l10n/time_format.h" | 45 #include "ui/base/l10n/time_format.h" |
47 #include "ui/gfx/image/image.h" | 46 #include "ui/gfx/image/image.h" |
48 | 47 |
49 using base::UserMetricsAction; | |
50 using content::BrowserThread; | 48 using content::BrowserThread; |
51 | 49 |
52 namespace { | 50 namespace { |
53 | 51 |
54 enum DownloadsDOMEvent { | 52 enum DownloadsDOMEvent { |
55 DOWNLOADS_DOM_EVENT_GET_DOWNLOADS = 0, | 53 DOWNLOADS_DOM_EVENT_GET_DOWNLOADS = 0, |
56 DOWNLOADS_DOM_EVENT_OPEN_FILE = 1, | 54 DOWNLOADS_DOM_EVENT_OPEN_FILE = 1, |
57 DOWNLOADS_DOM_EVENT_DRAG = 2, | 55 DOWNLOADS_DOM_EVENT_DRAG = 2, |
58 DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS = 3, | 56 DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS = 3, |
59 DOWNLOADS_DOM_EVENT_DISCARD_DANGEROUS = 4, | 57 DOWNLOADS_DOM_EVENT_DISCARD_DANGEROUS = 4, |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 | 454 |
457 void MdDownloadsDOMHandler::RemoveDownloadInArgs(const base::ListValue* args) { | 455 void MdDownloadsDOMHandler::RemoveDownloadInArgs(const base::ListValue* args) { |
458 content::DownloadItem* file = GetDownloadByValue(args); | 456 content::DownloadItem* file = GetDownloadByValue(args); |
459 if (!file) | 457 if (!file) |
460 return; | 458 return; |
461 | 459 |
462 DownloadVector downloads; | 460 DownloadVector downloads; |
463 downloads.push_back(file); | 461 downloads.push_back(file); |
464 RemoveDownloads(downloads); | 462 RemoveDownloads(downloads); |
465 } | 463 } |
OLD | NEW |