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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "content/public/browser/browser_main_parts.h" | 10 #include "content/public/browser/browser_main_parts.h" |
11 #include "content/public/common/main_function_params.h" | 11 #include "content/public/common/main_function_params.h" |
| 12 #include "content/shell/browser/shell_browser_context.h" |
12 | 13 |
13 #if defined(OS_ANDROID) | 14 #if defined(OS_ANDROID) |
14 namespace breakpad { | 15 namespace breakpad { |
15 class CrashDumpManager; | 16 class CrashDumpManager; |
16 } | 17 } |
17 #endif | 18 #endif |
18 | 19 |
19 namespace base { | 20 namespace base { |
20 class Thread; | 21 class Thread; |
21 } | 22 } |
22 | 23 |
23 namespace net { | 24 namespace net { |
24 class NetLog; | 25 class NetLog; |
25 } | 26 } |
26 | 27 |
27 namespace content { | 28 namespace content { |
28 | 29 |
29 class ShellBrowserContext; | |
30 class ShellDevToolsDelegate; | 30 class ShellDevToolsDelegate; |
31 class ShellPluginServiceFilter; | |
32 | 31 |
33 class ShellBrowserMainParts : public BrowserMainParts { | 32 class ShellBrowserMainParts : public BrowserMainParts { |
34 public: | 33 public: |
35 explicit ShellBrowserMainParts(const MainFunctionParams& parameters); | 34 explicit ShellBrowserMainParts(const MainFunctionParams& parameters); |
36 virtual ~ShellBrowserMainParts(); | 35 virtual ~ShellBrowserMainParts(); |
37 | 36 |
38 // BrowserMainParts overrides. | 37 // BrowserMainParts overrides. |
39 virtual void PreEarlyInitialization() override; | 38 virtual void PreEarlyInitialization() override; |
40 virtual void PreMainMessageLoopStart() override; | 39 virtual void PreMainMessageLoopStart() override; |
41 virtual void PostMainMessageLoopStart() override; | 40 virtual void PostMainMessageLoopStart() override; |
42 virtual void PreMainMessageLoopRun() override; | 41 virtual void PreMainMessageLoopRun() override; |
43 virtual bool MainMessageLoopRun(int* result_code) override; | 42 virtual bool MainMessageLoopRun(int* result_code) override; |
44 virtual void PostMainMessageLoopRun() override; | 43 virtual void PostMainMessageLoopRun() override; |
45 | 44 |
46 ShellDevToolsDelegate* devtools_delegate() { | 45 ShellDevToolsDelegate* devtools_delegate() { |
47 return devtools_delegate_.get(); | 46 return devtools_delegate_.get(); |
48 } | 47 } |
49 | 48 |
50 ShellBrowserContext* browser_context() { return browser_context_.get(); } | 49 ShellBrowserContext* browser_context() { return browser_context_.get(); } |
51 ShellBrowserContext* off_the_record_browser_context() { | 50 ShellBrowserContext* off_the_record_browser_context() { |
52 return off_the_record_browser_context_.get(); | 51 return off_the_record_browser_context_.get(); |
53 } | 52 } |
54 | 53 |
55 net::NetLog* net_log() { return net_log_.get(); } | 54 net::NetLog* net_log() { return net_log_.get(); } |
56 | 55 |
| 56 protected: |
| 57 virtual void InitializeBrowserContexts(); |
| 58 virtual void InitializeMessageLoopContext(); |
| 59 |
| 60 void set_browser_context(ShellBrowserContext* context) { |
| 61 browser_context_.reset(context); |
| 62 } |
| 63 void set_off_the_record_browser_context(ShellBrowserContext* context) { |
| 64 off_the_record_browser_context_.reset(context); |
| 65 } |
| 66 |
57 private: | 67 private: |
58 #if defined(OS_ANDROID) | 68 #if defined(OS_ANDROID) |
59 scoped_ptr<breakpad::CrashDumpManager> crash_dump_manager_; | 69 scoped_ptr<breakpad::CrashDumpManager> crash_dump_manager_; |
60 #endif | 70 #endif |
61 scoped_ptr<net::NetLog> net_log_; | 71 scoped_ptr<net::NetLog> net_log_; |
62 scoped_ptr<ShellBrowserContext> browser_context_; | 72 scoped_ptr<ShellBrowserContext> browser_context_; |
63 scoped_ptr<ShellBrowserContext> off_the_record_browser_context_; | 73 scoped_ptr<ShellBrowserContext> off_the_record_browser_context_; |
64 | 74 |
65 // For running content_browsertests. | 75 // For running content_browsertests. |
66 const MainFunctionParams parameters_; | 76 const MainFunctionParams parameters_; |
67 bool run_message_loop_; | 77 bool run_message_loop_; |
68 | 78 |
69 scoped_ptr<ShellDevToolsDelegate> devtools_delegate_; | 79 scoped_ptr<ShellDevToolsDelegate> devtools_delegate_; |
70 #if defined(ENABLE_PLUGINS) | |
71 scoped_ptr<ShellPluginServiceFilter> plugin_service_filter_; | |
72 #endif | |
73 | 80 |
74 DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts); | 81 DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts); |
75 }; | 82 }; |
76 | 83 |
77 } // namespace content | 84 } // namespace content |
78 | 85 |
79 #endif // CONTENT_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_ | 86 #endif // CONTENT_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_ |
OLD | NEW |