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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(cast_browser_process_->browser_context())); |
| 106 |
| 107 // Initializing network delegates must happen after Cast service is created. |
| 108 url_request_context_factory_->InitializeNetworkDelegates(); |
106 cast_browser_process_->cast_service()->Start(); | 109 cast_browser_process_->cast_service()->Start(); |
107 } | 110 } |
108 | 111 |
109 bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { | 112 bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { |
110 // If parameters_.ui_task is not NULL, we are running browser tests. In this | 113 // 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. | 114 // case, the browser's main message loop will not run. |
112 if (parameters_.ui_task) { | 115 if (parameters_.ui_task) { |
113 parameters_.ui_task->Run(); | 116 parameters_.ui_task->Run(); |
114 } else { | 117 } else { |
115 base::MessageLoopForUI::current()->Run(); | 118 base::MessageLoopForUI::current()->Run(); |
116 } | 119 } |
117 return true; | 120 return true; |
118 } | 121 } |
119 | 122 |
120 void CastBrowserMainParts::PostMainMessageLoopRun() { | 123 void CastBrowserMainParts::PostMainMessageLoopRun() { |
121 cast_browser_process_->cast_service()->Stop(); | 124 cast_browser_process_->cast_service()->Stop(); |
122 cast_browser_process_.reset(); | 125 cast_browser_process_.reset(); |
123 } | 126 } |
124 | 127 |
125 } // namespace shell | 128 } // namespace shell |
126 } // namespace chromecast | 129 } // namespace chromecast |
OLD | NEW |