| 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 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 | 199 |
| 200 bool HeadlessWebContentsImpl::OpenURL(const GURL& url) { | 200 bool HeadlessWebContentsImpl::OpenURL(const GURL& url) { |
| 201 if (!url.is_valid()) | 201 if (!url.is_valid()) |
| 202 return false; | 202 return false; |
| 203 content::NavigationController::LoadURLParams params(url); | 203 content::NavigationController::LoadURLParams params(url); |
| 204 params.transition_type = ui::PageTransitionFromInt( | 204 params.transition_type = ui::PageTransitionFromInt( |
| 205 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); | 205 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); |
| 206 web_contents_->GetController().LoadURLWithParams(params); | 206 web_contents_->GetController().LoadURLWithParams(params); |
| 207 web_contents_delegate_->ActivateContents(web_contents_.get()); |
| 207 web_contents_->Focus(); | 208 web_contents_->Focus(); |
| 208 return true; | 209 return true; |
| 209 } | 210 } |
| 210 | 211 |
| 211 void HeadlessWebContentsImpl::Close() { | 212 void HeadlessWebContentsImpl::Close() { |
| 212 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 213 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 213 browser_context()->DestroyWebContents(this); | 214 browser_context()->DestroyWebContents(this); |
| 214 } | 215 } |
| 215 | 216 |
| 216 std::string HeadlessWebContentsImpl::GetDevToolsAgentHostId() { | 217 std::string HeadlessWebContentsImpl::GetDevToolsAgentHostId() { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 HeadlessWebContents::Builder::MojoService::MojoService() {} | 319 HeadlessWebContents::Builder::MojoService::MojoService() {} |
| 319 | 320 |
| 320 HeadlessWebContents::Builder::MojoService::MojoService( | 321 HeadlessWebContents::Builder::MojoService::MojoService( |
| 321 const std::string& service_name, | 322 const std::string& service_name, |
| 322 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory) | 323 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory) |
| 323 : service_name(service_name), service_factory(service_factory) {} | 324 : service_name(service_name), service_factory(service_factory) {} |
| 324 | 325 |
| 325 HeadlessWebContents::Builder::MojoService::~MojoService() {} | 326 HeadlessWebContents::Builder::MojoService::~MojoService() {} |
| 326 | 327 |
| 327 } // namespace headless | 328 } // namespace headless |
| OLD | NEW |