[DevTools] Fixed double delete of ShellDevToolsDelegate
[chromium-blink-merge.git] / content / shell / browser / shell_browser_main_parts.h
blob014ae7f4a4bc0f9b2526bd95481c7fa6371537c3
1 // Copyright 2013 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 CONTENT_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_
6 #define CONTENT_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "content/public/browser/browser_main_parts.h"
11 #include "content/public/common/main_function_params.h"
12 #include "content/shell/browser/shell_browser_context.h"
14 #if defined(OS_ANDROID)
15 namespace breakpad {
16 class CrashDumpManager;
18 #endif
20 namespace base {
21 class Thread;
24 namespace net {
25 class NetLog;
28 namespace content {
30 class DevToolsHttpHandler;
32 class ShellBrowserMainParts : public BrowserMainParts {
33 public:
34 explicit ShellBrowserMainParts(const MainFunctionParams& parameters);
35 ~ShellBrowserMainParts() override;
37 // BrowserMainParts overrides.
38 void PreEarlyInitialization() override;
39 void PreMainMessageLoopStart() override;
40 void PostMainMessageLoopStart() override;
41 void PreMainMessageLoopRun() override;
42 bool MainMessageLoopRun(int* result_code) override;
43 void PostMainMessageLoopRun() override;
45 DevToolsHttpHandler* devtools_http_handler() {
46 return devtools_http_handler_;
49 ShellBrowserContext* browser_context() { return browser_context_.get(); }
50 ShellBrowserContext* off_the_record_browser_context() {
51 return off_the_record_browser_context_.get();
54 net::NetLog* net_log() { return net_log_.get(); }
56 protected:
57 virtual void InitializeBrowserContexts();
58 virtual void InitializeMessageLoopContext();
60 void set_browser_context(ShellBrowserContext* context) {
61 browser_context_.reset(context);
63 void set_off_the_record_browser_context(ShellBrowserContext* context) {
64 off_the_record_browser_context_.reset(context);
67 private:
68 #if defined(OS_ANDROID)
69 scoped_ptr<breakpad::CrashDumpManager> crash_dump_manager_;
70 #endif
71 scoped_ptr<net::NetLog> net_log_;
72 scoped_ptr<ShellBrowserContext> browser_context_;
73 scoped_ptr<ShellBrowserContext> off_the_record_browser_context_;
75 // For running content_browsertests.
76 const MainFunctionParams parameters_;
77 bool run_message_loop_;
79 DevToolsHttpHandler* devtools_http_handler_;
81 DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts);
84 } // namespace content
86 #endif // CONTENT_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_