| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_ | 5 #ifndef CONTENT_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_ |
| 6 #define CONTENT_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_ | 6 #define CONTENT_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "content/public/browser/browser_main_parts.h" | 12 #include "content/public/browser/browser_main_parts.h" |
| 13 #include "content/public/common/main_function_params.h" | 13 #include "content/public/common/main_function_params.h" |
| 14 #include "content/shell/browser/shell_browser_context.h" | 14 #include "content/shell/browser/shell_browser_context.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class Thread; | 17 class Thread; |
| 18 } | 18 } |
| 19 | 19 |
| 20 #if defined(OS_ANDROID) | 20 #if defined(OS_ANDROID) |
| 21 namespace breakpad { | 21 namespace breakpad { |
| 22 class CrashDumpManager; | 22 class CrashDumpManager; |
| 23 } | 23 } |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 namespace devtools_http_handler { | |
| 27 class DevToolsHttpHandler; | |
| 28 } | |
| 29 | |
| 30 namespace net { | 26 namespace net { |
| 31 class NetLog; | 27 class NetLog; |
| 32 } | 28 } |
| 33 | 29 |
| 34 namespace content { | 30 namespace content { |
| 35 | 31 |
| 36 class ShellBrowserMainParts : public BrowserMainParts { | 32 class ShellBrowserMainParts : public BrowserMainParts { |
| 37 public: | 33 public: |
| 38 explicit ShellBrowserMainParts(const MainFunctionParams& parameters); | 34 explicit ShellBrowserMainParts(const MainFunctionParams& parameters); |
| 39 ~ShellBrowserMainParts() override; | 35 ~ShellBrowserMainParts() override; |
| 40 | 36 |
| 41 // BrowserMainParts overrides. | 37 // BrowserMainParts overrides. |
| 42 void PreEarlyInitialization() override; | 38 void PreEarlyInitialization() override; |
| 43 #if defined(OS_ANDROID) | 39 #if defined(OS_ANDROID) |
| 44 int PreCreateThreads() override; | 40 int PreCreateThreads() override; |
| 45 #endif | 41 #endif |
| 46 void PreMainMessageLoopStart() override; | 42 void PreMainMessageLoopStart() override; |
| 47 void PostMainMessageLoopStart() override; | 43 void PostMainMessageLoopStart() override; |
| 48 void PreMainMessageLoopRun() override; | 44 void PreMainMessageLoopRun() override; |
| 49 bool MainMessageLoopRun(int* result_code) override; | 45 bool MainMessageLoopRun(int* result_code) override; |
| 50 void PostMainMessageLoopRun() override; | 46 void PostMainMessageLoopRun() override; |
| 51 void PostDestroyThreads() override; | 47 void PostDestroyThreads() override; |
| 52 | 48 |
| 53 devtools_http_handler::DevToolsHttpHandler* devtools_http_handler() { | |
| 54 return devtools_http_handler_.get(); | |
| 55 } | |
| 56 | |
| 57 ShellBrowserContext* browser_context() { return browser_context_.get(); } | 49 ShellBrowserContext* browser_context() { return browser_context_.get(); } |
| 58 ShellBrowserContext* off_the_record_browser_context() { | 50 ShellBrowserContext* off_the_record_browser_context() { |
| 59 return off_the_record_browser_context_.get(); | 51 return off_the_record_browser_context_.get(); |
| 60 } | 52 } |
| 61 | 53 |
| 62 net::NetLog* net_log() { return net_log_.get(); } | 54 net::NetLog* net_log() { return net_log_.get(); } |
| 63 | 55 |
| 64 protected: | 56 protected: |
| 65 virtual void InitializeBrowserContexts(); | 57 virtual void InitializeBrowserContexts(); |
| 66 virtual void InitializeMessageLoopContext(); | 58 virtual void InitializeMessageLoopContext(); |
| 67 | 59 |
| 68 void set_browser_context(ShellBrowserContext* context) { | 60 void set_browser_context(ShellBrowserContext* context) { |
| 69 browser_context_.reset(context); | 61 browser_context_.reset(context); |
| 70 } | 62 } |
| 71 void set_off_the_record_browser_context(ShellBrowserContext* context) { | 63 void set_off_the_record_browser_context(ShellBrowserContext* context) { |
| 72 off_the_record_browser_context_.reset(context); | 64 off_the_record_browser_context_.reset(context); |
| 73 } | 65 } |
| 74 | 66 |
| 75 private: | 67 private: |
| 76 std::unique_ptr<net::NetLog> net_log_; | 68 std::unique_ptr<net::NetLog> net_log_; |
| 77 std::unique_ptr<ShellBrowserContext> browser_context_; | 69 std::unique_ptr<ShellBrowserContext> browser_context_; |
| 78 std::unique_ptr<ShellBrowserContext> off_the_record_browser_context_; | 70 std::unique_ptr<ShellBrowserContext> off_the_record_browser_context_; |
| 79 | 71 |
| 80 // For running content_browsertests. | 72 // For running content_browsertests. |
| 81 const MainFunctionParams parameters_; | 73 const MainFunctionParams parameters_; |
| 82 bool run_message_loop_; | 74 bool run_message_loop_; |
| 83 | 75 |
| 84 std::unique_ptr<devtools_http_handler::DevToolsHttpHandler> | |
| 85 devtools_http_handler_; | |
| 86 | |
| 87 #if defined(OS_ANDROID) | 76 #if defined(OS_ANDROID) |
| 88 std::unique_ptr<breakpad::CrashDumpManager> crash_dump_manager_; | 77 std::unique_ptr<breakpad::CrashDumpManager> crash_dump_manager_; |
| 89 #endif | 78 #endif |
| 90 | 79 |
| 91 DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts); | 80 DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts); |
| 92 }; | 81 }; |
| 93 | 82 |
| 94 } // namespace content | 83 } // namespace content |
| 95 | 84 |
| 96 #endif // CONTENT_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_ | 85 #endif // CONTENT_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_ |
| OLD | NEW |