| 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/extensions/api/downloads/downloads_api.h" | 5 #include "chrome/browser/extensions/api/downloads/downloads_api.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cctype> | 8 #include <cctype> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 EXTENSION_FUNCTION_VALIDATE(params.get()); | 1111 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 1112 DownloadItem* download_item = GetDownload( | 1112 DownloadItem* download_item = GetDownload( |
| 1113 profile(), include_incognito(), params->download_id); | 1113 profile(), include_incognito(), params->download_id); |
| 1114 content::WebContents* web_contents = | 1114 content::WebContents* web_contents = |
| 1115 dispatcher()->delegate()->GetAssociatedWebContents(); | 1115 dispatcher()->delegate()->GetAssociatedWebContents(); |
| 1116 if (!download_item || !web_contents) { | 1116 if (!download_item || !web_contents) { |
| 1117 error_ = download_extension_errors::kInvalidOperationError; | 1117 error_ = download_extension_errors::kInvalidOperationError; |
| 1118 return false; | 1118 return false; |
| 1119 } | 1119 } |
| 1120 RecordApiFunctions(DOWNLOADS_FUNCTION_DRAG); | 1120 RecordApiFunctions(DOWNLOADS_FUNCTION_DRAG); |
| 1121 gfx::Image* icon = g_browser_process->icon_manager()->LookupIcon( | 1121 gfx::Image* icon = g_browser_process->icon_manager()->LookupIconFromFilepath( |
| 1122 download_item->GetUserVerifiedFilePath(), IconLoader::NORMAL); | 1122 download_item->GetUserVerifiedFilePath(), IconLoader::NORMAL); |
| 1123 gfx::NativeView view = web_contents->GetView()->GetNativeView(); | 1123 gfx::NativeView view = web_contents->GetView()->GetNativeView(); |
| 1124 { | 1124 { |
| 1125 // Enable nested tasks during DnD, while |DragDownload()| blocks. | 1125 // Enable nested tasks during DnD, while |DragDownload()| blocks. |
| 1126 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); | 1126 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
| 1127 download_util::DragDownload(download_item, icon, view); | 1127 download_util::DragDownload(download_item, icon, view); |
| 1128 } | 1128 } |
| 1129 return true; | 1129 return true; |
| 1130 } | 1130 } |
| 1131 | 1131 |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1444 DownloadsNotificationSource notification_source; | 1444 DownloadsNotificationSource notification_source; |
| 1445 notification_source.event_name = event_name; | 1445 notification_source.event_name = event_name; |
| 1446 notification_source.profile = profile_; | 1446 notification_source.profile = profile_; |
| 1447 content::Source<DownloadsNotificationSource> content_source( | 1447 content::Source<DownloadsNotificationSource> content_source( |
| 1448 ¬ification_source); | 1448 ¬ification_source); |
| 1449 content::NotificationService::current()->Notify( | 1449 content::NotificationService::current()->Notify( |
| 1450 chrome::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, | 1450 chrome::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, |
| 1451 content_source, | 1451 content_source, |
| 1452 content::Details<std::string>(&json_args)); | 1452 content::Details<std::string>(&json_args)); |
| 1453 } | 1453 } |
| OLD | NEW |