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 #ifndef APPS_SHELL_SHELL_BROWSER_MAIN_PARTS_H_
6 #define APPS_SHELL_SHELL_BROWSER_MAIN_PARTS_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "content/public/browser/browser_main_parts.h"
12 #include "ui/aura/root_window_observer.h"
19 class ShellBrowserContext
;
20 struct MainFunctionParams
;
23 namespace extensions
{
24 class ShellExtensionsBrowserClient
;
25 class ShellExtensionSystem
;
34 class ShellBrowserContext
;
35 class ShellExtensionsClient
;
37 // Handles initialization of AppShell.
38 class ShellBrowserMainParts
: public content::BrowserMainParts
,
39 public aura::RootWindowObserver
{
41 explicit ShellBrowserMainParts(
42 const content::MainFunctionParams
& parameters
);
43 virtual ~ShellBrowserMainParts();
45 ShellBrowserContext
* browser_context() {
46 return browser_context_
.get();
49 // BrowserMainParts overrides.
50 virtual void PreEarlyInitialization() OVERRIDE
;
51 virtual void PreMainMessageLoopStart() OVERRIDE
;
52 virtual void PostMainMessageLoopStart() OVERRIDE
;
53 virtual int PreCreateThreads() OVERRIDE
;
54 virtual void PreMainMessageLoopRun() OVERRIDE
;
55 virtual bool MainMessageLoopRun(int* result_code
) OVERRIDE
;
56 virtual void PostMainMessageLoopRun() OVERRIDE
;
58 // aura::RootWindowObserver overrides:
59 virtual void OnWindowTreeHostCloseRequested(const aura::RootWindow
* root
)
63 // Creates the window that hosts the apps.
64 void CreateRootWindow();
66 // Closes and destroys the root window hosting the app.
67 void DestroyRootWindow();
69 // Creates and initializes the ExtensionSystem.
70 void CreateExtensionSystem();
72 scoped_ptr
<ShellBrowserContext
> browser_context_
;
73 scoped_ptr
<ShellExtensionsClient
> extensions_client_
;
74 scoped_ptr
<extensions::ShellExtensionsBrowserClient
>
75 extensions_browser_client_
;
77 // Enable a minimal set of views::corewm to be initialized.
78 scoped_ptr
<wm::WMTestHelper
> wm_test_helper_
;
80 scoped_ptr
<aura::TestScreen
> test_screen_
;
82 // Owned by the BrowserContextKeyedService system.
83 extensions::ShellExtensionSystem
* extension_system_
;
85 DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts
);
90 #endif // APPS_SHELL_SHELL_BROWSER_MAIN_PARTS_H_