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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "content/public/browser/download_interrupt_reasons.h" | 45 #include "content/public/browser/download_interrupt_reasons.h" |
46 #include "content/public/browser/download_item.h" | 46 #include "content/public/browser/download_item.h" |
47 #include "content/public/browser/download_save_info.h" | 47 #include "content/public/browser/download_save_info.h" |
48 #include "content/public/browser/download_url_parameters.h" | 48 #include "content/public/browser/download_url_parameters.h" |
49 #include "content/public/browser/notification_service.h" | 49 #include "content/public/browser/notification_service.h" |
50 #include "content/public/browser/render_process_host.h" | 50 #include "content/public/browser/render_process_host.h" |
51 #include "content/public/browser/render_view_host.h" | 51 #include "content/public/browser/render_view_host.h" |
52 #include "content/public/browser/resource_context.h" | 52 #include "content/public/browser/resource_context.h" |
53 #include "content/public/browser/resource_dispatcher_host.h" | 53 #include "content/public/browser/resource_dispatcher_host.h" |
54 #include "content/public/browser/web_contents.h" | 54 #include "content/public/browser/web_contents.h" |
| 55 #include "content/public/browser/web_contents_view.h" |
55 #include "net/base/load_flags.h" | 56 #include "net/base/load_flags.h" |
56 #include "net/http/http_util.h" | 57 #include "net/http/http_util.h" |
57 #include "net/url_request/url_request.h" | 58 #include "net/url_request/url_request.h" |
58 #include "third_party/skia/include/core/SkBitmap.h" | 59 #include "third_party/skia/include/core/SkBitmap.h" |
59 #include "ui/webui/web_ui_util.h" | 60 #include "ui/webui/web_ui_util.h" |
60 | 61 |
61 using content::BrowserContext; | 62 using content::BrowserContext; |
62 using content::BrowserThread; | 63 using content::BrowserThread; |
63 using content::DownloadId; | 64 using content::DownloadId; |
64 using content::DownloadItem; | 65 using content::DownloadItem; |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 profile(), include_incognito(), params->download_id); | 965 profile(), include_incognito(), params->download_id); |
965 content::WebContents* web_contents = | 966 content::WebContents* web_contents = |
966 dispatcher()->delegate()->GetAssociatedWebContents(); | 967 dispatcher()->delegate()->GetAssociatedWebContents(); |
967 if (!download_item || !web_contents) { | 968 if (!download_item || !web_contents) { |
968 error_ = download_extension_errors::kInvalidOperationError; | 969 error_ = download_extension_errors::kInvalidOperationError; |
969 return false; | 970 return false; |
970 } | 971 } |
971 RecordApiFunctions(DOWNLOADS_FUNCTION_DRAG); | 972 RecordApiFunctions(DOWNLOADS_FUNCTION_DRAG); |
972 gfx::Image* icon = g_browser_process->icon_manager()->LookupIcon( | 973 gfx::Image* icon = g_browser_process->icon_manager()->LookupIcon( |
973 download_item->GetUserVerifiedFilePath(), IconLoader::NORMAL); | 974 download_item->GetUserVerifiedFilePath(), IconLoader::NORMAL); |
974 gfx::NativeView view = web_contents->GetNativeView(); | 975 gfx::NativeView view = web_contents->GetView()->GetNativeView(); |
975 { | 976 { |
976 // Enable nested tasks during DnD, while |DragDownload()| blocks. | 977 // Enable nested tasks during DnD, while |DragDownload()| blocks. |
977 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); | 978 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
978 download_util::DragDownload(download_item, icon, view); | 979 download_util::DragDownload(download_item, icon, view); |
979 } | 980 } |
980 return true; | 981 return true; |
981 } | 982 } |
982 | 983 |
983 DownloadsGetFileIconFunction::DownloadsGetFileIconFunction() | 984 DownloadsGetFileIconFunction::DownloadsGetFileIconFunction() |
984 : icon_extractor_(new DownloadFileIconExtractorImpl()) { | 985 : icon_extractor_(new DownloadFileIconExtractorImpl()) { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 if (profile_->HasOffTheRecordProfile() && | 1147 if (profile_->HasOffTheRecordProfile() && |
1147 !profile_->IsOffTheRecord()) { | 1148 !profile_->IsOffTheRecord()) { |
1148 DispatchEventInternal( | 1149 DispatchEventInternal( |
1149 profile_->GetOffTheRecordProfile(), | 1150 profile_->GetOffTheRecordProfile(), |
1150 event_name, | 1151 event_name, |
1151 json_args, | 1152 json_args, |
1152 scoped_ptr<base::ListValue>(args->DeepCopy())); | 1153 scoped_ptr<base::ListValue>(args->DeepCopy())); |
1153 } | 1154 } |
1154 DispatchEventInternal(profile_, event_name, json_args, args.Pass()); | 1155 DispatchEventInternal(profile_, event_name, json_args, args.Pass()); |
1155 } | 1156 } |
OLD | NEW |