1 // Copyright 2014 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 EXTENSIONS_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_
6 #define EXTENSIONS_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 ShellDevToolsDelegate;
17 struct MainFunctionParams;
28 namespace extensions {
30 class AppWindowClient;
31 class DesktopController;
32 class ShellBrowserContext;
33 class ShellBrowserMainDelegate;
34 class ShellDeviceClient;
35 class ShellExtensionsBrowserClient;
36 class ShellExtensionsClient;
37 class ShellExtensionSystem;
38 class ShellOmahaQueryParamsDelegate;
40 #if defined(OS_CHROMEOS)
41 class ShellAudioController;
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() { return browser_context_.get(); }
54 ShellExtensionSystem* extension_system() { return extension_system_; }
56 // BrowserMainParts overrides.
57 virtual void PreEarlyInitialization() OVERRIDE;
58 virtual void PreMainMessageLoopStart() OVERRIDE;
59 virtual void PostMainMessageLoopStart() OVERRIDE;
60 virtual int PreCreateThreads() OVERRIDE;
61 virtual void PreMainMessageLoopRun() OVERRIDE;
62 virtual bool MainMessageLoopRun(int* result_code) OVERRIDE;
63 virtual void PostMainMessageLoopRun() OVERRIDE;
64 virtual void PostDestroyThreads() OVERRIDE;
67 // Creates and initializes the ExtensionSystem.
68 void CreateExtensionSystem();
70 #if defined(OS_CHROMEOS)
71 scoped_ptr<ShellNetworkController> network_controller_;
72 scoped_ptr<ShellAudioController> audio_controller_;
74 scoped_ptr<DesktopController> desktop_controller_;
75 scoped_ptr<ShellBrowserContext> browser_context_;
76 scoped_ptr<ShellDeviceClient> device_client_;
77 scoped_ptr<AppWindowClient> app_window_client_;
78 scoped_ptr<ShellExtensionsClient> extensions_client_;
79 scoped_ptr<ShellExtensionsBrowserClient> extensions_browser_client_;
80 scoped_ptr<net::NetLog> net_log_;
81 scoped_ptr<content::ShellDevToolsDelegate> devtools_delegate_;
82 scoped_ptr<ShellOmahaQueryParamsDelegate> omaha_query_params_delegate_;
84 // Owned by the KeyedService system.
85 ShellExtensionSystem* extension_system_;
87 // For running app browsertests.
88 const content::MainFunctionParams parameters_;
90 // If true, indicates the main message loop should be run
91 // in MainMessageLoopRun. If false, it has already been run.
92 bool run_message_loop_;
94 scoped_ptr<ShellBrowserMainDelegate> browser_main_delegate_;
96 DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts);
99 } // namespace extensions
101 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_