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> | |
8 | |
7 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
8 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
9 #include "content/public/app/content_main.h" | 11 #include "content/public/app/content_main.h" |
10 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
11 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
12 #include "headless/lib/browser/headless_browser_context.h" | 14 #include "headless/lib/browser/headless_browser_context.h" |
13 #include "headless/lib/browser/headless_browser_main_parts.h" | 15 #include "headless/lib/browser/headless_browser_main_parts.h" |
14 #include "headless/lib/browser/headless_web_contents_impl.h" | 16 #include "headless/lib/browser/headless_web_contents_impl.h" |
15 #include "headless/lib/browser/headless_window_tree_client.h" | 17 #include "headless/lib/browser/headless_window_tree_client.h" |
16 #include "headless/lib/headless_content_main_delegate.h" | 18 #include "headless/lib/headless_content_main_delegate.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 } | 82 } |
81 | 83 |
82 void HeadlessBrowserImpl::set_browser_main_parts( | 84 void HeadlessBrowserImpl::set_browser_main_parts( |
83 HeadlessBrowserMainParts* browser_main_parts) { | 85 HeadlessBrowserMainParts* browser_main_parts) { |
84 DCHECK(!browser_main_parts_); | 86 DCHECK(!browser_main_parts_); |
85 browser_main_parts_ = browser_main_parts; | 87 browser_main_parts_ = browser_main_parts; |
86 } | 88 } |
87 | 89 |
88 void HeadlessBrowserImpl::RunOnStartCallback() { | 90 void HeadlessBrowserImpl::RunOnStartCallback() { |
89 DCHECK(aura::Env::GetInstance()); | 91 DCHECK(aura::Env::GetInstance()); |
90 window_tree_host_.reset(aura::WindowTreeHost::Create(gfx::Rect())); | 92 // TODO(eseckler): allow configuration of window (viewport) size by embedder |
Sami
2016/06/02 18:01:33
nit: end comments with a period.
Eric Seckler
2016/06/03 11:30:40
Done.
| |
93 const gfx::Size kDefaultSize(800, 600); | |
94 window_tree_host_.reset( | |
95 aura::WindowTreeHost::Create(gfx::Rect(kDefaultSize))); | |
91 window_tree_host_->InitHost(); | 96 window_tree_host_->InitHost(); |
92 | 97 |
93 window_tree_client_.reset( | 98 window_tree_client_.reset( |
94 new HeadlessWindowTreeClient(window_tree_host_->window())); | 99 new HeadlessWindowTreeClient(window_tree_host_->window())); |
95 | 100 |
96 on_start_callback_.Run(this); | 101 on_start_callback_.Run(this); |
97 on_start_callback_ = base::Callback<void(HeadlessBrowser*)>(); | 102 on_start_callback_ = base::Callback<void(HeadlessBrowser*)>(); |
98 } | 103 } |
99 | 104 |
100 HeadlessWebContentsImpl* HeadlessBrowserImpl::RegisterWebContents( | 105 HeadlessWebContentsImpl* HeadlessBrowserImpl::RegisterWebContents( |
(...skipping 27 matching lines...) Expand all Loading... | |
128 DCHECK(!options.message_pump); | 133 DCHECK(!options.message_pump); |
129 | 134 |
130 std::unique_ptr<HeadlessBrowserImpl> browser( | 135 std::unique_ptr<HeadlessBrowserImpl> browser( |
131 new HeadlessBrowserImpl(on_browser_start_callback, std::move(options))); | 136 new HeadlessBrowserImpl(on_browser_start_callback, std::move(options))); |
132 headless::HeadlessContentMainDelegate delegate(std::move(browser)); | 137 headless::HeadlessContentMainDelegate delegate(std::move(browser)); |
133 params.delegate = &delegate; | 138 params.delegate = &delegate; |
134 return content::ContentMain(params); | 139 return content::ContentMain(params); |
135 } | 140 } |
136 | 141 |
137 } // namespace headless | 142 } // namespace headless |
OLD | NEW |