shell_browser_main_parts.h revision 1320f92c476a1ad9d19dba2a48c72b75566198e9
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 15namespace content { 16class ShellDevToolsDelegate; 17struct MainFunctionParams; 18} 19 20namespace views { 21class Widget; 22} 23 24namespace net { 25class NetLog; 26} 27 28namespace extensions { 29 30class AppWindowClient; 31class DesktopController; 32class ShellBrowserContext; 33class ShellBrowserMainDelegate; 34class ShellDeviceClient; 35class ShellExtensionsBrowserClient; 36class ShellExtensionsClient; 37class ShellExtensionSystem; 38class ShellOmahaQueryParamsDelegate; 39 40#if defined(OS_CHROMEOS) 41class ShellAudioController; 42class ShellNetworkController; 43#endif 44 45// Handles initialization of AppShell. 46class 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_ 102