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_main_parts.h" | 5 #include "headless/lib/browser/headless_browser_main_parts.h" |
6 | 6 |
7 #include "headless/lib/browser/headless_browser_context_impl.h" | 7 #include "headless/lib/browser/headless_browser_context_impl.h" |
8 #include "headless/lib/browser/headless_browser_impl.h" | 8 #include "headless/lib/browser/headless_browser_impl.h" |
9 #include "headless/lib/browser/headless_devtools.h" | 9 #include "headless/lib/browser/headless_devtools.h" |
10 #include "headless/lib/browser/headless_screen.h" | 10 #include "headless/lib/browser/headless_screen.h" |
11 #include "ui/aura/env.h" | |
12 #include "ui/display/screen.h" | |
13 | 11 |
14 namespace headless { | 12 namespace headless { |
15 | 13 |
16 namespace { | 14 namespace { |
17 | 15 |
18 void PlatformInitialize(const gfx::Size& screen_size) { | |
19 HeadlessScreen* screen = HeadlessScreen::Create(screen_size); | |
20 display::Screen::SetScreenInstance(screen); | |
21 } | |
22 | |
23 void PlatformExit() { | 16 void PlatformExit() { |
Eric Seckler
2017/02/09 18:29:39
Shall we move this into BrowserImpl as well - seem
dvallet
2017/02/10 05:12:20
I'll clean it for now, afaik is not needed in Mac
| |
24 } | 17 } |
25 | 18 |
26 } // namespace | 19 } // namespace |
27 | 20 |
28 HeadlessBrowserMainParts::HeadlessBrowserMainParts(HeadlessBrowserImpl* browser) | 21 HeadlessBrowserMainParts::HeadlessBrowserMainParts(HeadlessBrowserImpl* browser) |
29 : browser_(browser) | 22 : browser_(browser) |
30 , devtools_http_handler_started_(false) {} | 23 , devtools_http_handler_started_(false) {} |
31 | 24 |
32 HeadlessBrowserMainParts::~HeadlessBrowserMainParts() {} | 25 HeadlessBrowserMainParts::~HeadlessBrowserMainParts() {} |
33 | 26 |
34 void HeadlessBrowserMainParts::PreMainMessageLoopRun() { | 27 void HeadlessBrowserMainParts::PreMainMessageLoopRun() { |
35 if (browser_->options()->devtools_endpoint.address().IsValid()) { | 28 if (browser_->options()->devtools_endpoint.address().IsValid()) { |
36 StartLocalDevToolsHttpHandler(browser_->options()); | 29 StartLocalDevToolsHttpHandler(browser_->options()); |
37 devtools_http_handler_started_ = true; | 30 devtools_http_handler_started_ = true; |
38 } | 31 } |
39 PlatformInitialize(browser_->options()->window_size); | 32 browser_->PlatformInitialize(); |
40 } | 33 } |
41 | 34 |
42 void HeadlessBrowserMainParts::PostMainMessageLoopRun() { | 35 void HeadlessBrowserMainParts::PostMainMessageLoopRun() { |
43 if (devtools_http_handler_started_) { | 36 if (devtools_http_handler_started_) { |
44 StopLocalDevToolsHttpHandler(); | 37 StopLocalDevToolsHttpHandler(); |
45 devtools_http_handler_started_ = false; | 38 devtools_http_handler_started_ = false; |
46 } | 39 } |
47 PlatformExit(); | 40 PlatformExit(); |
48 } | 41 } |
49 | 42 |
50 } // namespace headless | 43 } // namespace headless |
OLD | NEW |