| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 #endif // defined(OS_ANDROID) | 79 #endif // defined(OS_ANDROID) |
| 79 } | 80 } |
| 80 | 81 |
| 81 void CastBrowserMainParts::PostMainMessageLoopStart() { | 82 void CastBrowserMainParts::PostMainMessageLoopStart() { |
| 82 #if defined(OS_ANDROID) | 83 #if defined(OS_ANDROID) |
| 83 base::MessageLoopForUI::current()->Start(); | 84 base::MessageLoopForUI::current()->Start(); |
| 84 #endif // defined(OS_ANDROID) | 85 #endif // defined(OS_ANDROID) |
| 85 } | 86 } |
| 86 | 87 |
| 87 int CastBrowserMainParts::PreCreateThreads() { | 88 int CastBrowserMainParts::PreCreateThreads() { |
| 88 ChromecastConfig::Create(new PrefRegistrySimple()); | 89 PrefRegistrySimple* pref_registry = new PrefRegistrySimple(); |
| 90 metrics::RegisterPrefs(pref_registry); |
| 91 ChromecastConfig::Create(pref_registry); |
| 89 return 0; | 92 return 0; |
| 90 } | 93 } |
| 91 | 94 |
| 92 void CastBrowserMainParts::PreMainMessageLoopRun() { | 95 void CastBrowserMainParts::PreMainMessageLoopRun() { |
| 93 url_request_context_factory_->InitializeOnUIThread(); | 96 url_request_context_factory_->InitializeOnUIThread(); |
| 94 | 97 |
| 95 cast_browser_process_->SetBrowserContext( | 98 cast_browser_process_->SetBrowserContext( |
| 96 new CastBrowserContext(url_request_context_factory_)); | 99 new CastBrowserContext(url_request_context_factory_)); |
| 97 cast_browser_process_->SetMetricsServiceClient( | 100 cast_browser_process_->SetMetricsServiceClient( |
| 98 metrics::CastMetricsServiceClient::Create( | 101 metrics::CastMetricsServiceClient::Create( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 124 return true; | 127 return true; |
| 125 } | 128 } |
| 126 | 129 |
| 127 void CastBrowserMainParts::PostMainMessageLoopRun() { | 130 void CastBrowserMainParts::PostMainMessageLoopRun() { |
| 128 cast_browser_process_->cast_service()->Stop(); | 131 cast_browser_process_->cast_service()->Stop(); |
| 129 cast_browser_process_.reset(); | 132 cast_browser_process_.reset(); |
| 130 } | 133 } |
| 131 | 134 |
| 132 } // namespace shell | 135 } // namespace shell |
| 133 } // namespace chromecast | 136 } // namespace chromecast |
| OLD | NEW |