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

Side by Side Diff: cloud_print/virtual_driver/posix/printer_driver_util_linux.cc

Issue 9307087: Remove code for Mac and Linux virtual print drivers. (Closed)
Patch Set: Nuke linux too Created 8 years, 10 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
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <cups/backend.h>
6
7 #include "base/base_paths.h"
8 #include "base/command_line.h"
9 #include "base/file_path.h"
10 #include "base/logging.h"
11 #include "base/path_service.h"
12
13 #include "cloud_print/virtual_driver/posix/printer_driver_util_posix.h"
14 #include "cloud_print/virtual_driver/virtual_driver_switches.h"
15
16 namespace printer_driver_util {
17
18 void LaunchPrintDialog(const std::string& output_path,
19 const std::string& job_title,
20 const std::string& current_user,
21 const std::string& print_ticket) {
22 std::string set_var;
23
24 // Set Environment variable to control display.
25 set_var = "/home/" + current_user + "/.Xauthority";
26 if (setenv("DISPLAY", ":0.0", 0) == -1) {
27 LOG(ERROR) << "Unable to set DISPLAY environment variable";
28 }
29 if (setenv("XAUTHORITY", set_var.c_str(), 0) == -1) {
30 LOG(ERROR) << "Unable to set XAUTHORITY environment variable";
31 }
32
33 // Construct the call to Chrome
34 FilePath chrome_path("google-chrome");
35 FilePath job_path(output_path);
36 CommandLine command_line(chrome_path);
37 command_line.AppendSwitchPath(switches::kCloudPrintFile, job_path);
38 command_line.AppendSwitchNative(switches::kCloudPrintJobTitle, job_title);
39 command_line.AppendSwitch(switches::kCloudPrintDeleteFile);
40 command_line.AppendSwitchNative(switches::kCloudPrintPrintTicket,
41 print_ticket);
42 LOG(INFO) << "Call to chrome is " << command_line.GetCommandLineString();
43 if (system(command_line.GetCommandLineString().c_str()) == -1) {
44 LOG(ERROR) << "Unable to call Chrome";
45 exit(CUPS_BACKEND_CANCEL);
46 }
47 LOG(INFO) << "Call to Chrome succeeded";
48 }
49
50 } // namespace printer_driver_util
51
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698