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_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_
6 #define APPS_SHELL_BROWSER_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 "content/public/common/main_function_params.h"
13 #include "ui/aura/window_tree_host_observer.h"
16 class ShellBrowserContext;
17 class ShellDevToolsDelegate;
18 struct MainFunctionParams;
21 namespace extensions {
22 class ShellExtensionsBrowserClient;
23 class ShellExtensionSystem;
36 class ShellBrowserContext;
37 class ShellBrowserMainDelegate;
38 class ShellDesktopController;
39 class ShellExtensionsClient;
41 #if defined(OS_CHROMEOS)
42 class ShellNetworkController;
45 // Handles initialization of AppShell.
46 class ShellBrowserMainParts : public content::BrowserMainParts {
48 ShellBrowserMainParts(const content::MainFunctionParams& parameters,
49 ShellBrowserMainDelegate* browser_main_delegate);
50 virtual ~ShellBrowserMainParts();
52 ShellBrowserContext* browser_context() {
53 return browser_context_.get();
56 extensions::ShellExtensionSystem* extension_system() {
57 return extension_system_;
60 // BrowserMainParts overrides.
61 virtual void PreEarlyInitialization() OVERRIDE;
62 virtual void PreMainMessageLoopStart() OVERRIDE;
63 virtual void PostMainMessageLoopStart() OVERRIDE;
64 virtual int PreCreateThreads() OVERRIDE;
65 virtual void PreMainMessageLoopRun() OVERRIDE;
66 virtual bool MainMessageLoopRun(int* result_code) OVERRIDE;
67 virtual void PostMainMessageLoopRun() OVERRIDE;
68 virtual void PostDestroyThreads() OVERRIDE;
71 // Creates and initializes the ExtensionSystem.
72 void CreateExtensionSystem();
74 #if defined(OS_CHROMEOS)
75 scoped_ptr<ShellNetworkController> network_controller_;
77 scoped_ptr<ShellDesktopController> desktop_controller_;
78 scoped_ptr<ShellBrowserContext> browser_context_;
79 scoped_ptr<ShellExtensionsClient> extensions_client_;
80 scoped_ptr<extensions::ShellExtensionsBrowserClient>
81 extensions_browser_client_;
82 scoped_ptr<net::NetLog> net_log_;
84 scoped_ptr<content::ShellDevToolsDelegate> devtools_delegate_;
86 // Owned by the KeyedService system.
87 extensions::ShellExtensionSystem* extension_system_;
89 // For running app browsertests.
90 const content::MainFunctionParams parameters_;
92 // If true, indicates the main message loop should be run
93 // in MainMessageLoopRun. If false, it has already been run.
94 bool run_message_loop_;
96 scoped_ptr<ShellBrowserMainDelegate> browser_main_delegate_;
98 DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts);
103 #endif // APPS_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_