| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
| 25 #include "chrome/browser/download/download_service.h" | 25 #include "chrome/browser/download/download_service.h" |
| 26 #include "chrome/browser/download/download_service_factory.h" | 26 #include "chrome/browser/download/download_service_factory.h" |
| 27 #include "chrome/browser/download/download_util.h" | 27 #include "chrome/browser/download/download_util.h" |
| 28 #include "chrome/browser/extensions/extension_event_names.h" | 28 #include "chrome/browser/extensions/extension_event_names.h" |
| 29 #include "chrome/browser/extensions/extension_event_router.h" | 29 #include "chrome/browser/extensions/extension_event_router.h" |
| 30 #include "chrome/browser/icon_loader.h" | 30 #include "chrome/browser/icon_loader.h" |
| 31 #include "chrome/browser/icon_manager.h" | 31 #include "chrome/browser/icon_manager.h" |
| 32 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" | 32 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
| 33 #include "chrome/browser/ui/browser_list.h" | 33 #include "chrome/browser/ui/browser_list.h" |
| 34 #include "content/browser/download/download_file_manager.h" | |
| 35 #include "content/browser/download/download_id.h" | 34 #include "content/browser/download/download_id.h" |
| 36 #include "content/browser/download/download_state_info.h" | 35 #include "content/browser/download/download_state_info.h" |
| 37 #include "content/browser/download/download_types.h" | 36 #include "content/browser/download/download_types.h" |
| 38 #include "content/browser/download/interrupt_reasons.h" | 37 #include "content/browser/download/interrupt_reasons.h" |
| 39 #include "content/browser/renderer_host/render_view_host.h" | 38 #include "content/browser/renderer_host/render_view_host.h" |
| 40 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 39 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 41 #include "content/public/browser/download_item.h" | 40 #include "content/public/browser/download_item.h" |
| 42 #include "content/public/browser/render_process_host.h" | 41 #include "content/public/browser/render_process_host.h" |
| 43 #include "net/http/http_util.h" | 42 #include "net/http/http_util.h" |
| 44 #include "net/url_request/url_request.h" | 43 #include "net/url_request/url_request.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 EXTENSION_FUNCTION_VALIDATE(header->GetString( | 218 EXTENSION_FUNCTION_VALIDATE(header->GetString( |
| 220 kHeaderNameKey, &name)); | 219 kHeaderNameKey, &name)); |
| 221 EXTENSION_FUNCTION_VALIDATE(header->GetString( | 220 EXTENSION_FUNCTION_VALIDATE(header->GetString( |
| 222 kHeaderValueKey, &value)); | 221 kHeaderValueKey, &value)); |
| 223 if (!net::HttpUtil::IsSafeHeader(name)) { | 222 if (!net::HttpUtil::IsSafeHeader(name)) { |
| 224 error_ = download_extension_errors::kGenericError; | 223 error_ = download_extension_errors::kGenericError; |
| 225 return false; | 224 return false; |
| 226 } | 225 } |
| 227 } | 226 } |
| 228 } | 227 } |
| 229 iodata_->rdh = g_browser_process->resource_dispatcher_host(); | 228 iodata_->rdh = ResourceDispatcherHost::Get(); |
| 230 iodata_->resource_context = &profile()->GetResourceContext(); | 229 iodata_->resource_context = &profile()->GetResourceContext(); |
| 231 iodata_->render_process_host_id = render_view_host()->process()->GetID(); | 230 iodata_->render_process_host_id = render_view_host()->process()->GetID(); |
| 232 iodata_->render_view_host_routing_id = render_view_host()->routing_id(); | 231 iodata_->render_view_host_routing_id = render_view_host()->routing_id(); |
| 233 return true; | 232 return true; |
| 234 } | 233 } |
| 235 | 234 |
| 236 bool DownloadsDownloadFunction::RunInternal() { | 235 bool DownloadsDownloadFunction::RunInternal() { |
| 237 VLOG(1) << __FUNCTION__ << " " << iodata_->url.spec(); | 236 VLOG(1) << __FUNCTION__ << " " << iodata_->url.spec(); |
| 238 if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( | 237 if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( |
| 239 &DownloadsDownloadFunction::BeginDownloadOnIOThread, this))) { | 238 &DownloadsDownloadFunction::BeginDownloadOnIOThread, this))) { |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 ListValue args; | 600 ListValue args; |
| 602 args.Append(arg); | 601 args.Append(arg); |
| 603 std::string json_args; | 602 std::string json_args; |
| 604 base::JSONWriter::Write(&args, false, &json_args); | 603 base::JSONWriter::Write(&args, false, &json_args); |
| 605 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( | 604 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( |
| 606 event_name, | 605 event_name, |
| 607 json_args, | 606 json_args, |
| 608 profile_, | 607 profile_, |
| 609 GURL()); | 608 GURL()); |
| 610 } | 609 } |
| OLD | NEW |