OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef APPS_SHELL_SHELL_BROWSER_MAIN_PARTS_H_ | |
6 #define APPS_SHELL_SHELL_BROWSER_MAIN_PARTS_H_ | |
7 | |
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" | |
13 | |
14 namespace aura { | |
15 class TestScreen; | |
16 } | |
17 | |
18 namespace content { | |
19 class ShellBrowserContext; | |
20 struct MainFunctionParams; | |
21 } | |
22 | |
23 namespace extensions { | |
24 class ShellExtensionsBrowserClient; | |
25 class ShellExtensionSystem; | |
26 } | |
27 | |
28 namespace wm { | |
29 class WMTestHelper; | |
30 } | |
31 | |
32 namespace apps { | |
33 | |
34 class ShellBrowserContext; | |
35 class ShellExtensionsClient; | |
36 | |
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(); | |
44 | |
45 ShellBrowserContext* browser_context() { | |
46 return browser_context_.get(); | |
47 } | |
48 | |
49 extensions::ShellExtensionSystem* extension_system() { | |
50 return extension_system_; | |
51 } | |
52 | |
53 // BrowserMainParts overrides. | |
54 virtual void PreEarlyInitialization() OVERRIDE; | |
55 virtual void PreMainMessageLoopStart() OVERRIDE; | |
56 virtual void PostMainMessageLoopStart() OVERRIDE; | |
57 virtual int PreCreateThreads() OVERRIDE; | |
58 virtual void PreMainMessageLoopRun() OVERRIDE; | |
59 virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; | |
60 virtual void PostMainMessageLoopRun() OVERRIDE; | |
61 | |
62 // aura::RootWindowObserver overrides: | |
63 virtual void OnWindowTreeHostCloseRequested(const aura::RootWindow* root) | |
64 OVERRIDE; | |
65 | |
66 private: | |
67 // Creates the window that hosts the apps. | |
68 void CreateRootWindow(); | |
69 | |
70 // Closes and destroys the root window hosting the app. | |
71 void DestroyRootWindow(); | |
72 | |
73 // Creates and initializes the ExtensionSystem. | |
74 void CreateExtensionSystem(); | |
75 | |
76 scoped_ptr<ShellBrowserContext> browser_context_; | |
77 scoped_ptr<ShellExtensionsClient> extensions_client_; | |
78 scoped_ptr<extensions::ShellExtensionsBrowserClient> | |
79 extensions_browser_client_; | |
80 | |
81 // Enable a minimal set of views::corewm to be initialized. | |
82 scoped_ptr<wm::WMTestHelper> wm_test_helper_; | |
83 | |
84 scoped_ptr<aura::TestScreen> test_screen_; | |
85 | |
86 // Owned by the BrowserContextKeyedService system. | |
87 extensions::ShellExtensionSystem* extension_system_; | |
88 | |
89 DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts); | |
90 }; | |
91 | |
92 } // namespace apps | |
93 | |
94 #endif // APPS_SHELL_SHELL_BROWSER_MAIN_PARTS_H_ | |
OLD | NEW |