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

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

Issue 2043603004: headless: Introduce a browser context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits 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_browser_main_parts.h" 5 #include "headless/lib/browser/headless_browser_main_parts.h"
6 6
7 #include "components/devtools_http_handler/devtools_http_handler.h" 7 #include "components/devtools_http_handler/devtools_http_handler.h"
8 #include "headless/lib/browser/headless_browser_context.h" 8 #include "headless/lib/browser/headless_browser_context_impl.h"
9 #include "headless/lib/browser/headless_browser_impl.h" 9 #include "headless/lib/browser/headless_browser_impl.h"
10 #include "headless/lib/browser/headless_devtools.h" 10 #include "headless/lib/browser/headless_devtools.h"
11 #include "headless/lib/browser/headless_screen.h" 11 #include "headless/lib/browser/headless_screen.h"
12 #include "ui/aura/env.h" 12 #include "ui/aura/env.h"
13 #include "ui/display/screen.h" 13 #include "ui/display/screen.h"
14 14
15 namespace headless { 15 namespace headless {
16 16
17 namespace { 17 namespace {
18 18
19 void PlatformInitialize() { 19 void PlatformInitialize() {
20 HeadlessScreen* screen = HeadlessScreen::Create(gfx::Size()); 20 HeadlessScreen* screen = HeadlessScreen::Create(gfx::Size());
21 display::Screen::SetScreenInstance(screen); 21 display::Screen::SetScreenInstance(screen);
22 } 22 }
23 23
24 void PlatformExit() { 24 void PlatformExit() {
25 } 25 }
26 26
27 } // namespace 27 } // namespace
28 28
29 HeadlessBrowserMainParts::HeadlessBrowserMainParts(HeadlessBrowserImpl* browser) 29 HeadlessBrowserMainParts::HeadlessBrowserMainParts(HeadlessBrowserImpl* browser)
30 : browser_(browser) {} 30 : browser_(browser) {}
31 31
32 HeadlessBrowserMainParts::~HeadlessBrowserMainParts() {} 32 HeadlessBrowserMainParts::~HeadlessBrowserMainParts() {}
33 33
34 void HeadlessBrowserMainParts::PreMainMessageLoopRun() { 34 void HeadlessBrowserMainParts::PreMainMessageLoopRun() {
35 browser_context_.reset(new HeadlessBrowserContext(browser_->options())); 35 browser_context_.reset(new HeadlessBrowserContextImpl(browser_->options()));
36 if (browser_->options()->devtools_endpoint.address().IsValid()) { 36 if (browser_->options()->devtools_endpoint.address().IsValid()) {
37 devtools_http_handler_ = 37 devtools_http_handler_ =
38 CreateLocalDevToolsHttpHandler(browser_context_.get()); 38 CreateLocalDevToolsHttpHandler(browser_context_.get());
39 } 39 }
40 PlatformInitialize(); 40 PlatformInitialize();
41 } 41 }
42 42
43 void HeadlessBrowserMainParts::PostMainMessageLoopRun() { 43 void HeadlessBrowserMainParts::PostMainMessageLoopRun() {
44 browser_context_.reset(); 44 browser_context_.reset();
45 devtools_http_handler_.reset(); 45 devtools_http_handler_.reset();
46 PlatformExit(); 46 PlatformExit();
47 } 47 }
48 48
49 HeadlessBrowserContext* HeadlessBrowserMainParts::browser_context() const { 49 HeadlessBrowserContextImpl* HeadlessBrowserMainParts::default_browser_context()
50 const {
50 return browser_context_.get(); 51 return browser_context_.get();
51 } 52 }
52 53
53 } // namespace headless 54 } // namespace headless
OLDNEW
« no previous file with comments | « headless/lib/browser/headless_browser_main_parts.h ('k') | headless/lib/browser/headless_devtools.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698