| 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/downloads_dom_handler.h" | 5 #include "chrome/browser/ui/webui/downloads_dom_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
| 25 #include "chrome/browser/download/download_crx_util.h" | 25 #include "chrome/browser/download/download_crx_util.h" |
| 26 #include "chrome/browser/download/download_danger_prompt.h" | 26 #include "chrome/browser/download/download_danger_prompt.h" |
| 27 #include "chrome/browser/download/download_field_trial.h" | 27 #include "chrome/browser/download/download_field_trial.h" |
| 28 #include "chrome/browser/download/download_history.h" | 28 #include "chrome/browser/download/download_history.h" |
| 29 #include "chrome/browser/download/download_item_model.h" | 29 #include "chrome/browser/download/download_item_model.h" |
| 30 #include "chrome/browser/download/download_prefs.h" | 30 #include "chrome/browser/download/download_prefs.h" |
| 31 #include "chrome/browser/download/download_query.h" | 31 #include "chrome/browser/download/download_query.h" |
| 32 #include "chrome/browser/download/download_service.h" | 32 #include "chrome/browser/download/download_service.h" |
| 33 #include "chrome/browser/download/download_service_factory.h" | 33 #include "chrome/browser/download/download_service_factory.h" |
| 34 #include "chrome/browser/download/download_util.h" | 34 #include "chrome/browser/download/drag_download_item.h" |
| 35 #include "chrome/browser/extensions/api/downloads/downloads_api.h" | 35 #include "chrome/browser/extensions/api/downloads/downloads_api.h" |
| 36 #include "chrome/browser/extensions/extension_service.h" | 36 #include "chrome/browser/extensions/extension_service.h" |
| 37 #include "chrome/browser/extensions/extension_system.h" | 37 #include "chrome/browser/extensions/extension_system.h" |
| 38 #include "chrome/browser/platform_util.h" | 38 #include "chrome/browser/platform_util.h" |
| 39 #include "chrome/browser/profiles/profile.h" | 39 #include "chrome/browser/profiles/profile.h" |
| 40 #include "chrome/browser/ui/webui/fileicon_source.h" | 40 #include "chrome/browser/ui/webui/fileicon_source.h" |
| 41 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
| 42 #include "chrome/common/url_constants.h" | 42 #include "chrome/common/url_constants.h" |
| 43 #include "content/public/browser/browser_thread.h" | 43 #include "content/public/browser/browser_thread.h" |
| 44 #include "content/public/browser/download_item.h" | 44 #include "content/public/browser/download_item.h" |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 if (file->GetState() != content::DownloadItem::COMPLETE) | 398 if (file->GetState() != content::DownloadItem::COMPLETE) |
| 399 return; | 399 return; |
| 400 | 400 |
| 401 gfx::Image* icon = g_browser_process->icon_manager()->LookupIconFromFilepath( | 401 gfx::Image* icon = g_browser_process->icon_manager()->LookupIconFromFilepath( |
| 402 file->GetTargetFilePath(), IconLoader::NORMAL); | 402 file->GetTargetFilePath(), IconLoader::NORMAL); |
| 403 gfx::NativeView view = web_contents->GetView()->GetNativeView(); | 403 gfx::NativeView view = web_contents->GetView()->GetNativeView(); |
| 404 { | 404 { |
| 405 // Enable nested tasks during DnD, while |DragDownload()| blocks. | 405 // Enable nested tasks during DnD, while |DragDownload()| blocks. |
| 406 base::MessageLoop::ScopedNestableTaskAllower allow( | 406 base::MessageLoop::ScopedNestableTaskAllower allow( |
| 407 base::MessageLoop::current()); | 407 base::MessageLoop::current()); |
| 408 download_util::DragDownload(file, icon, view); | 408 DragDownloadItem(file, icon, view); |
| 409 } | 409 } |
| 410 } | 410 } |
| 411 | 411 |
| 412 void DownloadsDOMHandler::HandleSaveDangerous(const base::ListValue* args) { | 412 void DownloadsDOMHandler::HandleSaveDangerous(const base::ListValue* args) { |
| 413 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS); | 413 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS); |
| 414 content::DownloadItem* file = GetDownloadByValue(args); | 414 content::DownloadItem* file = GetDownloadByValue(args); |
| 415 if (file) | 415 if (file) |
| 416 ShowDangerPrompt(file); | 416 ShowDangerPrompt(file); |
| 417 } | 417 } |
| 418 | 418 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 } | 589 } |
| 590 | 590 |
| 591 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { | 591 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { |
| 592 web_ui()->CallJavascriptFunction("downloadsList", downloads); | 592 web_ui()->CallJavascriptFunction("downloadsList", downloads); |
| 593 } | 593 } |
| 594 | 594 |
| 595 void DownloadsDOMHandler::CallDownloadUpdated( | 595 void DownloadsDOMHandler::CallDownloadUpdated( |
| 596 const base::ListValue& download_item) { | 596 const base::ListValue& download_item) { |
| 597 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); | 597 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); |
| 598 } | 598 } |
| OLD | NEW |