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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 file->OpenDownload(); | 341 file->OpenDownload(); |
342 } | 342 } |
343 | 343 |
344 void DownloadsDOMHandler::HandleDrag(const base::ListValue* args) { | 344 void DownloadsDOMHandler::HandleDrag(const base::ListValue* args) { |
345 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_DRAG); | 345 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_DRAG); |
346 content::DownloadItem* file = GetDownloadByValue(args); | 346 content::DownloadItem* file = GetDownloadByValue(args); |
347 content::WebContents* web_contents = GetWebUIWebContents(); | 347 content::WebContents* web_contents = GetWebUIWebContents(); |
348 // |web_contents| is only NULL in the test. | 348 // |web_contents| is only NULL in the test. |
349 if (!file || !web_contents || !file->IsComplete()) | 349 if (!file || !web_contents || !file->IsComplete()) |
350 return; | 350 return; |
351 gfx::Image* icon = g_browser_process->icon_manager()->LookupIcon( | 351 gfx::Image* icon = g_browser_process->icon_manager()->LookupIconFromFilepath( |
352 file->GetTargetFilePath(), IconLoader::NORMAL); | 352 file->GetTargetFilePath(), IconLoader::NORMAL); |
353 gfx::NativeView view = web_contents->GetView()->GetNativeView(); | 353 gfx::NativeView view = web_contents->GetView()->GetNativeView(); |
354 { | 354 { |
355 // Enable nested tasks during DnD, while |DragDownload()| blocks. | 355 // Enable nested tasks during DnD, while |DragDownload()| blocks. |
356 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); | 356 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
357 download_util::DragDownload(file, icon, view); | 357 download_util::DragDownload(file, icon, view); |
358 } | 358 } |
359 } | 359 } |
360 | 360 |
361 void DownloadsDOMHandler::HandleSaveDangerous(const base::ListValue* args) { | 361 void DownloadsDOMHandler::HandleSaveDangerous(const base::ListValue* args) { |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 } | 525 } |
526 | 526 |
527 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { | 527 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { |
528 web_ui()->CallJavascriptFunction("downloadsList", downloads); | 528 web_ui()->CallJavascriptFunction("downloadsList", downloads); |
529 } | 529 } |
530 | 530 |
531 void DownloadsDOMHandler::CallDownloadUpdated( | 531 void DownloadsDOMHandler::CallDownloadUpdated( |
532 const base::ListValue& download_item) { | 532 const base::ListValue& download_item) { |
533 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); | 533 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); |
534 } | 534 } |
OLD | NEW |