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

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

Issue 7222011: Linux Virtual Printer Driver (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: changed command_line_string to GetCommandLineString Created 9 years, 5 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 | Annotate | Revision Log
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 void LaunchPrintDialog(std::string output_path, std::string job_title,
17 std::string current_user) {
18 std::string set_var;
19
20 // Set Environment variable to control display.
21 set_var="/home/" + current_user + "/.Xauthority";
22 if(setenv("DISPLAY",":0.0",0) == -1) {
23 LOG(ERROR) << "Unable to set DISPLAY environment variable";
24 }
25 if(setenv("XAUTHORITY",set_var.c_str(),0) == -1) {
26 LOG(ERROR) << "Unable to set XAUTHORITY environment variable";
27 }
28
29 // Construct the call to Chrome
30
31 FilePath chrome_path("google-chrome");
32 FilePath job_path(output_path);
33 CommandLine command_line(chrome_path);
34 command_line.AppendSwitchPath(switches::kCloudPrintFile,job_path);
35 command_line.AppendSwitchNative(switches::kCloudPrintJobTitle, job_title);
36 command_line.AppendSwitch(switches::kCloudPrintDeleteFile);
37 LOG(INFO) << "Call to chrome is " << command_line.GetCommandLineString();
38
39 if(system(command_line.GetCommandLineString().c_str())== -1 ) {
40 LOG(ERROR) << "Unable to call Chrome";
41 exit(CUPS_BACKEND_CANCEL);
42 }
43
44 else {
45 LOG(INFO) << "Call to Chrome succeeded";
46 }
47 }
48
OLDNEW
« no previous file with comments | « cloud_print/virtual_driver/posix/backend.gyp ('k') | cloud_print/virtual_driver/posix/printer_driver_util_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698