Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: chrome/browser/ui/webui/downloads_dom_handler.cc

Issue 11801022: Allow dragging a download only after the download is complete. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with trunk at 175906 Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/gtk/download/download_item_gtk.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 content::DownloadItem* file = GetDownloadByValue(args); 331 content::DownloadItem* file = GetDownloadByValue(args);
332 if (file) 332 if (file)
333 file->OpenDownload(); 333 file->OpenDownload();
334 } 334 }
335 335
336 void DownloadsDOMHandler::HandleDrag(const base::ListValue* args) { 336 void DownloadsDOMHandler::HandleDrag(const base::ListValue* args) {
337 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_DRAG); 337 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_DRAG);
338 content::DownloadItem* file = GetDownloadByValue(args); 338 content::DownloadItem* file = GetDownloadByValue(args);
339 content::WebContents* web_contents = GetWebUIWebContents(); 339 content::WebContents* web_contents = GetWebUIWebContents();
340 // |web_contents| is only NULL in the test. 340 // |web_contents| is only NULL in the test.
341 if (!file || !web_contents) 341 if (!file || !web_contents || !file->IsComplete())
342 return; 342 return;
343 gfx::Image* icon = g_browser_process->icon_manager()->LookupIcon( 343 gfx::Image* icon = g_browser_process->icon_manager()->LookupIcon(
344 file->GetUserVerifiedFilePath(), IconLoader::NORMAL); 344 file->GetTargetFilePath(), IconLoader::NORMAL);
345 gfx::NativeView view = web_contents->GetNativeView(); 345 gfx::NativeView view = web_contents->GetNativeView();
346 { 346 {
347 // Enable nested tasks during DnD, while |DragDownload()| blocks. 347 // Enable nested tasks during DnD, while |DragDownload()| blocks.
348 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); 348 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
349 download_util::DragDownload(file, icon, view); 349 download_util::DragDownload(file, icon, view);
350 } 350 }
351 } 351 }
352 352
353 void DownloadsDOMHandler::HandleSaveDangerous(const base::ListValue* args) { 353 void DownloadsDOMHandler::HandleSaveDangerous(const base::ListValue* args) {
354 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS); 354 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 } 510 }
511 511
512 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { 512 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) {
513 web_ui()->CallJavascriptFunction("downloadsList", downloads); 513 web_ui()->CallJavascriptFunction("downloadsList", downloads);
514 } 514 }
515 515
516 void DownloadsDOMHandler::CallDownloadUpdated( 516 void DownloadsDOMHandler::CallDownloadUpdated(
517 const base::ListValue& download_item) { 517 const base::ListValue& download_item) {
518 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); 518 web_ui()->CallJavascriptFunction("downloadUpdated", download_item);
519 } 519 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/download/download_item_gtk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698