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 <comdef.h> | 5 #include <comdef.h> |
6 #include <iomanip> | 6 #include <iomanip> |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <winspool.h> | 8 #include <winspool.h> |
9 #include <setupapi.h> // Must be included after windows.h | 9 #include <setupapi.h> // Must be included after windows.h |
10 | 10 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 HRESULT RegisterPortMonitor(bool install, const base::FilePath& install_path) { | 104 HRESULT RegisterPortMonitor(bool install, const base::FilePath& install_path) { |
105 DCHECK(install || install_path.empty()); | 105 DCHECK(install || install_path.empty()); |
106 base::FilePath target_path = GetNativeSystemPath(GetPortMonitorDllName()); | 106 base::FilePath target_path = GetNativeSystemPath(GetPortMonitorDllName()); |
107 if (target_path.empty()) { | 107 if (target_path.empty()) { |
108 LOG(ERROR) << "Unable to get port monitor target path."; | 108 LOG(ERROR) << "Unable to get port monitor target path."; |
109 return HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND); | 109 return HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND); |
110 } | 110 } |
111 if (install) { | 111 if (install) { |
112 base::FilePath source_path = | 112 base::FilePath source_path = |
113 install_path.Append(GetPortMonitorDllName()); | 113 install_path.Append(GetPortMonitorDllName()); |
114 if (!file_util::CopyFile(source_path, target_path)) { | 114 if (!base::CopyFile(source_path, target_path)) { |
115 LOG(ERROR) << "Unable copy port monitor dll from " << | 115 LOG(ERROR) << "Unable copy port monitor dll from " << |
116 source_path.value() << " to " << target_path.value(); | 116 source_path.value() << " to " << target_path.value(); |
117 return GetLastHResult(); | 117 return GetLastHResult(); |
118 } | 118 } |
119 } else if (!file_util::PathExists(target_path)) { | 119 } else if (!file_util::PathExists(target_path)) { |
120 // Already removed. Just "succeed" silently. | 120 // Already removed. Just "succeed" silently. |
121 return S_OK; | 121 return S_OK; |
122 } | 122 } |
123 | 123 |
124 base::FilePath regsvr32_path = GetNativeSystemPath(L"regsvr32.exe"); | 124 base::FilePath regsvr32_path = GetNativeSystemPath(L"regsvr32.exe"); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 // Copy the rest from the driver cache or system dir. | 234 // Copy the rest from the driver cache or system dir. |
235 base::FilePath driver_cache_path; | 235 base::FilePath driver_cache_path; |
236 PathService::Get(base::DIR_WINDOWS, &driver_cache_path); | 236 PathService::Get(base::DIR_WINDOWS, &driver_cache_path); |
237 driver_cache_path = driver_cache_path.Append(L"Driver Cache\\i386"); | 237 driver_cache_path = driver_cache_path.Append(L"Driver Cache\\i386"); |
238 for (size_t i = 0; i < arraysize(kDependencyList); ++i) { | 238 for (size_t i = 0; i < arraysize(kDependencyList); ++i) { |
239 base::FilePath dst_path = destination.Append(kDependencyList[i]); | 239 base::FilePath dst_path = destination.Append(kDependencyList[i]); |
240 if (!file_util::PathExists(dst_path)) { | 240 if (!file_util::PathExists(dst_path)) { |
241 base::FilePath src_path = driver_cache_path.Append(kDependencyList[i]); | 241 base::FilePath src_path = driver_cache_path.Append(kDependencyList[i]); |
242 if (!file_util::PathExists(src_path)) | 242 if (!file_util::PathExists(src_path)) |
243 src_path = GetSystemPath(kDependencyList[i]); | 243 src_path = GetSystemPath(kDependencyList[i]); |
244 file_util::CopyFile(src_path, dst_path); | 244 base::CopyFile(src_path, dst_path); |
245 } | 245 } |
246 } | 246 } |
247 } | 247 } |
248 } | 248 } |
249 | 249 |
250 HRESULT InstallDriver(const base::FilePath& install_path) { | 250 HRESULT InstallDriver(const base::FilePath& install_path) { |
251 base::ScopedTempDir temp_path; | 251 base::ScopedTempDir temp_path; |
252 if (!temp_path.CreateUniqueTempDir()) | 252 if (!temp_path.CreateUniqueTempDir()) |
253 return HRESULT_FROM_WIN32(ERROR_CANNOT_MAKE); | 253 return HRESULT_FROM_WIN32(ERROR_CANNOT_MAKE); |
254 ReadyDriverDependencies(temp_path.path()); | 254 ReadyDriverDependencies(temp_path.path()); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 LOG(INFO) << _com_error(retval).ErrorMessage() << " HRESULT=0x" << | 543 LOG(INFO) << _com_error(retval).ErrorMessage() << " HRESULT=0x" << |
544 std::setbase(16) << retval; | 544 std::setbase(16) << retval; |
545 | 545 |
546 // Installer is silent by default as required by Google Update. | 546 // Installer is silent by default as required by Google Update. |
547 if (CommandLine::ForCurrentProcess()->HasSwitch("verbose")) { | 547 if (CommandLine::ForCurrentProcess()->HasSwitch("verbose")) { |
548 cloud_print::DisplayWindowsMessage(NULL, retval, | 548 cloud_print::DisplayWindowsMessage(NULL, retval, |
549 cloud_print::LoadLocalString(IDS_DRIVER_NAME)); | 549 cloud_print::LoadLocalString(IDS_DRIVER_NAME)); |
550 } | 550 } |
551 return retval; | 551 return retval; |
552 } | 552 } |
OLD | NEW |