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/download/download_extension_api.h" | 5 #include "chrome/browser/download/download_extension_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 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/download/download_service.h" | 26 #include "chrome/browser/download/download_service.h" |
27 #include "chrome/browser/download/download_service_factory.h" | 27 #include "chrome/browser/download/download_service_factory.h" |
28 #include "chrome/browser/download/download_util.h" | 28 #include "chrome/browser/download/download_util.h" |
29 #include "chrome/browser/extensions/extension_event_names.h" | 29 #include "chrome/browser/extensions/extension_event_names.h" |
30 #include "chrome/browser/extensions/extension_event_router.h" | 30 #include "chrome/browser/extensions/extension_event_router.h" |
31 #include "chrome/browser/icon_loader.h" | 31 #include "chrome/browser/icon_loader.h" |
32 #include "chrome/browser/icon_manager.h" | 32 #include "chrome/browser/icon_manager.h" |
33 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" | 33 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
34 #include "chrome/browser/ui/browser_list.h" | 34 #include "chrome/browser/ui/browser_list.h" |
35 #include "chrome/browser/ui/webui/web_ui_util.h" | 35 #include "chrome/browser/ui/webui/web_ui_util.h" |
36 #include "content/browser/download/download_file_manager.h" | |
37 #include "content/browser/download/download_id.h" | 36 #include "content/browser/download/download_id.h" |
38 #include "content/browser/download/download_state_info.h" | 37 #include "content/browser/download/download_state_info.h" |
39 #include "content/browser/download/download_types.h" | 38 #include "content/browser/download/download_types.h" |
40 #include "content/browser/download/interrupt_reasons.h" | 39 #include "content/browser/download/interrupt_reasons.h" |
41 #include "content/browser/renderer_host/render_view_host.h" | 40 #include "content/browser/renderer_host/render_view_host.h" |
42 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 41 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
43 #include "content/public/browser/download_item.h" | 42 #include "content/public/browser/download_item.h" |
44 #include "content/public/browser/render_process_host.h" | 43 #include "content/public/browser/render_process_host.h" |
45 #include "net/http/http_util.h" | 44 #include "net/http/http_util.h" |
46 #include "net/url_request/url_request.h" | 45 #include "net/url_request/url_request.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 EXTENSION_FUNCTION_VALIDATE(header->GetString( | 225 EXTENSION_FUNCTION_VALIDATE(header->GetString( |
227 kHeaderNameKey, &name)); | 226 kHeaderNameKey, &name)); |
228 EXTENSION_FUNCTION_VALIDATE(header->GetString( | 227 EXTENSION_FUNCTION_VALIDATE(header->GetString( |
229 kHeaderValueKey, &value)); | 228 kHeaderValueKey, &value)); |
230 if (!net::HttpUtil::IsSafeHeader(name)) { | 229 if (!net::HttpUtil::IsSafeHeader(name)) { |
231 error_ = download_extension_errors::kGenericError; | 230 error_ = download_extension_errors::kGenericError; |
232 return false; | 231 return false; |
233 } | 232 } |
234 } | 233 } |
235 } | 234 } |
236 iodata_->rdh = g_browser_process->resource_dispatcher_host(); | 235 iodata_->rdh = ResourceDispatcherHost::Get(); |
237 iodata_->resource_context = &profile()->GetResourceContext(); | 236 iodata_->resource_context = &profile()->GetResourceContext(); |
238 iodata_->render_process_host_id = render_view_host()->process()->GetID(); | 237 iodata_->render_process_host_id = render_view_host()->process()->GetID(); |
239 iodata_->render_view_host_routing_id = render_view_host()->routing_id(); | 238 iodata_->render_view_host_routing_id = render_view_host()->routing_id(); |
240 return true; | 239 return true; |
241 } | 240 } |
242 | 241 |
243 bool DownloadsDownloadFunction::RunInternal() { | 242 bool DownloadsDownloadFunction::RunInternal() { |
244 VLOG(1) << __FUNCTION__ << " " << iodata_->url.spec(); | 243 VLOG(1) << __FUNCTION__ << " " << iodata_->url.spec(); |
245 if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( | 244 if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( |
246 &DownloadsDownloadFunction::BeginDownloadOnIOThread, this))) { | 245 &DownloadsDownloadFunction::BeginDownloadOnIOThread, this))) { |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 ListValue args; | 727 ListValue args; |
729 args.Append(arg); | 728 args.Append(arg); |
730 std::string json_args; | 729 std::string json_args; |
731 base::JSONWriter::Write(&args, false, &json_args); | 730 base::JSONWriter::Write(&args, false, &json_args); |
732 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( | 731 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( |
733 event_name, | 732 event_name, |
734 json_args, | 733 json_args, |
735 profile_, | 734 profile_, |
736 GURL()); | 735 GURL()); |
737 } | 736 } |
OLD | NEW |