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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 content::BrowserThread::GetBlockingPool(), | 106 content::BrowserThread::GetBlockingPool(), |
107 ChromecastConfig::GetInstance()->pref_service(), | 107 ChromecastConfig::GetInstance()->pref_service(), |
108 cast_browser_process_->browser_context()->GetRequestContext())); | 108 cast_browser_process_->browser_context()->GetRequestContext())); |
109 cast_browser_process_->SetRemoteDebuggingServer(new RemoteDebuggingServer()); | 109 cast_browser_process_->SetRemoteDebuggingServer(new RemoteDebuggingServer()); |
110 | 110 |
111 InitializeWebUI(); | 111 InitializeWebUI(); |
112 | 112 |
113 cast_browser_process_->SetCastService(CastService::Create( | 113 cast_browser_process_->SetCastService(CastService::Create( |
114 cast_browser_process_->browser_context(), | 114 cast_browser_process_->browser_context(), |
115 url_request_context_factory_->GetSystemGetter(), | 115 url_request_context_factory_->GetSystemGetter(), |
116 url_request_context_factory_->app_network_delegate(), | |
117 base::Bind( | 116 base::Bind( |
118 &metrics::CastMetricsServiceClient::EnableMetricsService, | 117 &metrics::CastMetricsServiceClient::EnableMetricsService, |
119 base::Unretained(cast_browser_process_->metrics_service_client())))); | 118 base::Unretained(cast_browser_process_->metrics_service_client())))); |
120 | 119 |
121 // Initializing network delegates must happen after Cast service is created. | 120 // Initializing network delegates must happen after Cast service is created. |
122 url_request_context_factory_->InitializeNetworkDelegates(); | 121 url_request_context_factory_->InitializeNetworkDelegates(); |
123 cast_browser_process_->cast_service()->Start(); | 122 cast_browser_process_->cast_service()->Start(); |
124 } | 123 } |
125 | 124 |
126 bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { | 125 bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { |
127 // If parameters_.ui_task is not NULL, we are running browser tests. In this | 126 // If parameters_.ui_task is not NULL, we are running browser tests. In this |
128 // case, the browser's main message loop will not run. | 127 // case, the browser's main message loop will not run. |
129 if (parameters_.ui_task) { | 128 if (parameters_.ui_task) { |
130 parameters_.ui_task->Run(); | 129 parameters_.ui_task->Run(); |
131 } else { | 130 } else { |
132 base::MessageLoopForUI::current()->Run(); | 131 base::MessageLoopForUI::current()->Run(); |
133 } | 132 } |
134 return true; | 133 return true; |
135 } | 134 } |
136 | 135 |
137 void CastBrowserMainParts::PostMainMessageLoopRun() { | 136 void CastBrowserMainParts::PostMainMessageLoopRun() { |
138 cast_browser_process_->cast_service()->Stop(); | 137 cast_browser_process_->cast_service()->Stop(); |
139 cast_browser_process_.reset(); | 138 cast_browser_process_.reset(); |
140 } | 139 } |
141 | 140 |
142 } // namespace shell | 141 } // namespace shell |
143 } // namespace chromecast | 142 } // namespace chromecast |
OLD | NEW |