OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/service/service_process.h" | 5 #include "chrome/service/service_process.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 blocking_pool_ = new base::SequencedWorkerPool(3, "ServiceBlocking"); | 156 blocking_pool_ = new base::SequencedWorkerPool(3, "ServiceBlocking"); |
157 | 157 |
158 request_context_getter_ = new ServiceURLRequestContextGetter(); | 158 request_context_getter_ = new ServiceURLRequestContextGetter(); |
159 | 159 |
160 base::FilePath user_data_dir; | 160 base::FilePath user_data_dir; |
161 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 161 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
162 base::FilePath pref_path = | 162 base::FilePath pref_path = |
163 user_data_dir.Append(chrome::kServiceStateFileName); | 163 user_data_dir.Append(chrome::kServiceStateFileName); |
164 service_prefs_.reset(new ServiceProcessPrefs( | 164 service_prefs_.reset(new ServiceProcessPrefs( |
165 pref_path, | 165 pref_path, |
166 JsonPrefStore::GetTaskRunnerForFile(pref_path, blocking_pool_.get()))); | 166 JsonPrefStore::GetTaskRunnerForFile(pref_path, blocking_pool_.get()) |
| 167 .get())); |
167 service_prefs_->ReadPrefs(); | 168 service_prefs_->ReadPrefs(); |
168 | 169 |
169 // This switch it required to run connector with test gaia. | 170 // This switch it required to run connector with test gaia. |
170 if (command_line.HasSwitch(switches::kIgnoreUrlFetcherCertRequests)) | 171 if (command_line.HasSwitch(switches::kIgnoreUrlFetcherCertRequests)) |
171 net::URLFetcher::SetIgnoreCertificateRequests(true); | 172 net::URLFetcher::SetIgnoreCertificateRequests(true); |
172 | 173 |
173 // Check if a locale override has been specified on the command-line. | 174 // Check if a locale override has been specified on the command-line. |
174 std::string locale = command_line.GetSwitchValueASCII(switches::kLang); | 175 std::string locale = command_line.GetSwitchValueASCII(switches::kLang); |
175 if (!locale.empty()) { | 176 if (!locale.empty()) { |
176 service_prefs_->SetString(prefs::kApplicationLocale, locale); | 177 service_prefs_->SetString(prefs::kApplicationLocale, locale); |
(...skipping 19 matching lines...) Expand all Loading... |
196 } | 197 } |
197 | 198 |
198 VLOG(1) << "Starting Service Process IPC Server"; | 199 VLOG(1) << "Starting Service Process IPC Server"; |
199 ipc_server_.reset(new ServiceIPCServer( | 200 ipc_server_.reset(new ServiceIPCServer( |
200 service_process_state_->GetServiceProcessChannel())); | 201 service_process_state_->GetServiceProcessChannel())); |
201 ipc_server_->Init(); | 202 ipc_server_->Init(); |
202 | 203 |
203 // After the IPC server has started we signal that the service process is | 204 // After the IPC server has started we signal that the service process is |
204 // ready. | 205 // ready. |
205 if (!service_process_state_->SignalReady( | 206 if (!service_process_state_->SignalReady( |
206 io_thread_->message_loop_proxy(), | 207 io_thread_->message_loop_proxy().get(), |
207 base::Bind(&ServiceProcess::Terminate, base::Unretained(this)))) { | 208 base::Bind(&ServiceProcess::Terminate, base::Unretained(this)))) { |
208 return false; | 209 return false; |
209 } | 210 } |
210 | 211 |
211 // See if we need to stay running. | 212 // See if we need to stay running. |
212 ScheduleShutdownCheck(); | 213 ScheduleShutdownCheck(); |
213 | 214 |
214 // Occasionally check to see if we need to launch the browser to get the | 215 // Occasionally check to see if we need to launch the browser to get the |
215 // policy state information. | 216 // policy state information. |
216 CloudPrintPolicyCheckIfNeeded(); | 217 CloudPrintPolicyCheckIfNeeded(); |
217 return true; | 218 return true; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 if (enabled_services_ && !ipc_server_->is_client_connected()) { | 371 if (enabled_services_ && !ipc_server_->is_client_connected()) { |
371 GetCloudPrintProxy()->CheckCloudPrintProxyPolicy(); | 372 GetCloudPrintProxy()->CheckCloudPrintProxyPolicy(); |
372 } | 373 } |
373 ScheduleCloudPrintPolicyCheck(); | 374 ScheduleCloudPrintPolicyCheck(); |
374 } | 375 } |
375 | 376 |
376 ServiceProcess::~ServiceProcess() { | 377 ServiceProcess::~ServiceProcess() { |
377 Teardown(); | 378 Teardown(); |
378 g_service_process = NULL; | 379 g_service_process = NULL; |
379 } | 380 } |
OLD | NEW |