Revert of https://codereview.chromium.org/132903003/
[chromium-blink-merge.git] / apps / shell / shell_browser_main_parts.h
blob21a11c4927c3029ec1027ecaf5eaa361fe001ee9
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"
14 namespace aura {
15 class TestScreen;
18 namespace content {
19 class ShellBrowserContext;
20 struct MainFunctionParams;
23 namespace extensions {
24 class ShellExtensionsBrowserClient;
25 class ShellExtensionSystem;
28 namespace wm {
29 class WMTestHelper;
32 namespace apps {
34 class ShellBrowserContext;
35 class ShellExtensionsClient;
37 // Handles initialization of AppShell.
38 class ShellBrowserMainParts : public content::BrowserMainParts,
39 public aura::RootWindowObserver {
40 public:
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)
60 OVERRIDE;
62 private:
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);
88 } // namespace apps
90 #endif // APPS_SHELL_SHELL_BROWSER_MAIN_PARTS_H_