| 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 <windows.h> | 5 #include <windows.h> |
| 6 #include <setupapi.h> // Must be included after windows.h | 6 #include <setupapi.h> // Must be included after windows.h |
| 7 #include <winspool.h> | 7 #include <winspool.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <iomanip> | 10 #include <iomanip> |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 DWORD size = MAX_PATH * 10; | 142 DWORD size = MAX_PATH * 10; |
| 143 wchar_t package_path[MAX_PATH * 10] = {0}; | 143 wchar_t package_path[MAX_PATH * 10] = {0}; |
| 144 | 144 |
| 145 base::FilePath inf_file = install_path.Append(kInfFileName); | 145 base::FilePath inf_file = install_path.Append(kInfFileName); |
| 146 base::string16 driver_name = LoadLocalString(IDS_DRIVER_NAME); | 146 base::string16 driver_name = LoadLocalString(IDS_DRIVER_NAME); |
| 147 | 147 |
| 148 HRESULT result = UploadPrinterDriverPackage( | 148 HRESULT result = UploadPrinterDriverPackage( |
| 149 NULL, inf_file.value().c_str(), NULL, | 149 NULL, inf_file.value().c_str(), NULL, |
| 150 UPDP_SILENT_UPLOAD | UPDP_UPLOAD_ALWAYS, NULL, package_path, &size); | 150 UPDP_SILENT_UPLOAD | UPDP_UPLOAD_ALWAYS, NULL, package_path, &size); |
| 151 if (FAILED(result)) { | 151 if (FAILED(result)) { |
| 152 LOG(ERROR) | 152 LOG(WARNING) |
| 153 << "Uploading the printer driver package to the driver cache failed."; | 153 << "Uploading the printer driver package to the driver cache silently " |
| 154 return result; | 154 << "failed. Will retry with user UI. HRESULT=0x" << std::setbase(16) |
| 155 << result; |
| 156 |
| 157 result = UploadPrinterDriverPackage( |
| 158 NULL, inf_file.value().c_str(), NULL, UPDP_UPLOAD_ALWAYS, |
| 159 GetForegroundWindow(), package_path, &size); |
| 160 |
| 161 if (FAILED(result)) { |
| 162 LOG(WARNING) |
| 163 << "Uploading the printer driver package to the driver cache failed" |
| 164 << "with user UI. Aborting."; |
| 165 return result; |
| 166 } |
| 155 } | 167 } |
| 156 | 168 |
| 157 result = InstallPrinterDriverFromPackage( | 169 result = InstallPrinterDriverFromPackage( |
| 158 NULL, package_path, driver_name.c_str(), NULL, IPDFP_COPY_ALL_FILES); | 170 NULL, package_path, driver_name.c_str(), NULL, IPDFP_COPY_ALL_FILES); |
| 159 if (FAILED(result)) { | 171 if (FAILED(result)) { |
| 160 LOG(ERROR) << "Installing the printer driver failed."; | 172 LOG(ERROR) << "Installing the printer driver failed."; |
| 161 } | 173 } |
| 162 return result; | 174 return result; |
| 163 } | 175 } |
| 164 | 176 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 | 412 |
| 401 VLOG(0) << GetErrorMessage(retval) << " HRESULT=0x" << std::setbase(16) | 413 VLOG(0) << GetErrorMessage(retval) << " HRESULT=0x" << std::setbase(16) |
| 402 << retval; | 414 << retval; |
| 403 | 415 |
| 404 // Installer is silent by default as required by Google Update. | 416 // Installer is silent by default as required by Google Update. |
| 405 if (base::CommandLine::ForCurrentProcess()->HasSwitch("verbose")) { | 417 if (base::CommandLine::ForCurrentProcess()->HasSwitch("verbose")) { |
| 406 DisplayWindowsMessage(NULL, retval, LoadLocalString(IDS_DRIVER_NAME)); | 418 DisplayWindowsMessage(NULL, retval, LoadLocalString(IDS_DRIVER_NAME)); |
| 407 } | 419 } |
| 408 return retval; | 420 return retval; |
| 409 } | 421 } |
| OLD | NEW |