| 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 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 DownloadItem* download_item = GetDownload( | 1125 DownloadItem* download_item = GetDownload( |
| 1126 profile(), include_incognito(), params->download_id); | 1126 profile(), include_incognito(), params->download_id); |
| 1127 content::WebContents* web_contents = | 1127 content::WebContents* web_contents = |
| 1128 dispatcher()->delegate()->GetAssociatedWebContents(); | 1128 dispatcher()->delegate()->GetAssociatedWebContents(); |
| 1129 if (!download_item || !web_contents) { | 1129 if (!download_item || !web_contents) { |
| 1130 error_ = download_extension_errors::kInvalidOperationError; | 1130 error_ = download_extension_errors::kInvalidOperationError; |
| 1131 return false; | 1131 return false; |
| 1132 } | 1132 } |
| 1133 RecordApiFunctions(DOWNLOADS_FUNCTION_DRAG); | 1133 RecordApiFunctions(DOWNLOADS_FUNCTION_DRAG); |
| 1134 gfx::Image* icon = g_browser_process->icon_manager()->LookupIconFromFilepath( | 1134 gfx::Image* icon = g_browser_process->icon_manager()->LookupIconFromFilepath( |
| 1135 download_item->GetUserVerifiedFilePath(), IconLoader::NORMAL); | 1135 download_item->GetTargetFilePath(), IconLoader::NORMAL); |
| 1136 gfx::NativeView view = web_contents->GetView()->GetNativeView(); | 1136 gfx::NativeView view = web_contents->GetView()->GetNativeView(); |
| 1137 { | 1137 { |
| 1138 // Enable nested tasks during DnD, while |DragDownload()| blocks. | 1138 // Enable nested tasks during DnD, while |DragDownload()| blocks. |
| 1139 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); | 1139 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
| 1140 download_util::DragDownload(download_item, icon, view); | 1140 download_util::DragDownload(download_item, icon, view); |
| 1141 } | 1141 } |
| 1142 return true; | 1142 return true; |
| 1143 } | 1143 } |
| 1144 | 1144 |
| 1145 DownloadsGetFileIconFunction::DownloadsGetFileIconFunction() | 1145 DownloadsGetFileIconFunction::DownloadsGetFileIconFunction() |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1498 DownloadsNotificationSource notification_source; | 1498 DownloadsNotificationSource notification_source; |
| 1499 notification_source.event_name = event_name; | 1499 notification_source.event_name = event_name; |
| 1500 notification_source.profile = profile_; | 1500 notification_source.profile = profile_; |
| 1501 content::Source<DownloadsNotificationSource> content_source( | 1501 content::Source<DownloadsNotificationSource> content_source( |
| 1502 ¬ification_source); | 1502 ¬ification_source); |
| 1503 content::NotificationService::current()->Notify( | 1503 content::NotificationService::current()->Notify( |
| 1504 chrome::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, | 1504 chrome::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, |
| 1505 content_source, | 1505 content_source, |
| 1506 content::Details<std::string>(&json_args)); | 1506 content::Details<std::string>(&json_args)); |
| 1507 } | 1507 } |
| OLD | NEW |