OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "chromecast/shell/browser/cast_browser_main_parts.h" | 5 #include "chromecast/shell/browser/cast_browser_main_parts.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/prefs/pref_registry_simple.h" | 9 #include "base/prefs/pref_registry_simple.h" |
10 #include "chromecast/common/chromecast_config.h" | 10 #include "chromecast/common/chromecast_config.h" |
| 11 #include "chromecast/metrics/cast_metrics_prefs.h" |
11 #include "chromecast/metrics/cast_metrics_service_client.h" | 12 #include "chromecast/metrics/cast_metrics_service_client.h" |
12 #include "chromecast/net/network_change_notifier_cast.h" | 13 #include "chromecast/net/network_change_notifier_cast.h" |
13 #include "chromecast/net/network_change_notifier_factory_cast.h" | 14 #include "chromecast/net/network_change_notifier_factory_cast.h" |
14 #include "chromecast/service/cast_service.h" | 15 #include "chromecast/service/cast_service.h" |
15 #include "chromecast/shell/browser/cast_browser_context.h" | 16 #include "chromecast/shell/browser/cast_browser_context.h" |
16 #include "chromecast/shell/browser/cast_browser_process.h" | 17 #include "chromecast/shell/browser/cast_browser_process.h" |
17 #include "chromecast/shell/browser/devtools/remote_debugging_server.h" | 18 #include "chromecast/shell/browser/devtools/remote_debugging_server.h" |
18 #include "chromecast/shell/browser/url_request_context_factory.h" | 19 #include "chromecast/shell/browser/url_request_context_factory.h" |
19 #include "chromecast/shell/browser/webui/webui_cast.h" | 20 #include "chromecast/shell/browser/webui/webui_cast.h" |
20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 #endif // defined(OS_ANDROID) | 86 #endif // defined(OS_ANDROID) |
86 } | 87 } |
87 | 88 |
88 void CastBrowserMainParts::PostMainMessageLoopStart() { | 89 void CastBrowserMainParts::PostMainMessageLoopStart() { |
89 #if defined(OS_ANDROID) | 90 #if defined(OS_ANDROID) |
90 base::MessageLoopForUI::current()->Start(); | 91 base::MessageLoopForUI::current()->Start(); |
91 #endif // defined(OS_ANDROID) | 92 #endif // defined(OS_ANDROID) |
92 } | 93 } |
93 | 94 |
94 int CastBrowserMainParts::PreCreateThreads() { | 95 int CastBrowserMainParts::PreCreateThreads() { |
95 ChromecastConfig::Create(new PrefRegistrySimple()); | 96 PrefRegistrySimple* pref_registry = new PrefRegistrySimple(); |
| 97 metrics::RegisterPrefs(pref_registry); |
| 98 ChromecastConfig::Create(pref_registry); |
96 return 0; | 99 return 0; |
97 } | 100 } |
98 | 101 |
99 void CastBrowserMainParts::PreMainMessageLoopRun() { | 102 void CastBrowserMainParts::PreMainMessageLoopRun() { |
100 url_request_context_factory_->InitializeOnUIThread(); | 103 url_request_context_factory_->InitializeOnUIThread(); |
101 | 104 |
102 cast_browser_process_->SetBrowserContext( | 105 cast_browser_process_->SetBrowserContext( |
103 new CastBrowserContext(url_request_context_factory_)); | 106 new CastBrowserContext(url_request_context_factory_)); |
104 cast_browser_process_->SetMetricsServiceClient( | 107 cast_browser_process_->SetMetricsServiceClient( |
105 metrics::CastMetricsServiceClient::Create( | 108 metrics::CastMetricsServiceClient::Create( |
(...skipping 27 matching lines...) Expand all Loading... |
133 return true; | 136 return true; |
134 } | 137 } |
135 | 138 |
136 void CastBrowserMainParts::PostMainMessageLoopRun() { | 139 void CastBrowserMainParts::PostMainMessageLoopRun() { |
137 cast_browser_process_->cast_service()->Stop(); | 140 cast_browser_process_->cast_service()->Stop(); |
138 cast_browser_process_.reset(); | 141 cast_browser_process_.reset(); |
139 } | 142 } |
140 | 143 |
141 } // namespace shell | 144 } // namespace shell |
142 } // namespace chromecast | 145 } // namespace chromecast |
OLD | NEW |