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/lib/browser/headless_browser_context_options.h" | 18 #include "headless/lib/browser/headless_browser_context_options.h" |
19 #include "headless/lib/browser/headless_browser_impl.h" | 19 #include "headless/lib/browser/headless_browser_impl.h" |
20 #include "headless/lib/browser/headless_url_request_context_getter.h" | 20 #include "headless/lib/browser/headless_url_request_context_getter.h" |
21 #include "headless/public/util/black_hole_protocol_handler.h" | 21 #include "headless/public/util/black_hole_protocol_handler.h" |
22 #include "headless/public/util/in_memory_protocol_handler.h" | 22 #include "headless/public/util/in_memory_protocol_handler.h" |
23 #include "net/url_request/url_request_context.h" | 23 #include "net/url_request/url_request_context.h" |
24 #include "ui/aura/window_tree_host.h" | |
25 | 24 |
26 namespace headless { | 25 namespace headless { |
27 | 26 |
28 namespace { | 27 namespace { |
29 const char kHeadlessMojomProtocol[] = "headless-mojom"; | 28 const char kHeadlessMojomProtocol[] = "headless-mojom"; |
30 } | 29 } |
31 | 30 |
32 // Contains net::URLRequestContextGetter required for resource loading. | 31 // Contains net::URLRequestContextGetter required for resource loading. |
33 // Must be destructed on the IO thread as per content::ResourceContext | 32 // Must be destructed on the IO thread as per content::ResourceContext |
34 // requirements. | 33 // requirements. |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 const base::FilePath& partition_path, | 241 const base::FilePath& partition_path, |
243 bool in_memory) { | 242 bool in_memory) { |
244 return nullptr; | 243 return nullptr; |
245 } | 244 } |
246 | 245 |
247 HeadlessWebContents* HeadlessBrowserContextImpl::CreateWebContents( | 246 HeadlessWebContents* HeadlessBrowserContextImpl::CreateWebContents( |
248 HeadlessWebContents::Builder* builder) { | 247 HeadlessWebContents::Builder* builder) { |
249 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 248 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
250 | 249 |
251 std::unique_ptr<HeadlessWebContentsImpl> headless_web_contents = | 250 std::unique_ptr<HeadlessWebContentsImpl> headless_web_contents = |
252 HeadlessWebContentsImpl::Create(builder, | 251 HeadlessWebContentsImpl::Create(builder); |
253 browser()->window_tree_host()->window()); | |
254 | 252 |
255 if (!headless_web_contents) { | 253 if (!headless_web_contents) { |
256 return nullptr; | 254 return nullptr; |
257 } | 255 } |
258 | 256 |
259 HeadlessWebContents* result = headless_web_contents.get(); | 257 HeadlessWebContents* result = headless_web_contents.get(); |
260 | 258 |
261 RegisterWebContents(std::move(headless_web_contents)); | 259 RegisterWebContents(std::move(headless_web_contents)); |
262 | 260 |
263 return result; | 261 return result; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 HeadlessBrowserContext::Builder::MojoBindings::MojoBindings() {} | 405 HeadlessBrowserContext::Builder::MojoBindings::MojoBindings() {} |
408 | 406 |
409 HeadlessBrowserContext::Builder::MojoBindings::MojoBindings( | 407 HeadlessBrowserContext::Builder::MojoBindings::MojoBindings( |
410 const std::string& mojom_name, | 408 const std::string& mojom_name, |
411 const std::string& js_bindings) | 409 const std::string& js_bindings) |
412 : mojom_name(mojom_name), js_bindings(js_bindings) {} | 410 : mojom_name(mojom_name), js_bindings(js_bindings) {} |
413 | 411 |
414 HeadlessBrowserContext::Builder::MojoBindings::~MojoBindings() {} | 412 HeadlessBrowserContext::Builder::MojoBindings::~MojoBindings() {} |
415 | 413 |
416 } // namespace headless | 414 } // namespace headless |
OLD | NEW |