Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: headless/lib/browser/headless_web_contents_impl.cc

Issue 2043603004: headless: Introduce a browser context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 158
159 void HeadlessWebContentsImpl::DetachClient(HeadlessDevToolsClient* client) { 159 void HeadlessWebContentsImpl::DetachClient(HeadlessDevToolsClient* client) {
160 DCHECK(agent_host_); 160 DCHECK(agent_host_);
161 HeadlessDevToolsClientImpl::From(client)->DetachFromHost(agent_host_.get()); 161 HeadlessDevToolsClientImpl::From(client)->DetachFromHost(agent_host_.get());
162 } 162 }
163 163
164 content::WebContents* HeadlessWebContentsImpl::web_contents() const { 164 content::WebContents* HeadlessWebContentsImpl::web_contents() const {
165 return web_contents_.get(); 165 return web_contents_.get();
166 } 166 }
167 167
168 HeadlessWebContents::Builder::Builder(HeadlessBrowserImpl* browser)
169 : browser_(browser) {}
170
171 HeadlessWebContents::Builder::~Builder() = default;
172
173 HeadlessWebContents::Builder::Builder(Builder&&) = default;
174
175 HeadlessWebContents::Builder& HeadlessWebContents::Builder::SetInitialURL(
176 const GURL& initial_url) {
177 initial_url_ = initial_url;
178 return *this;
179 }
180
181 HeadlessWebContents::Builder& HeadlessWebContents::Builder::SetWindowSize(
182 const gfx::Size& size) {
183 window_size_ = size;
184 return *this;
185 }
186
187 HeadlessWebContents::Builder& HeadlessWebContents::Builder::SetBrowserContext(
188 HeadlessBrowserContext* browser_context) {
189 browser_context_ = browser_context;
190 return *this;
191 }
192
193 HeadlessWebContents* HeadlessWebContents::Builder::Build() {
194 return browser_->CreateWebContents(this);
195 }
196
168 } // namespace headless 197 } // namespace headless
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698