Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / extensions / shell / browser / shell_browser_main_parts.h
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.
4
5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_
6 #define EXTENSIONS_SHELL_BROWSER_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 "content/public/common/main_function_params.h"
13 #include "ui/aura/window_tree_host_observer.h"
14
15 namespace content {
16 class ShellDevToolsDelegate;
17 struct MainFunctionParams;
18 }
19
20 namespace views {
21 class Widget;
22 }
23
24 namespace net {
25 class NetLog;
26 }
27
28 namespace extensions {
29
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;
39
40 #if defined(OS_CHROMEOS)
41 class ShellAudioController;
42 class ShellNetworkController;
43 #endif
44
45 // Handles initialization of AppShell.
46 class ShellBrowserMainParts : public content::BrowserMainParts {
47  public:
48   ShellBrowserMainParts(const content::MainFunctionParams& parameters,
49                         ShellBrowserMainDelegate* browser_main_delegate);
50   virtual ~ShellBrowserMainParts();
51
52   ShellBrowserContext* browser_context() { return browser_context_.get(); }
53
54   ShellExtensionSystem* extension_system() { return extension_system_; }
55
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;
65
66  private:
67   // Creates and initializes the ExtensionSystem.
68   void CreateExtensionSystem();
69
70 #if defined(OS_CHROMEOS)
71   scoped_ptr<ShellNetworkController> network_controller_;
72   scoped_ptr<ShellAudioController> audio_controller_;
73 #endif
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_;
83
84   // Owned by the KeyedService system.
85   ShellExtensionSystem* extension_system_;
86
87   // For running app browsertests.
88   const content::MainFunctionParams parameters_;
89
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_;
93
94   scoped_ptr<ShellBrowserMainDelegate> browser_main_delegate_;
95
96   DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts);
97 };
98
99 }  // namespace extensions
100
101 #endif  // EXTENSIONS_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_