OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "headless/lib/browser/headless_browser_context_impl.h" | 5 #include "headless/lib/browser/headless_browser_context_impl.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/guid.h" | 12 #include "base/guid.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
16 #include "content/public/browser/resource_context.h" | 16 #include "content/public/browser/resource_context.h" |
17 #include "content/public/browser/storage_partition.h" | 17 #include "content/public/browser/storage_partition.h" |
18 #include "headless/grit/headless_lib_resources.h" | 18 #include "headless/grit/headless_lib_resources.h" |
19 #include "headless/lib/browser/headless_browser_context_options.h" | 19 #include "headless/lib/browser/headless_browser_context_options.h" |
20 #include "headless/lib/browser/headless_browser_impl.h" | 20 #include "headless/lib/browser/headless_browser_impl.h" |
21 #include "headless/lib/browser/headless_browser_main_parts.h" | 21 #include "headless/lib/browser/headless_browser_main_parts.h" |
| 22 #include "headless/lib/browser/headless_download_manager_delegate.h" |
22 #include "headless/lib/browser/headless_net_log.h" | 23 #include "headless/lib/browser/headless_net_log.h" |
23 #include "headless/lib/browser/headless_permission_manager.h" | 24 #include "headless/lib/browser/headless_permission_manager.h" |
24 #include "headless/lib/browser/headless_url_request_context_getter.h" | 25 #include "headless/lib/browser/headless_url_request_context_getter.h" |
25 #include "headless/public/util/black_hole_protocol_handler.h" | 26 #include "headless/public/util/black_hole_protocol_handler.h" |
26 #include "headless/public/util/in_memory_protocol_handler.h" | 27 #include "headless/public/util/in_memory_protocol_handler.h" |
27 #include "net/url_request/url_request_context.h" | 28 #include "net/url_request/url_request_context.h" |
28 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
29 | 30 |
30 namespace headless { | 31 namespace headless { |
31 | 32 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 bool HeadlessBrowserContextImpl::IsOffTheRecord() const { | 196 bool HeadlessBrowserContextImpl::IsOffTheRecord() const { |
196 return context_options_->incognito_mode(); | 197 return context_options_->incognito_mode(); |
197 } | 198 } |
198 | 199 |
199 content::ResourceContext* HeadlessBrowserContextImpl::GetResourceContext() { | 200 content::ResourceContext* HeadlessBrowserContextImpl::GetResourceContext() { |
200 return resource_context_.get(); | 201 return resource_context_.get(); |
201 } | 202 } |
202 | 203 |
203 content::DownloadManagerDelegate* | 204 content::DownloadManagerDelegate* |
204 HeadlessBrowserContextImpl::GetDownloadManagerDelegate() { | 205 HeadlessBrowserContextImpl::GetDownloadManagerDelegate() { |
205 return nullptr; | 206 if (!download_manager_delegate_.get()) { |
| 207 download_manager_delegate_.reset(new HeadlessDownloadManagerDelegate()); |
| 208 download_manager_delegate_->SetDownloadManager( |
| 209 BrowserContext::GetDownloadManager(this)); |
| 210 } |
| 211 |
| 212 return download_manager_delegate_.get(); |
206 } | 213 } |
207 | 214 |
208 content::BrowserPluginGuestManager* | 215 content::BrowserPluginGuestManager* |
209 HeadlessBrowserContextImpl::GetGuestManager() { | 216 HeadlessBrowserContextImpl::GetGuestManager() { |
210 // TODO(altimin): Should be non-null? (is null in content/shell). | 217 // TODO(altimin): Should be non-null? (is null in content/shell). |
211 return nullptr; | 218 return nullptr; |
212 } | 219 } |
213 | 220 |
214 storage::SpecialStoragePolicy* | 221 storage::SpecialStoragePolicy* |
215 HeadlessBrowserContextImpl::GetSpecialStoragePolicy() { | 222 HeadlessBrowserContextImpl::GetSpecialStoragePolicy() { |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 HeadlessBrowserContext::Builder::MojoBindings::MojoBindings() {} | 438 HeadlessBrowserContext::Builder::MojoBindings::MojoBindings() {} |
432 | 439 |
433 HeadlessBrowserContext::Builder::MojoBindings::MojoBindings( | 440 HeadlessBrowserContext::Builder::MojoBindings::MojoBindings( |
434 const std::string& mojom_name, | 441 const std::string& mojom_name, |
435 const std::string& js_bindings) | 442 const std::string& js_bindings) |
436 : mojom_name(mojom_name), js_bindings(js_bindings) {} | 443 : mojom_name(mojom_name), js_bindings(js_bindings) {} |
437 | 444 |
438 HeadlessBrowserContext::Builder::MojoBindings::~MojoBindings() {} | 445 HeadlessBrowserContext::Builder::MojoBindings::~MojoBindings() {} |
439 | 446 |
440 } // namespace headless | 447 } // namespace headless |
OLD | NEW |