summaryrefslogtreecommitdiffstats
path: root/cloud_print/virtual_driver
diff options
context:
space:
mode:
authorvitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-26 07:43:01 +0000
committervitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-26 07:43:01 +0000
commit8050365f66171cc0318119a829183891e40915ed (patch)
treef4a9588ba1844670c5edf0a48f655cd74d74df85 /cloud_print/virtual_driver
parent7a91ea9cf3449ef40ca2d4920bee9d6e00190ec4 (diff)
downloadchromium_src-8050365f66171cc0318119a829183891e40915ed.zip
chromium_src-8050365f66171cc0318119a829183891e40915ed.tar.gz
chromium_src-8050365f66171cc0318119a829183891e40915ed.tar.bz2
Fixed virtual driver on XP.
Unpack dependencies from cache and system directory. Don't use Low Integrity App Data. TBR=gene NOTRY=True Review URL: https://chromiumcodereview.appspot.com/12347004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184603 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cloud_print/virtual_driver')
-rw-r--r--cloud_print/virtual_driver/win/install/setup.cc28
-rw-r--r--cloud_print/virtual_driver/win/port_monitor/port_monitor.cc7
2 files changed, 24 insertions, 11 deletions
diff --git a/cloud_print/virtual_driver/win/install/setup.cc b/cloud_print/virtual_driver/win/install/setup.cc
index 502e88a0..cd2d222 100644
--- a/cloud_print/virtual_driver/win/install/setup.cc
+++ b/cloud_print/virtual_driver/win/install/setup.cc
@@ -266,19 +266,26 @@ void ReadyPpdDependencies(const base::FilePath& destination) {
SetupIterateCabinet(package_path, 0, &CabinetCallback,
&base::FilePath(destination));
} else {
- // PS driver files are in the sp3 cab.
+ // Driver files are in the sp3 cab.
base::FilePath package_path;
PathService::Get(base::DIR_WINDOWS, &package_path);
package_path = package_path.Append(L"Driver Cache\\i386\\sp3.cab");
SetupIterateCabinet(package_path.value().c_str(), 0, &CabinetCallback,
&base::FilePath(destination));
- // The XPS driver files are just sitting uncompressed in the driver cache.
- base::FilePath xps_path;
- PathService::Get(base::DIR_WINDOWS, &xps_path);
- xps_path = xps_path.Append(L"Driver Cache\\i386");
- xps_path = xps_path.Append(kDriverName);
- file_util::CopyFile(xps_path, destination.Append(kDriverName));
+ // Copy the rest from the driver cache or system dir.
+ base::FilePath driver_cache_path;
+ PathService::Get(base::DIR_WINDOWS, &driver_cache_path);
+ driver_cache_path = driver_cache_path.Append(L"Driver Cache\\i386");
+ for (size_t i = 0; i < arraysize(kDependencyList); ++i) {
+ base::FilePath dst_path = destination.Append(kDependencyList[i]);
+ if (!file_util::PathExists(dst_path)) {
+ base::FilePath src_path = driver_cache_path.Append(kDependencyList[i]);
+ if (!file_util::PathExists(src_path))
+ src_path = GetSystemPath(kDependencyList[i]);
+ file_util::CopyFile(src_path, dst_path);
+ }
+ }
}
}
@@ -308,8 +315,11 @@ HRESULT InstallPpd(const base::FilePath& install_path) {
std::vector<string16> dependent_array;
// Add all files. AddPrinterDriverEx will removes unnecessary.
for (size_t i = 0; i < arraysize(kDependencyList); ++i) {
- dependent_array.push_back(
- temp_path.path().Append(kDependencyList[i]).value());
+ base::FilePath file_path = temp_path.path().Append(kDependencyList[i]);
+ if (file_util::PathExists(file_path))
+ dependent_array.push_back(file_path.value());
+ else
+ LOG(WARNING) << "File is missing: " << file_path.BaseName().value();
}
string16 dependent_files(JoinString(dependent_array, L'\n'));
dependent_files.push_back(L'\n');
diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
index e833145..2157d19 100644
--- a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
+++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
@@ -106,8 +106,11 @@ MONITOR2 g_monitor_2 = {
base::FilePath GetAppDataDir() {
base::FilePath file_path;
- if (!PathService::Get(base::DIR_LOCAL_APP_DATA_LOW, &file_path)) {
- LOG(ERROR) << "Can't get DIR_LOCAL_APP_DATA_LOW";
+ base::win::Version version = base::win::GetVersion();
+ int path_id = (version >= base::win::VERSION_VISTA) ?
+ base::DIR_LOCAL_APP_DATA_LOW : base::DIR_LOCAL_APP_DATA;
+ if (!PathService::Get(path_id, &file_path)) {
+ LOG(ERROR) << "Can't get DIR_LOCAL_APP_DATA";
return base::FilePath();
}
return file_path.Append(kAppDataDir);