Report errors from ChromiumEnv::GetChildren in Posix.
[chromium-blink-merge.git] / apps / shell / app_shell_browser_main_parts.cc
blobc56918d47db34f8739d0b0ed06ca69725cdd1208
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "apps/shell/app_shell_browser_main_parts.h"
7 #include "apps/shell/web_view_window.h"
8 #include "base/run_loop.h"
9 #include "content/public/common/result_codes.h"
10 #include "content/shell/browser/shell_browser_context.h"
11 #include "ui/aura/env.h"
12 #include "ui/aura/root_window.h"
13 #include "ui/aura/test/test_screen.h"
14 #include "ui/shell/minimal_shell.h"
16 namespace apps {
18 AppShellBrowserMainParts::AppShellBrowserMainParts(
19 const content::MainFunctionParams& parameters) {
22 AppShellBrowserMainParts::~AppShellBrowserMainParts() {
25 void AppShellBrowserMainParts::PreMainMessageLoopStart() {
26 // TODO(jamescook): Initialize touch here?
29 void AppShellBrowserMainParts::PostMainMessageLoopStart() {
32 void AppShellBrowserMainParts::PreEarlyInitialization() {
35 void AppShellBrowserMainParts::PreMainMessageLoopRun() {
36 // TODO(jamescook): Could initialize NetLog here to get logs from the
37 // networking stack.
38 // TODO(jamescook): Should this be an off-the-record context?
39 browser_context_.reset(new content::ShellBrowserContext(false, NULL));
41 // TODO(jamescook): Replace this with a real Screen implementation.
42 gfx::Screen::SetScreenInstance(
43 gfx::SCREEN_TYPE_NATIVE, aura::TestScreen::Create());
44 // Set up basic pieces of views::corewm.
45 minimal_shell_.reset(new shell::MinimalShell(gfx::Size(800, 600)));
46 // Ensure the X window gets mapped.
47 minimal_shell_->root_window()->ShowRootWindow();
49 // TODO(jamescook): Create an apps::ShellWindow here. For now, create a
50 // window with a WebView just to ensure that the content module is properly
51 // initialized.
52 ShowWebViewWindow(browser_context_.get(),
53 minimal_shell_->root_window());
56 bool AppShellBrowserMainParts::MainMessageLoopRun(int* result_code) {
57 base::RunLoop run_loop;
58 run_loop.Run();
59 *result_code = content::RESULT_CODE_NORMAL_EXIT;
60 return true;
63 void AppShellBrowserMainParts::PostMainMessageLoopRun() {
64 browser_context_.reset();
65 minimal_shell_.reset();
66 aura::Env::DeleteInstance();
69 } // namespace apps