| 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_impl.h" | 5 #include "headless/lib/browser/headless_browser_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 120 } |
| 121 | 121 |
| 122 void HeadlessBrowserImpl::set_browser_main_parts( | 122 void HeadlessBrowserImpl::set_browser_main_parts( |
| 123 HeadlessBrowserMainParts* browser_main_parts) { | 123 HeadlessBrowserMainParts* browser_main_parts) { |
| 124 DCHECK(!browser_main_parts_); | 124 DCHECK(!browser_main_parts_); |
| 125 browser_main_parts_ = browser_main_parts; | 125 browser_main_parts_ = browser_main_parts; |
| 126 } | 126 } |
| 127 | 127 |
| 128 void HeadlessBrowserImpl::RunOnStartCallback() { | 128 void HeadlessBrowserImpl::RunOnStartCallback() { |
| 129 DCHECK(aura::Env::GetInstance()); | 129 DCHECK(aura::Env::GetInstance()); |
| 130 // TODO(eseckler): allow configuration of window (viewport) size by embedder. | |
| 131 const gfx::Size kDefaultSize(800, 600); | |
| 132 window_tree_host_.reset( | 130 window_tree_host_.reset( |
| 133 aura::WindowTreeHost::Create(gfx::Rect(kDefaultSize))); | 131 aura::WindowTreeHost::Create(gfx::Rect(options()->window_size))); |
| 134 window_tree_host_->InitHost(); | 132 window_tree_host_->InitHost(); |
| 135 | 133 |
| 136 window_tree_client_.reset( | 134 window_tree_client_.reset( |
| 137 new HeadlessWindowTreeClient(window_tree_host_->window())); | 135 new HeadlessWindowTreeClient(window_tree_host_->window())); |
| 138 | 136 |
| 139 on_start_callback_.Run(this); | 137 on_start_callback_.Run(this); |
| 140 on_start_callback_ = base::Callback<void(HeadlessBrowser*)>(); | 138 on_start_callback_ = base::Callback<void(HeadlessBrowser*)>(); |
| 141 } | 139 } |
| 142 | 140 |
| 143 HeadlessWebContentsImpl* HeadlessBrowserImpl::RegisterWebContents( | 141 HeadlessWebContentsImpl* HeadlessBrowserImpl::RegisterWebContents( |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 191 |
| 194 // Child processes should not end up here. | 192 // Child processes should not end up here. |
| 195 base::CommandLine command_line(options.argc, options.argv); | 193 base::CommandLine command_line(options.argc, options.argv); |
| 196 DCHECK(!command_line.HasSwitch(switches::kProcessType)); | 194 DCHECK(!command_line.HasSwitch(switches::kProcessType)); |
| 197 #endif | 195 #endif |
| 198 return RunContentMain(std::move(options), | 196 return RunContentMain(std::move(options), |
| 199 std::move(on_browser_start_callback)); | 197 std::move(on_browser_start_callback)); |
| 200 } | 198 } |
| 201 | 199 |
| 202 } // namespace headless | 200 } // namespace headless |
| OLD | NEW |