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

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

Issue 1781193004: headless: Make it possible to configure an HTTP proxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finalized test. Created 4 years, 9 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_browser_impl.h" 5 #include "headless/lib/browser/headless_browser_impl.h"
6 6
7 #include "base/thread_task_runner_handle.h" 7 #include "base/thread_task_runner_handle.h"
8 #include "content/public/app/content_main.h" 8 #include "content/public/app/content_main.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 void HeadlessBrowserImpl::RunOnStartCallback() { 68 void HeadlessBrowserImpl::RunOnStartCallback() {
69 DCHECK(aura::Env::GetInstance()); 69 DCHECK(aura::Env::GetInstance());
70 window_tree_host_.reset(aura::WindowTreeHost::Create(gfx::Rect())); 70 window_tree_host_.reset(aura::WindowTreeHost::Create(gfx::Rect()));
71 window_tree_host_->InitHost(); 71 window_tree_host_->InitHost();
72 72
73 on_start_callback_.Run(this); 73 on_start_callback_.Run(this);
74 on_start_callback_ = base::Callback<void(HeadlessBrowser*)>(); 74 on_start_callback_ = base::Callback<void(HeadlessBrowser*)>();
75 } 75 }
76 76
77 void HeadlessBrowserImpl::SetOptionsForTesting(
78 const HeadlessBrowser::Options& options) {
79 options_ = options;
80 browser_context()->SetOptionsForTesting(options);
81 }
82
77 int HeadlessBrowserMain( 83 int HeadlessBrowserMain(
78 const HeadlessBrowser::Options& options, 84 const HeadlessBrowser::Options& options,
79 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback) { 85 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback) {
80 scoped_ptr<HeadlessBrowserImpl> browser( 86 scoped_ptr<HeadlessBrowserImpl> browser(
81 new HeadlessBrowserImpl(on_browser_start_callback, options)); 87 new HeadlessBrowserImpl(on_browser_start_callback, options));
82 88
83 // TODO(skyostil): Implement custom message pumps. 89 // TODO(skyostil): Implement custom message pumps.
84 DCHECK(!options.message_pump); 90 DCHECK(!options.message_pump);
85 91
86 headless::HeadlessContentMainDelegate delegate(std::move(browser)); 92 headless::HeadlessContentMainDelegate delegate(std::move(browser));
87 content::ContentMainParams params(&delegate); 93 content::ContentMainParams params(&delegate);
88 params.argc = options.argc; 94 params.argc = options.argc;
89 params.argv = options.argv; 95 params.argv = options.argv;
90 return content::ContentMain(params); 96 return content::ContentMain(params);
91 } 97 }
92 98
93 } // namespace headless 99 } // namespace headless
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698