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" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 content::BrowserThread::GetBlockingPool(), | 99 content::BrowserThread::GetBlockingPool(), |
100 ChromecastConfig::GetInstance()->pref_service(), | 100 ChromecastConfig::GetInstance()->pref_service(), |
101 cast_browser_process_->browser_context()->GetRequestContext())); | 101 cast_browser_process_->browser_context()->GetRequestContext())); |
102 cast_browser_process_->SetRemoteDebuggingServer(new RemoteDebuggingServer()); | 102 cast_browser_process_->SetRemoteDebuggingServer(new RemoteDebuggingServer()); |
103 | 103 |
104 InitializeWebUI(); | 104 InitializeWebUI(); |
105 | 105 |
106 cast_browser_process_->SetCastService(CastService::Create( | 106 cast_browser_process_->SetCastService(CastService::Create( |
107 cast_browser_process_->browser_context(), | 107 cast_browser_process_->browser_context(), |
108 url_request_context_factory_->GetSystemGetter(), | 108 url_request_context_factory_->GetSystemGetter(), |
109 url_request_context_factory_->app_network_delegate())); | 109 url_request_context_factory_->app_network_delegate(), |
| 110 base::Bind( |
| 111 &metrics::CastMetricsServiceClient::EnableMetricsService, |
| 112 base::Unretained(cast_browser_process_->metrics_service_client())))); |
110 | 113 |
111 // Initializing network delegates must happen after Cast service is created. | 114 // Initializing network delegates must happen after Cast service is created. |
112 url_request_context_factory_->InitializeNetworkDelegates(); | 115 url_request_context_factory_->InitializeNetworkDelegates(); |
113 cast_browser_process_->cast_service()->Start(); | 116 cast_browser_process_->cast_service()->Start(); |
114 } | 117 } |
115 | 118 |
116 bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { | 119 bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { |
117 // If parameters_.ui_task is not NULL, we are running browser tests. In this | 120 // If parameters_.ui_task is not NULL, we are running browser tests. In this |
118 // case, the browser's main message loop will not run. | 121 // case, the browser's main message loop will not run. |
119 if (parameters_.ui_task) { | 122 if (parameters_.ui_task) { |
120 parameters_.ui_task->Run(); | 123 parameters_.ui_task->Run(); |
121 } else { | 124 } else { |
122 base::MessageLoopForUI::current()->Run(); | 125 base::MessageLoopForUI::current()->Run(); |
123 } | 126 } |
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 |