shell_browser_main_parts.h revision 5f1c94371a64b3196d4be9466099bb892df9b88e
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 ShellBrowserContext; 31class ShellBrowserMainDelegate; 32class ShellDesktopController; 33class ShellExtensionsBrowserClient; 34class ShellExtensionsClient; 35class ShellExtensionSystem; 36class ShellOmahaQueryParamsDelegate; 37 38#if defined(OS_CHROMEOS) 39class ShellNetworkController; 40#endif 41 42// Handles initialization of AppShell. 43class ShellBrowserMainParts : public content::BrowserMainParts { 44 public: 45 ShellBrowserMainParts(const content::MainFunctionParams& parameters, 46 ShellBrowserMainDelegate* browser_main_delegate); 47 virtual ~ShellBrowserMainParts(); 48 49 ShellBrowserContext* browser_context() { return browser_context_.get(); } 50 51 ShellExtensionSystem* extension_system() { return extension_system_; } 52 53 // BrowserMainParts overrides. 54 virtual void PreEarlyInitialization() OVERRIDE; 55 virtual void PreMainMessageLoopStart() OVERRIDE; 56 virtual void PostMainMessageLoopStart() OVERRIDE; 57 virtual int PreCreateThreads() OVERRIDE; 58 virtual void PreMainMessageLoopRun() OVERRIDE; 59 virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; 60 virtual void PostMainMessageLoopRun() OVERRIDE; 61 virtual void PostDestroyThreads() OVERRIDE; 62 63 private: 64 // Creates and initializes the ExtensionSystem. 65 void CreateExtensionSystem(); 66 67#if defined(OS_CHROMEOS) 68 scoped_ptr<ShellNetworkController> network_controller_; 69#endif 70 scoped_ptr<ShellDesktopController> desktop_controller_; 71 scoped_ptr<ShellBrowserContext> browser_context_; 72 scoped_ptr<ShellExtensionsClient> extensions_client_; 73 scoped_ptr<ShellExtensionsBrowserClient> extensions_browser_client_; 74 scoped_ptr<net::NetLog> net_log_; 75 scoped_ptr<content::ShellDevToolsDelegate> devtools_delegate_; 76 scoped_ptr<ShellOmahaQueryParamsDelegate> omaha_query_params_delegate_; 77 78 // Owned by the KeyedService system. 79 ShellExtensionSystem* extension_system_; 80 81 // For running app browsertests. 82 const content::MainFunctionParams parameters_; 83 84 // If true, indicates the main message loop should be run 85 // in MainMessageLoopRun. If false, it has already been run. 86 bool run_message_loop_; 87 88 scoped_ptr<ShellBrowserMainDelegate> browser_main_delegate_; 89 90 DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts); 91}; 92 93} // namespace extensions 94 95#endif // EXTENSIONS_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_ 96