[DevTools] Fixed double delete of ShellDevToolsDelegate
[chromium-blink-merge.git] / extensions / shell / browser / shell_browser_main_parts.h
blobdab402c1c04c06c7a4609bd5c2bdd68f161b756c
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"
16 namespace content {
17 class DevToolsHttpHandler;
18 struct MainFunctionParams;
21 namespace views {
22 class Widget;
25 namespace net {
26 class NetLog;
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;
45 #endif
47 // Handles initialization of AppShell.
48 class ShellBrowserMainParts : public content::BrowserMainParts {
49 public:
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;
68 private:
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_;
75 #endif
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_;
101 #endif
103 DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts);
106 } // namespace extensions
108 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_