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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 bool HeadlessBrowserContextImpl::IsOffTheRecord() const { | 200 bool HeadlessBrowserContextImpl::IsOffTheRecord() const { |
200 return context_options_->incognito_mode(); | 201 return context_options_->incognito_mode(); |
201 } | 202 } |
202 | 203 |
203 content::ResourceContext* HeadlessBrowserContextImpl::GetResourceContext() { | 204 content::ResourceContext* HeadlessBrowserContextImpl::GetResourceContext() { |
204 return resource_context_.get(); | 205 return resource_context_.get(); |
205 } | 206 } |
206 | 207 |
207 content::DownloadManagerDelegate* | 208 content::DownloadManagerDelegate* |
208 HeadlessBrowserContextImpl::GetDownloadManagerDelegate() { | 209 HeadlessBrowserContextImpl::GetDownloadManagerDelegate() { |
209 return nullptr; | 210 if (!download_manager_delegate_.get()) { |
| 211 download_manager_delegate_.reset(new HeadlessDownloadManagerDelegate()); |
| 212 download_manager_delegate_->SetDownloadManager( |
| 213 BrowserContext::GetDownloadManager(this)); |
| 214 } |
| 215 |
| 216 return download_manager_delegate_.get(); |
210 } | 217 } |
211 | 218 |
212 content::BrowserPluginGuestManager* | 219 content::BrowserPluginGuestManager* |
213 HeadlessBrowserContextImpl::GetGuestManager() { | 220 HeadlessBrowserContextImpl::GetGuestManager() { |
214 // TODO(altimin): Should be non-null? (is null in content/shell). | 221 // TODO(altimin): Should be non-null? (is null in content/shell). |
215 return nullptr; | 222 return nullptr; |
216 } | 223 } |
217 | 224 |
218 storage::SpecialStoragePolicy* | 225 storage::SpecialStoragePolicy* |
219 HeadlessBrowserContextImpl::GetSpecialStoragePolicy() { | 226 HeadlessBrowserContextImpl::GetSpecialStoragePolicy() { |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 HeadlessBrowserContext::Builder::MojoBindings::MojoBindings() {} | 450 HeadlessBrowserContext::Builder::MojoBindings::MojoBindings() {} |
444 | 451 |
445 HeadlessBrowserContext::Builder::MojoBindings::MojoBindings( | 452 HeadlessBrowserContext::Builder::MojoBindings::MojoBindings( |
446 const std::string& mojom_name, | 453 const std::string& mojom_name, |
447 const std::string& js_bindings) | 454 const std::string& js_bindings) |
448 : mojom_name(mojom_name), js_bindings(js_bindings) {} | 455 : mojom_name(mojom_name), js_bindings(js_bindings) {} |
449 | 456 |
450 HeadlessBrowserContext::Builder::MojoBindings::~MojoBindings() {} | 457 HeadlessBrowserContext::Builder::MojoBindings::~MojoBindings() {} |
451 | 458 |
452 } // namespace headless | 459 } // namespace headless |
OLD | NEW |