| 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_web_contents_impl.h" | 5 #include "headless/lib/browser/headless_web_contents_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 HeadlessWebContents::Observer* observer_; // Not owned. | 68 HeadlessWebContents::Observer* observer_; // Not owned. |
| 69 | 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(WebContentsObserverAdapter); | 70 DISALLOW_COPY_AND_ASSIGN(WebContentsObserverAdapter); |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 class HeadlessWebContentsImpl::Delegate : public content::WebContentsDelegate { | 73 class HeadlessWebContentsImpl::Delegate : public content::WebContentsDelegate { |
| 74 public: | 74 public: |
| 75 explicit Delegate(HeadlessBrowserContextImpl* browser_context) | 75 explicit Delegate(HeadlessBrowserContextImpl* browser_context) |
| 76 : browser_context_(browser_context) {} | 76 : browser_context_(browser_context) {} |
| 77 | 77 |
| 78 void WebContentsCreated(content::WebContents* source_contents, | 78 void WebContentsCreated( |
| 79 int opener_render_process_id, | 79 content::WebContents* source_contents, |
| 80 int opener_render_frame_id, | 80 int opener_render_process_id, |
| 81 const std::string& frame_name, | 81 int opener_render_frame_id, |
| 82 const GURL& target_url, | 82 const std::string& frame_name, |
| 83 content::WebContents* new_contents) override { | 83 const GURL& target_url, |
| 84 content::WebContents* new_contents, |
| 85 const base::Optional<content::WebContents::CreateParams>& create_params) |
| 86 override { |
| 84 std::unique_ptr<HeadlessWebContentsImpl> web_contents = | 87 std::unique_ptr<HeadlessWebContentsImpl> web_contents = |
| 85 HeadlessWebContentsImpl::CreateFromWebContents(new_contents, | 88 HeadlessWebContentsImpl::CreateFromWebContents(new_contents, |
| 86 browser_context_); | 89 browser_context_); |
| 87 | 90 |
| 88 DCHECK(new_contents->GetBrowserContext() == browser_context_); | 91 DCHECK(new_contents->GetBrowserContext() == browser_context_); |
| 89 | 92 |
| 90 browser_context_->RegisterWebContents(std::move(web_contents)); | 93 browser_context_->RegisterWebContents(std::move(web_contents)); |
| 91 } | 94 } |
| 92 | 95 |
| 93 #if !defined(CHROME_MULTIPLE_DLL_CHILD) | 96 #if !defined(CHROME_MULTIPLE_DLL_CHILD) |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 HeadlessWebContents::Builder::MojoService::MojoService() {} | 409 HeadlessWebContents::Builder::MojoService::MojoService() {} |
| 407 | 410 |
| 408 HeadlessWebContents::Builder::MojoService::MojoService( | 411 HeadlessWebContents::Builder::MojoService::MojoService( |
| 409 const std::string& service_name, | 412 const std::string& service_name, |
| 410 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory) | 413 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory) |
| 411 : service_name(service_name), service_factory(service_factory) {} | 414 : service_name(service_name), service_factory(service_factory) {} |
| 412 | 415 |
| 413 HeadlessWebContents::Builder::MojoService::~MojoService() {} | 416 HeadlessWebContents::Builder::MojoService::~MojoService() {} |
| 414 | 417 |
| 415 } // namespace headless | 418 } // namespace headless |
| OLD | NEW |