summaryrefslogtreecommitdiffstats
path: root/cloud_print
diff options
context:
space:
mode:
authorvitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-22 06:46:37 +0000
committervitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-22 06:46:37 +0000
commit7185d75d2c308fd296c3bffa8733c2660714eb2f (patch)
tree28bda478107f2ef76c872dea056248badcbe33f5 /cloud_print
parent0a3d00429cfd53587eb898d98e9566a259279f9e (diff)
downloadchromium_src-7185d75d2c308fd296c3bffa8733c2660714eb2f.zip
chromium_src-7185d75d2c308fd296c3bffa8733c2660714eb2f.tar.gz
chromium_src-7185d75d2c308fd296c3bffa8733c2660714eb2f.tar.bz2
Switched UI from PostScript to XPS.
TBR=gene NOTRY=True Review URL: https://chromiumcodereview.appspot.com/12319063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184057 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cloud_print')
-rw-r--r--cloud_print/virtual_driver/gcp-driver.ppd168
-rw-r--r--cloud_print/virtual_driver/win/install/setup.cc58
2 files changed, 146 insertions, 80 deletions
diff --git a/cloud_print/virtual_driver/gcp-driver.ppd b/cloud_print/virtual_driver/gcp-driver.ppd
index e54b8c6..991c1d5 100644
--- a/cloud_print/virtual_driver/gcp-driver.ppd
+++ b/cloud_print/virtual_driver/gcp-driver.ppd
@@ -1,62 +1,106 @@
-*PPD-Adobe: "4.3"
-*% Minmalistic PPD file for Google cloud Print.
-*FormatVersion: "4.3"
-*FileVersion: "1.1"
-*LanguageVersion: English
-*LanguageEncoding: ISOLatin1
-*PCFileName: "gcp-driver.ppd"
-*Manufacturer: "Google Inc."
-*Product: "(CUPS v1.1)"
-*ModelName: "GCP Virtual Driver"
-*ShortNickName: "GCP Virtual Driver"
-*NickName: "GCP Virtual Driver"
-*1284DeviceID: "MFG:Google Inc.;MDL:GCP Virtual Driver;DES:GCP Virtual Driver;CLS:PRINTER;CMD:POSTSCRIPT;"
-*cupsFilter: "application/vnd.cups-pdf 0 -"
-*PSVersion: "(2017.000) 0"
-*LanguageLevel: "3"
-*ColorDevice: True
-*DefaultColorSpace: RGB
-*FileSystem: False
-*Throughput: "8"
-*LandscapeOrientation: Plus90
-*TTRasterizer: Type42
-
-*OpenGroup: General/General
-
-*OpenUI *PageSize/Page Size: PickOne
-*OrderDependency: 100 AnySetup *PageSize
-*DefaultPageSize: Letter
-*PageSize Letter/US Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
-*CloseUI: *PageSize
-
-*OpenUI *PageRegion: PickOne
-*OrderDependency: 100 AnySetup *PageRegion
-*DefaultPageRegion: Letter
-*PageRegion Letter/US Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
-*CloseUI: *PageRegion
-
-*DefaultImageableArea: Letter
-*ImageableArea Letter/US Letter: "18 36 594 786"
-
-*DefaultPaperDimension: Letter
-*PaperDimension Letter/US Letter: "612 792"
-
-*CloseGroup: General
-
-*% List of 14 standard fonts and their common version numbers.
-
-*DefaultFont: Courier
-*Font Courier: Standard "(002.004S)" Standard ROM
-*Font Courier-Bold: Standard "(002.004S)" Standard ROM
-*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
-*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
-*Font Helvetica: Standard "(001.006S)" Standard ROM
-*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
-*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
-*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
-*Font Symbol: Special "(001.007S)" Special ROM
-*Font Times-Bold: Standard "(001.007S)" Standard ROM
-*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
-*Font Times-Italic: Standard "(001.007S)" Standard ROM
-*Font Times-Roman: Standard "(001.007S)" Standard ROM
-*Font ZapfDingbats: Special "(001.004S)" Standard ROM
+*% Copyright (c) 2012 The Chromium Authors. All rights reserved.
+*% Use of this source code is governed by a BSD-style license that can be
+*% found in the LICENSE file.
+
+*GPDFileVersion: "1.0"
+*GPDSpecVersion: "1.0"
+*Include: "StdNames.gpd"
+*ResourceDLL: "unires.dll"
+*ModelName: "Google Cloud Printer"
+*MasterUnits: PAIR(1200, 1200)
+*MaxCopies: 1
+*PrintRatePPM: 200
+*PrinterType: PAGE
+*IsXPSDriver?: TRUE
+
+*Feature: ColorMode {
+ *rcNameID: =COLOR_PRINTING_MODE_DISPLAY
+ *DefaultOption: 24bpp
+ *ConcealFromUI?: TRUE
+ *Option: 24bpp {
+ *rcNameID: =24BPP_DISPLAY
+ *DevNumOfPlanes: 1
+ *DevBPP: 24
+ *DrvBPP: 24
+ }
+}
+
+*Feature: Memory {
+ *rcNameID: =PRINTER_MEMORY_DISPLAY
+ *DefaultOption: 65536KB
+ *Option: 16384KB {
+ *Name: "16MB"
+ *MemoryConfigKB: PAIR(16384, 13950)
+ }
+ *Option: 65536KB {
+ *Name: "64MB"
+ *MemoryConfigKB: PAIR(65536, 65536)
+ }
+}
+
+*Feature: Orientation {
+ *rcNameID: =ORIENTATION_DISPLAY
+ *DefaultOption: PORTRAIT
+ *Option: PORTRAIT {
+ *rcNameID: =PORTRAIT_DISPLAY
+ }
+ *Option: LANDSCAPE_CC270 {
+ *rcNameID: =LANDSCAPE_DISPLAY
+ }
+}
+
+*Feature: PaperSize {
+ *rcNameID: =PAPER_SIZE_DISPLAY
+ *DefaultOption: LETTER
+
+ *Option: A4 {
+ *rcNameID: =RCID_DMPAPER_SYSTEM_NAME
+ *switch: Orientation {
+ *case: PORTRAIT {
+ *PrintableArea: PAIR(9921, 14031)
+ *PrintableOrigin: PAIR(0, 0)
+ *CursorOrigin: PAIR(0, 0)
+ }
+ *case: LANDSCAPE_CC270 {
+ *PrintableArea: PAIR(14031, 9921)
+ *PrintableOrigin: PAIR(0, 0)
+ *CursorOrigin: PAIR(0, 0)
+ }
+ }
+ }
+
+ *Option: LETTER {
+ *rcNameID: =RCID_DMPAPER_SYSTEM_NAME
+ *switch: Orientation {
+ *case: PORTRAIT {
+ *PrintableArea: PAIR(10200, 13200)
+ *PrintableOrigin: PAIR(0, 0)
+ *CursorOrigin: PAIR(0, 0)
+ }
+ *case: LANDSCAPE_CC270 {
+ *PrintableArea: PAIR(13200, 10200)
+ *PrintableOrigin: PAIR(0, 0)
+ *CursorOrigin: PAIR(0, 0)
+ }
+ }
+ }
+}
+
+*Feature: Resolution {
+ *rcNameID: =RESOLUTION_DISPLAY
+ *DefaultOption: 600dpi
+
+ *Option: 600dpi {
+ *Name: "600 x 600 " =DOTS_PER_INCH
+ *DPI: PAIR(600, 600)
+ *TextDPI: PAIR(600, 600)
+ *SpotDiameter: 100
+ *Command: CmdBeginRaster { *Cmd : "<1B>*v7S<1B>*r1A" }
+ *Command: CmdEndRaster { *Cmd : "<1B>*rC" }
+ *Command: CmdSendBlockData { *Cmd : "<1B>*b" %d{NumOfDataBytes}"W" }
+ }
+}
+
+*Command: CmdCR { *Cmd : "<0D>" }
+*Command: CmdLF { *Cmd : "<0A>" }
+*Command: CmdFF { *Cmd : "<0C>" }
diff --git a/cloud_print/virtual_driver/win/install/setup.cc b/cloud_print/virtual_driver/win/install/setup.cc
index 6f2fa9e..74e2b96 100644
--- a/cloud_print/virtual_driver/win/install/setup.cc
+++ b/cloud_print/virtual_driver/win/install/setup.cc
@@ -17,6 +17,7 @@
#include "base/process.h"
#include "base/process_util.h"
#include "base/string16.h"
+#include "base/string_util.h"
#include "base/win/registry.h"
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
@@ -28,20 +29,33 @@
// warnings.
namespace {
+
const wchar_t kVersionKey[] = L"pv";
const wchar_t kNameKey[] = L"name";
const wchar_t kNameValue[] = L"GCP Virtual Driver";
-const wchar_t kPpdName[] = L"gcp-driver.ppd";
-const wchar_t kDriverName[] = L"MXDWDRV.DLL";
-const wchar_t kUiDriverName[] = L"PS5UI.DLL";
-const wchar_t kHelpName[] = L"PSCRIPT.HLP";
-const wchar_t* kDependencyList[] = {kDriverName, kUiDriverName, kHelpName};
const wchar_t kUninstallRegistry[] =
L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"
L"{74AA24E0-AC50-4B28-BA46-9CF05467C9B7}";
const wchar_t kInstallerName[] = L"virtual_driver_setup.exe";
const wchar_t kGcpUrl[] = L"http://www.google.com/cloudprint";
+const wchar_t kDataFileName[] = L"gcp-driver.ppd";
+const wchar_t kDriverName[] = L"MXDWDRV.DLL";
+const wchar_t kUiDriverName[] = L"UNIDRVUI.DLL";
+const wchar_t kHelpName[] = L"UNIDRV.HLP";
+const wchar_t* kDependencyList[] = {
+ kDriverName,
+ kHelpName,
+ kUiDriverName,
+ L"STDDTYPE.GDL",
+ L"STDNAMES.GPD",
+ L"STDSCHEM.GDL",
+ L"STDSCHMX.GDL",
+ L"UNIDRV.DLL",
+ L"UNIRES.DLL",
+ L"XPSSVCS.DLL",
+};
+
const char kDelete[] = "delete";
const char kInstallSwitch[] = "install";
const char kRegisterSwitch[] = "register";
@@ -231,7 +245,6 @@ UINT CALLBACK CabinetCallback(PVOID data,
return FILEOP_DOIT;
}
}
-
return FILEOP_SKIP;
}
return NO_ERROR;
@@ -270,27 +283,39 @@ void ReadyPpdDependencies(const base::FilePath& destination) {
}
HRESULT InstallPpd(const base::FilePath& install_path) {
- DRIVER_INFO_6 driver_info = {0};
- HRESULT result = S_OK;
-
base::ScopedTempDir temp_path;
if (!temp_path.CreateUniqueTempDir())
return HRESULT_FROM_WIN32(ERROR_CANNOT_MAKE);
ReadyPpdDependencies(temp_path.path());
// Set up paths for the files we depend on.
- base::FilePath ppd_path = install_path.Append(kPpdName);
+ base::FilePath data_file = install_path.Append(kDataFileName);
base::FilePath xps_path = temp_path.path().Append(kDriverName);
base::FilePath ui_path = temp_path.path().Append(kUiDriverName);
base::FilePath ui_help_path = temp_path.path().Append(kHelpName);
+ DRIVER_INFO_6 driver_info = {0};
+ // Set up supported print system version. Must be 3.
+ driver_info.cVersion = 3;
+
// None of the print API structures likes constant strings even though they
// don't modify the string. const_casting is the cleanest option.
- driver_info.pDataFile = const_cast<LPWSTR>(ppd_path.value().c_str());
+ driver_info.pDataFile = const_cast<LPWSTR>(data_file.value().c_str());
driver_info.pHelpFile = const_cast<LPWSTR>(ui_help_path.value().c_str());
driver_info.pDriverPath = const_cast<LPWSTR>(xps_path.value().c_str());
driver_info.pConfigFile = const_cast<LPWSTR>(ui_path.value().c_str());
+ 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());
+ }
+ string16 dependent_files(JoinString(dependent_array, L'\n'));
+ dependent_files.push_back(L'\n');
+ std::replace(dependent_files.begin(), dependent_files.end(), L'\n', L'\0');
+ driver_info.pDependentFiles = &dependent_files[0];
+
// Set up user visible strings.
string16 manufacturer = cloud_print::LoadLocalString(IDS_GOOGLE);
driver_info.pszMfgName = const_cast<LPWSTR>(manufacturer.c_str());
@@ -300,15 +325,12 @@ HRESULT InstallPpd(const base::FilePath& install_path) {
string16 driver_name = cloud_print::LoadLocalString(IDS_DRIVER_NAME);
driver_info.pName = const_cast<LPWSTR>(driver_name.c_str());
- // Set up supported print system version. Must be 3.
- driver_info.cVersion = 3;
-
- if (!AddPrinterDriverEx(NULL, 6, reinterpret_cast<BYTE*>(&driver_info),
- APD_COPY_NEW_FILES | APD_COPY_FROM_DIRECTORY)) {
- result = cloud_print::GetLastHResult();
+ if (!::AddPrinterDriverEx(NULL, 6, reinterpret_cast<BYTE*>(&driver_info),
+ APD_COPY_NEW_FILES | APD_COPY_FROM_DIRECTORY)) {
LOG(ERROR) << "Unable to add printer driver";
+ return cloud_print::GetLastHResult();
}
- return result;
+ return S_OK;
}
HRESULT UninstallPpd() {