Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: cloud_print/service/win/service_controller.cc

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chromeos/system/name_value_pairs_parser.cc ('k') | cloud_print/service/win/service_listener.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cloud_print/service/win/service_controller.h" 5 #include "cloud_print/service/win/service_controller.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 #include <atlcom.h> 8 #include <atlcom.h>
9 #include <atlctl.h> 9 #include <atlctl.h>
10 10
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // printers here. 155 // printers here.
156 HRESULT hr = UninstallService(); 156 HRESULT hr = UninstallService();
157 if (FAILED(hr)) 157 if (FAILED(hr))
158 return hr; 158 return hr;
159 159
160 hr = UpdateRegistryAppId(true); 160 hr = UpdateRegistryAppId(true);
161 if (FAILED(hr)) 161 if (FAILED(hr))
162 return hr; 162 return hr;
163 163
164 base::FilePath service_path = GetBinary(); 164 base::FilePath service_path = GetBinary();
165 if (!file_util::PathExists(service_path)) 165 if (!base::PathExists(service_path))
166 return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); 166 return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
167 CommandLine command_line(service_path); 167 CommandLine command_line(service_path);
168 command_line.AppendSwitch(run_switch); 168 command_line.AppendSwitch(run_switch);
169 if (!user_data_dir.empty()) 169 if (!user_data_dir.empty())
170 command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir); 170 command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir);
171 if (enable_logging) { 171 if (enable_logging) {
172 command_line.AppendSwitch(switches::kEnableLogging); 172 command_line.AppendSwitch(switches::kEnableLogging);
173 command_line.AppendSwitchASCII(switches::kV, "1"); 173 command_line.AppendSwitchASCII(switches::kV, "1");
174 } 174 }
175 175
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 ServiceController::State origina_state = state(); 239 ServiceController::State origina_state = state();
240 if (origina_state < ServiceController::STATE_STOPPED) 240 if (origina_state < ServiceController::STATE_STOPPED)
241 return S_FALSE; 241 return S_FALSE;
242 242
243 ServiceHandle service; 243 ServiceHandle service;
244 HRESULT hr = OpenService(name_, SERVICE_CHANGE_CONFIG, &service); 244 HRESULT hr = OpenService(name_, SERVICE_CHANGE_CONFIG, &service);
245 if (FAILED(hr)) 245 if (FAILED(hr))
246 return hr; 246 return hr;
247 247
248 base::FilePath service_path = GetBinary(); 248 base::FilePath service_path = GetBinary();
249 if (!file_util::PathExists(service_path)) 249 if (!base::PathExists(service_path))
250 return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); 250 return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
251 251
252 command_line_.SetProgram(service_path); 252 command_line_.SetProgram(service_path);
253 if (!::ChangeServiceConfig(service, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE, 253 if (!::ChangeServiceConfig(service, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE,
254 SERVICE_NO_CHANGE, 254 SERVICE_NO_CHANGE,
255 command_line_.GetCommandLineString().c_str(), NULL, 255 command_line_.GetCommandLineString().c_str(), NULL,
256 NULL, NULL, NULL, NULL, NULL)) { 256 NULL, NULL, NULL, NULL, NULL)) {
257 return cloud_print::GetLastHResult(); 257 return cloud_print::GetLastHResult();
258 } 258 }
259 259
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 state_ = STATE_NOT_FOUND; 307 state_ = STATE_NOT_FOUND;
308 return; 308 return;
309 } 309 }
310 is_logging_enabled_ = command_line_.HasSwitch(switches::kEnableLogging); 310 is_logging_enabled_ = command_line_.HasSwitch(switches::kEnableLogging);
311 user_ = config->lpServiceStartName; 311 user_ = config->lpServiceStartName;
312 } 312 }
313 313
314 bool ServiceController::is_logging_enabled() const { 314 bool ServiceController::is_logging_enabled() const {
315 return command_line_.HasSwitch(switches::kEnableLogging); 315 return command_line_.HasSwitch(switches::kEnableLogging);
316 } 316 }
OLDNEW
« no previous file with comments | « chromeos/system/name_value_pairs_parser.cc ('k') | cloud_print/service/win/service_listener.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698