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