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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 new CastBrowserContext(url_request_context_factory_)); | 94 new CastBrowserContext(url_request_context_factory_)); |
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(CastService::Create( |
105 CastService::Create(cast_browser_process_->browser_context(), | 105 cast_browser_process_->browser_context(), |
106 url_request_context_factory_->GetSystemGetter())); | 106 url_request_context_factory_->GetSystemGetter(), |
| 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(); |
107 cast_browser_process_->cast_service()->Start(); | 111 cast_browser_process_->cast_service()->Start(); |
108 } | 112 } |
109 | 113 |
110 bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { | 114 bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { |
111 // 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 |
112 // case, the browser's main message loop will not run. | 116 // case, the browser's main message loop will not run. |
113 if (parameters_.ui_task) { | 117 if (parameters_.ui_task) { |
114 parameters_.ui_task->Run(); | 118 parameters_.ui_task->Run(); |
115 } else { | 119 } else { |
116 base::MessageLoopForUI::current()->Run(); | 120 base::MessageLoopForUI::current()->Run(); |
117 } | 121 } |
118 return true; | 122 return true; |
119 } | 123 } |
120 | 124 |
121 void CastBrowserMainParts::PostMainMessageLoopRun() { | 125 void CastBrowserMainParts::PostMainMessageLoopRun() { |
122 cast_browser_process_->cast_service()->Stop(); | 126 cast_browser_process_->cast_service()->Stop(); |
123 cast_browser_process_.reset(); | 127 cast_browser_process_.reset(); |
124 } | 128 } |
125 | 129 |
126 } // namespace shell | 130 } // namespace shell |
127 } // namespace chromecast | 131 } // namespace chromecast |
OLD | NEW |