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 "base/task/cancelable_task_tracker.h"
12 #include "content/public/browser/browser_main_parts.h"
13 #include "content/public/common/main_function_params.h"
14 #include "ui/aura/window_tree_host_observer.h"
17 class DevToolsHttpHandler
;
18 struct MainFunctionParams
;
29 namespace extensions
{
31 class AppWindowClient
;
32 class DesktopController
;
33 class ShellBrowserContext
;
34 class ShellBrowserMainDelegate
;
35 class ShellDeviceClient
;
36 class ShellExtensionsBrowserClient
;
37 class ShellExtensionsClient
;
38 class ShellExtensionSystem
;
39 class ShellOAuth2TokenService
;
40 class ShellOmahaQueryParamsDelegate
;
42 #if defined(OS_CHROMEOS)
43 class ShellAudioController
;
44 class ShellNetworkController
;
47 // Handles initialization of AppShell.
48 class ShellBrowserMainParts
: public content::BrowserMainParts
{
50 ShellBrowserMainParts(const content::MainFunctionParams
& parameters
,
51 ShellBrowserMainDelegate
* browser_main_delegate
);
52 ~ShellBrowserMainParts() override
;
54 ShellBrowserContext
* browser_context() { return browser_context_
.get(); }
56 ShellExtensionSystem
* extension_system() { return extension_system_
; }
58 // BrowserMainParts overrides.
59 void PreEarlyInitialization() override
;
60 void PreMainMessageLoopStart() override
;
61 void PostMainMessageLoopStart() override
;
62 int PreCreateThreads() override
;
63 void PreMainMessageLoopRun() override
;
64 bool MainMessageLoopRun(int* result_code
) override
;
65 void PostMainMessageLoopRun() override
;
66 void PostDestroyThreads() override
;
69 // Creates and initializes the ExtensionSystem.
70 void CreateExtensionSystem();
72 #if defined(OS_CHROMEOS)
73 scoped_ptr
<ShellNetworkController
> network_controller_
;
74 scoped_ptr
<ShellAudioController
> audio_controller_
;
76 scoped_ptr
<DesktopController
> desktop_controller_
;
77 scoped_ptr
<ShellBrowserContext
> browser_context_
;
78 scoped_ptr
<ShellDeviceClient
> device_client_
;
79 scoped_ptr
<AppWindowClient
> app_window_client_
;
80 scoped_ptr
<ShellExtensionsClient
> extensions_client_
;
81 scoped_ptr
<ShellExtensionsBrowserClient
> extensions_browser_client_
;
82 scoped_ptr
<net::NetLog
> net_log_
;
83 content::DevToolsHttpHandler
* devtools_http_handler_
;
84 scoped_ptr
<ShellOmahaQueryParamsDelegate
> omaha_query_params_delegate_
;
85 scoped_ptr
<ShellOAuth2TokenService
> oauth2_token_service_
;
87 // Owned by the KeyedService system.
88 ShellExtensionSystem
* extension_system_
;
90 // For running app browsertests.
91 const content::MainFunctionParams parameters_
;
93 // If true, indicates the main message loop should be run
94 // in MainMessageLoopRun. If false, it has already been run.
95 bool run_message_loop_
;
97 scoped_ptr
<ShellBrowserMainDelegate
> browser_main_delegate_
;
99 #if !defined(DISABLE_NACL)
100 base::CancelableTaskTracker task_tracker_
;
103 DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts
);
106 } // namespace extensions
108 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_