| 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 void DownloadsDOMHandler::HandleDrag(const ListValue* args) { | 261 void DownloadsDOMHandler::HandleDrag(const ListValue* args) { |
| 262 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_DRAG); | 262 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_DRAG); |
| 263 content::DownloadItem* file = GetDownloadByValue(args); | 263 content::DownloadItem* file = GetDownloadByValue(args); |
| 264 if (file) { | 264 if (file) { |
| 265 IconManager* im = g_browser_process->icon_manager(); | 265 IconManager* im = g_browser_process->icon_manager(); |
| 266 gfx::Image* icon = im->LookupIcon(file->GetUserVerifiedFilePath(), | 266 gfx::Image* icon = im->LookupIcon(file->GetUserVerifiedFilePath(), |
| 267 IconLoader::NORMAL); | 267 IconLoader::NORMAL); |
| 268 gfx::NativeView view = web_ui()->GetWebContents()->GetNativeView(); | 268 gfx::NativeView view = web_ui()->GetWebContents()->GetNativeView(); |
| 269 { | 269 { |
| 270 // Enable nested tasks during DnD, while |DragDownload()| blocks. | 270 // Enable nested tasks during DnD, while |DragDownload()| blocks. |
| 271 MessageLoop::ScopedNestableTaskAllower allower(MessageLoop::current()); | 271 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
| 272 download_util::DragDownload(file, icon, view); | 272 download_util::DragDownload(file, icon, view); |
| 273 } | 273 } |
| 274 } | 274 } |
| 275 } | 275 } |
| 276 | 276 |
| 277 void DownloadsDOMHandler::HandleSaveDangerous(const ListValue* args) { | 277 void DownloadsDOMHandler::HandleSaveDangerous(const ListValue* args) { |
| 278 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS); | 278 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS); |
| 279 content::DownloadItem* file = GetDownloadByValue(args); | 279 content::DownloadItem* file = GetDownloadByValue(args); |
| 280 if (file) | 280 if (file) |
| 281 file->DangerousDownloadValidated(); | 281 file->DangerousDownloadValidated(); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 } | 375 } |
| 376 | 376 |
| 377 content::DownloadItem* DownloadsDOMHandler::GetDownloadByValue( | 377 content::DownloadItem* DownloadsDOMHandler::GetDownloadByValue( |
| 378 const ListValue* args) { | 378 const ListValue* args) { |
| 379 int id; | 379 int id; |
| 380 if (ExtractIntegerValue(args, &id)) { | 380 if (ExtractIntegerValue(args, &id)) { |
| 381 return GetDownloadById(id); | 381 return GetDownloadById(id); |
| 382 } | 382 } |
| 383 return NULL; | 383 return NULL; |
| 384 } | 384 } |
| OLD | NEW |