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

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

Issue 2181413002: [headless] Remove default browser context. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small fixes Created 4 years, 4 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_impl.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_devtools_manager_delegate.h"
11 #include "headless/lib/browser/headless_screen.h" 12 #include "headless/lib/browser/headless_screen.h"
12 #include "ui/aura/env.h" 13 #include "ui/aura/env.h"
13 #include "ui/display/screen.h" 14 #include "ui/display/screen.h"
14 15
15 namespace headless { 16 namespace headless {
16 17
17 namespace { 18 namespace {
18 19
19 void PlatformInitialize() { 20 void PlatformInitialize() {
20 HeadlessScreen* screen = HeadlessScreen::Create(gfx::Size()); 21 HeadlessScreen* screen = HeadlessScreen::Create(gfx::Size());
21 display::Screen::SetScreenInstance(screen); 22 display::Screen::SetScreenInstance(screen);
22 } 23 }
23 24
24 void PlatformExit() { 25 void PlatformExit() {
25 } 26 }
26 27
27 } // namespace 28 } // namespace
28 29
29 HeadlessBrowserMainParts::HeadlessBrowserMainParts(HeadlessBrowserImpl* browser) 30 HeadlessBrowserMainParts::HeadlessBrowserMainParts(HeadlessBrowserImpl* browser)
30 : browser_(browser) {} 31 : browser_(browser) {}
31 32
32 HeadlessBrowserMainParts::~HeadlessBrowserMainParts() {} 33 HeadlessBrowserMainParts::~HeadlessBrowserMainParts() {}
33 34
34 void HeadlessBrowserMainParts::PreMainMessageLoopRun() { 35 void HeadlessBrowserMainParts::PreMainMessageLoopRun() {
35 browser_context_.reset(new HeadlessBrowserContextImpl(ProtocolHandlerMap(),
36 browser_->options()));
37 if (browser_->options()->devtools_endpoint.address().IsValid()) { 36 if (browser_->options()->devtools_endpoint.address().IsValid()) {
38 devtools_http_handler_ = 37 devtools_http_handler_ =
39 CreateLocalDevToolsHttpHandler(browser_context_.get()); 38 CreateLocalDevToolsHttpHandler(browser_->options());
40 } 39 }
41 PlatformInitialize(); 40 PlatformInitialize();
42 } 41 }
43 42
44 void HeadlessBrowserMainParts::PostMainMessageLoopRun() { 43 void HeadlessBrowserMainParts::PostMainMessageLoopRun() {
45 browser_context_.reset();
46 devtools_http_handler_.reset(); 44 devtools_http_handler_.reset();
45
47 PlatformExit(); 46 PlatformExit();
48 } 47 }
49 48
50 HeadlessBrowserContextImpl* HeadlessBrowserMainParts::default_browser_context()
51 const {
52 return browser_context_.get();
53 }
54
55 } // namespace headless 49 } // namespace headless
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698