| 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 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 EXTENSION_FUNCTION_VALIDATE(params.get()); | 962 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 963 DownloadItem* download_item = GetDownload( | 963 DownloadItem* download_item = GetDownload( |
| 964 profile(), include_incognito(), params->download_id); | 964 profile(), include_incognito(), params->download_id); |
| 965 content::WebContents* web_contents = | 965 content::WebContents* web_contents = |
| 966 dispatcher()->delegate()->GetAssociatedWebContents(); | 966 dispatcher()->delegate()->GetAssociatedWebContents(); |
| 967 if (!download_item || !web_contents) { | 967 if (!download_item || !web_contents) { |
| 968 error_ = download_extension_errors::kInvalidOperationError; | 968 error_ = download_extension_errors::kInvalidOperationError; |
| 969 return false; | 969 return false; |
| 970 } | 970 } |
| 971 RecordApiFunctions(DOWNLOADS_FUNCTION_DRAG); | 971 RecordApiFunctions(DOWNLOADS_FUNCTION_DRAG); |
| 972 gfx::Image* icon = g_browser_process->icon_manager()->LookupIcon( | 972 gfx::Image* icon = g_browser_process->icon_manager()->LookupIconFromFilepath( |
| 973 download_item->GetUserVerifiedFilePath(), IconLoader::NORMAL); | 973 download_item->GetUserVerifiedFilePath(), IconLoader::NORMAL); |
| 974 gfx::NativeView view = web_contents->GetNativeView(); | 974 gfx::NativeView view = web_contents->GetNativeView(); |
| 975 { | 975 { |
| 976 // Enable nested tasks during DnD, while |DragDownload()| blocks. | 976 // Enable nested tasks during DnD, while |DragDownload()| blocks. |
| 977 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); | 977 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
| 978 download_util::DragDownload(download_item, icon, view); | 978 download_util::DragDownload(download_item, icon, view); |
| 979 } | 979 } |
| 980 return true; | 980 return true; |
| 981 } | 981 } |
| 982 | 982 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 if (profile_->HasOffTheRecordProfile() && | 1146 if (profile_->HasOffTheRecordProfile() && |
| 1147 !profile_->IsOffTheRecord()) { | 1147 !profile_->IsOffTheRecord()) { |
| 1148 DispatchEventInternal( | 1148 DispatchEventInternal( |
| 1149 profile_->GetOffTheRecordProfile(), | 1149 profile_->GetOffTheRecordProfile(), |
| 1150 event_name, | 1150 event_name, |
| 1151 json_args, | 1151 json_args, |
| 1152 scoped_ptr<base::ListValue>(args->DeepCopy())); | 1152 scoped_ptr<base::ListValue>(args->DeepCopy())); |
| 1153 } | 1153 } |
| 1154 DispatchEventInternal(profile_, event_name, json_args, args.Pass()); | 1154 DispatchEventInternal(profile_, event_name, json_args, args.Pass()); |
| 1155 } | 1155 } |
| OLD | NEW |