summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-19 09:08:13 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-19 09:08:13 +0000
commit482059293fe85896b865754b710ff997e6b87222 (patch)
tree1ff8bfc0cdbb11b2066860d1d6fbd6969583fd99
parent42113acd82c78ef8347f0b521886226ef77b35c7 (diff)
downloadchromium_src-482059293fe85896b865754b710ff997e6b87222.zip
chromium_src-482059293fe85896b865754b710ff997e6b87222.tar.gz
chromium_src-482059293fe85896b865754b710ff997e6b87222.tar.bz2
Revert 97442 - Code to accept a print ticket on the command line.
It doesn't compile on chromeos (see http://build.chromium.org/p/chromium/builders/Linux%20Clang%20%28ChromiumOS%20dbg%29/builds/9570/steps/compile/logs/stdio, for example). BUG= TEST= Review URL: http://codereview.chromium.org/7639024 TBR=abeera@google.com Review URL: http://codereview.chromium.org/7689001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97445 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/app_controller_mac.mm4
-rw-r--r--chrome/browser/printing/print_dialog_cloud.cc64
-rw-r--r--chrome/browser/printing/print_dialog_cloud.h1
-rw-r--r--chrome/browser/printing/print_dialog_cloud_internal.h10
-rw-r--r--chrome/browser/printing/print_dialog_cloud_uitest.cc1
-rw-r--r--chrome/browser/printing/print_dialog_cloud_unittest.cc14
-rw-r--r--chrome/common/chrome_switches.cc5
-rw-r--r--chrome/common/chrome_switches.h1
8 files changed, 19 insertions, 81 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 4091c5f..2d3a371 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -1107,13 +1107,11 @@ const AEEventClass kAECloudPrintUninstallClass = 'GCPu';
NSString* mime = [[paramList descriptorAtIndex:1] stringValue];
NSString* inputPath = [[paramList descriptorAtIndex:2] stringValue];
NSString* printTitle = [[paramList descriptorAtIndex:3] stringValue];
- NSString* printTicket = [[paramList descriptorAtIndex:4] stringValue];
// Convert the title to UTF 16 as required.
string16 title16 = base::SysNSStringToUTF16(printTitle);
- string16 printTicket16 = base::SysNSStringToUTF16(printTicket);
print_dialog_cloud::CreatePrintDialogForFile(
FilePath([inputPath UTF8String]), title16,
- printTicket16, [mime UTF8String], /*modal=*/false);
+ [mime UTF8String], /*modal=*/false);
}
}
diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc
index b656ff4..fe2e255 100644
--- a/chrome/browser/printing/print_dialog_cloud.cc
+++ b/chrome/browser/printing/print_dialog_cloud.cc
@@ -122,21 +122,6 @@ bool GetPageSetupParameters(const std::string& json,
return result;
}
-string16 GetSwitchValueString16(const CommandLine& command_line,
- const char* switchName) {
-#ifdef OS_WIN
- CommandLine::StringType native_switch_val;
- native_switch_val = command_line.GetSwitchValueNative(switchName);
- return string16(native_switch_val);
-#elif defined(OS_POSIX)
- // POSIX Command line string types are different.
- CommandLine::StringType native_switch_val;
- native_switch_val = command_line.GetSwitchValueASCII(switchName);
- // Convert the ASCII string to UTF16 to prepare to pass.
- return string16(ASCIIToUTF16(native_switch_val));
-#endif
-}
-
void CloudPrintDataSenderHelper::CallJavascriptFunction(
const std::wstring& function_name) {
web_ui_->CallJavascriptFunction(WideToASCII(function_name));
@@ -152,14 +137,6 @@ void CloudPrintDataSenderHelper::CallJavascriptFunction(
web_ui_->CallJavascriptFunction(WideToASCII(function_name), arg1, arg2);
}
-void CloudPrintDataSenderHelper::CallJavascriptFunction(
- const std::wstring& function_name,
- const Value& arg1,
- const Value& arg2,
- const Value& arg3) {
- web_ui_->CallJavascriptFunction(WideToASCII(function_name), arg1, arg2, arg3);
-}
-
// Clears out the pointer we're using to communicate. Either routine is
// potentially expensive enough that stopping whatever is in progress
// is worth it.
@@ -172,11 +149,9 @@ void CloudPrintDataSender::CancelPrintDataFile() {
CloudPrintDataSender::CloudPrintDataSender(CloudPrintDataSenderHelper* helper,
const string16& print_job_title,
- const string16& print_ticket,
const std::string& file_type)
: helper_(helper),
print_job_title_(print_job_title),
- print_ticket_(print_ticket),
file_type_(file_type) {
}
@@ -227,9 +202,6 @@ void CloudPrintDataSender::SendPrintDataFile() {
base::AutoLock lock(lock_);
if (helper_ && print_data_.get()) {
StringValue title(print_job_title_);
- StringValue ticket(print_ticket_);
- // TODO(abodenha): Change Javascript call to pass in print ticket
- // after server side support is added. Add test for it.
// Send the print data to the dialog contents. The JavaScript
// function is a preliminary API for prototyping purposes and is
@@ -242,11 +214,9 @@ void CloudPrintDataSender::SendPrintDataFile() {
CloudPrintFlowHandler::CloudPrintFlowHandler(const FilePath& path_to_file,
const string16& print_job_title,
- const string16& print_ticket,
const std::string& file_type)
: path_to_file_(path_to_file),
print_job_title_(print_job_title),
- print_ticket_(print_ticket),
file_type_(file_type) {
}
@@ -357,7 +327,6 @@ CloudPrintFlowHandler::CreateCloudPrintDataSender() {
print_data_helper_.reset(new CloudPrintDataSenderHelper(web_ui_));
return new CloudPrintDataSender(print_data_helper_.get(),
print_job_title_,
- print_ticket_,
file_type_);
}
@@ -439,12 +408,10 @@ CloudPrintHtmlDialogDelegate::CloudPrintHtmlDialogDelegate(
int width, int height,
const std::string& json_arguments,
const string16& print_job_title,
- const string16& print_ticket,
const std::string& file_type,
bool modal)
: flow_handler_(new CloudPrintFlowHandler(path_to_file,
print_job_title,
- print_ticket,
file_type)),
modal_(modal),
owns_flow_handler_(true),
@@ -557,7 +524,6 @@ bool CloudPrintHtmlDialogDelegate::HandleContextMenu(
// Called from the UI thread, starts up the dialog.
void CreateDialogImpl(const FilePath& path_to_file,
const string16& print_job_title,
- const string16& print_ticket,
const std::string& file_type,
bool modal) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -597,8 +563,8 @@ void CreateDialogImpl(const FilePath& path_to_file,
HtmlDialogUIDelegate* dialog_delegate =
new internal_cloud_print_helpers::CloudPrintHtmlDialogDelegate(
- path_to_file, width, height, std::string(), job_title, print_ticket,
- file_type, modal);
+ path_to_file, width, height, std::string(), job_title, file_type,
+ modal);
if (modal) {
DCHECK(browser);
browser->BrowserShowHtmlDialog(dialog_delegate, NULL);
@@ -624,7 +590,6 @@ namespace print_dialog_cloud {
// changing page setup parameters while the dialog is active.
void CreatePrintDialogForFile(const FilePath& path_to_file,
const string16& print_job_title,
- const string16& print_ticket,
const std::string& file_type,
bool modal) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE) ||
@@ -635,7 +600,6 @@ void CreatePrintDialogForFile(const FilePath& path_to_file,
NewRunnableFunction(&internal_cloud_print_helpers::CreateDialogImpl,
path_to_file,
print_job_title,
- print_ticket,
file_type,
modal));
}
@@ -647,26 +611,28 @@ bool CreatePrintDialogFromCommandLine(const CommandLine& command_line) {
command_line.GetSwitchValuePath(switches::kCloudPrintFile);
if (!cloud_print_file.empty()) {
string16 print_job_title;
- string16 print_job_print_ticket;
if (command_line.HasSwitch(switches::kCloudPrintJobTitle)) {
- print_job_title =
- internal_cloud_print_helpers::GetSwitchValueString16(
- command_line, switches::kCloudPrintJobTitle);
- }
- if (command_line.HasSwitch(switches::kCloudPrintPrintTicket)) {
- print_job_print_ticket =
- internal_cloud_print_helpers::GetSwitchValueString16(
- command_line, switches::kCloudPrintPrintTicket);
+#ifdef OS_WIN
+ CommandLine::StringType native_job_title;
+ native_job_title = command_line.GetSwitchValueNative(
+ switches::kCloudPrintJobTitle);
+ print_job_title = string16(native_job_title);
+#elif defined(OS_POSIX)
+ // POSIX Command line string types are different.
+ CommandLine::StringType native_job_title;
+ native_job_title = command_line.GetSwitchValueASCII(
+ switches::kCloudPrintJobTitle);
+ // Convert the ASCII string to UTF16 to prepare to pass.
+ print_job_title = string16(ASCIIToUTF16(native_job_title));
+#endif
}
std::string file_type = "application/pdf";
if (command_line.HasSwitch(switches::kCloudPrintFileType)) {
file_type = command_line.GetSwitchValueASCII(
switches::kCloudPrintFileType);
}
-
print_dialog_cloud::CreatePrintDialogForFile(cloud_print_file,
print_job_title,
- print_job_print_ticket,
file_type,
false);
return true;
diff --git a/chrome/browser/printing/print_dialog_cloud.h b/chrome/browser/printing/print_dialog_cloud.h
index 2631345..1c91619 100644
--- a/chrome/browser/printing/print_dialog_cloud.h
+++ b/chrome/browser/printing/print_dialog_cloud.h
@@ -20,7 +20,6 @@ namespace print_dialog_cloud {
// dialog, it will return immediately. The dialog is handled asynchronously.
void CreatePrintDialogForFile(const FilePath& path_to_file,
const string16& print_job_title,
- const string16& print_ticket,
const std::string& file_type,
bool modal);
diff --git a/chrome/browser/printing/print_dialog_cloud_internal.h b/chrome/browser/printing/print_dialog_cloud_internal.h
index 6e04242..8c6e051 100644
--- a/chrome/browser/printing/print_dialog_cloud_internal.h
+++ b/chrome/browser/printing/print_dialog_cloud_internal.h
@@ -42,10 +42,6 @@ class CloudPrintDataSenderHelper {
virtual void CallJavascriptFunction(const std::wstring& function_name,
const base::Value& arg1,
const base::Value& arg2);
- virtual void CallJavascriptFunction(const std::wstring& function_name,
- const base::Value& arg1,
- const base::Value& arg2,
- const base::Value& arg3);
private:
WebUI* web_ui_;
@@ -63,7 +59,6 @@ class CloudPrintDataSender
// lifetime of the helper.
CloudPrintDataSender(CloudPrintDataSenderHelper* helper,
const string16& print_job_title,
- const string16& print_ticket,
const std::string& file_type);
// Calls to read in the PDF file (on the FILE thread) then send that
@@ -85,7 +80,6 @@ class CloudPrintDataSender
CloudPrintDataSenderHelper* volatile helper_;
scoped_ptr<base::StringValue> print_data_;
string16 print_job_title_;
- string16 print_ticket_;
std::string file_type_;
DISALLOW_COPY_AND_ASSIGN(CloudPrintDataSender);
@@ -105,7 +99,6 @@ class CloudPrintFlowHandler : public WebUIMessageHandler,
public:
CloudPrintFlowHandler(const FilePath& path_to_file,
const string16& print_job_title,
- const string16& print_ticket,
const std::string& file_type);
virtual ~CloudPrintFlowHandler();
@@ -139,7 +132,6 @@ class CloudPrintFlowHandler : public WebUIMessageHandler,
NotificationRegistrar registrar_;
FilePath path_to_file_;
string16 print_job_title_;
- string16 print_ticket_;
std::string file_type_;
scoped_refptr<CloudPrintDataSender> print_data_sender_;
scoped_ptr<CloudPrintDataSenderHelper> print_data_helper_;
@@ -156,7 +148,6 @@ class CloudPrintHtmlDialogDelegate : public HtmlDialogUIDelegate {
int width, int height,
const std::string& json_arguments,
const string16& print_job_title,
- const string16& print_ticket,
const std::string& file_type,
bool modal);
virtual ~CloudPrintHtmlDialogDelegate();
@@ -198,7 +189,6 @@ class CloudPrintHtmlDialogDelegate : public HtmlDialogUIDelegate {
void CreateDialogImpl(const FilePath& path_to_file,
const string16& print_job_title,
- const string16& print_ticket,
const std::string& file_type,
bool modal);
diff --git a/chrome/browser/printing/print_dialog_cloud_uitest.cc b/chrome/browser/printing/print_dialog_cloud_uitest.cc
index a1285e5..d381bc8 100644
--- a/chrome/browser/printing/print_dialog_cloud_uitest.cc
+++ b/chrome/browser/printing/print_dialog_cloud_uitest.cc
@@ -202,7 +202,6 @@ class PrintDialogCloudTest : public InProcessBrowserTest {
NewRunnableFunction(&internal_cloud_print_helpers::CreateDialogImpl,
path_to_pdf,
string16(),
- string16(),
std::string("application/pdf"),
true));
}
diff --git a/chrome/browser/printing/print_dialog_cloud_unittest.cc b/chrome/browser/printing/print_dialog_cloud_unittest.cc
index 25b9da9..327c43c 100644
--- a/chrome/browser/printing/print_dialog_cloud_unittest.cc
+++ b/chrome/browser/printing/print_dialog_cloud_unittest.cc
@@ -41,8 +41,6 @@ static const char* const kPDFTestFile = "printing/cloud_print_unittest.pdf";
static const char* const kEmptyPDFTestFile =
"printing/cloud_print_emptytest.pdf";
static const char* const kMockJobTitle = "Mock Job Title";
-static const char* const kMockPrintTicket = "Resolution=300";
-
FilePath GetTestDataFileName() {
FilePath test_data_directory;
@@ -86,10 +84,8 @@ class MockCloudPrintFlowHandler
public:
MockCloudPrintFlowHandler(const FilePath& path,
const string16& title,
- const string16& print_ticket,
- const std::string& file_type
- )
- : CloudPrintFlowHandler(path, title, print_ticket, file_type) {}
+ const std::string& file_type)
+ : CloudPrintFlowHandler(path, title, file_type) {}
MOCK_METHOD0(DestructorCalled, void());
MOCK_METHOD0(RegisterMessages, void());
MOCK_METHOD3(Observe,
@@ -221,12 +217,10 @@ class CloudPrintDataSenderTest : public testing::Test {
protected:
virtual void SetUp() {
string16 mock_job_title(ASCIIToUTF16(kMockJobTitle));
- string16 mock_print_ticket(ASCIIToUTF16(kMockPrintTicket));
mock_helper_.reset(new MockCloudPrintDataSenderHelper);
print_data_sender_ =
new CloudPrintDataSender(mock_helper_.get(),
mock_job_title,
- mock_print_ticket,
std::string("application/pdf"));
}
@@ -302,11 +296,9 @@ class CloudPrintHtmlDialogDelegateTest : public testing::Test {
virtual void SetUp() {
FilePath mock_path;
string16 mock_title;
- string16 mock_print_ticket;
std::string mock_file_type;
MockCloudPrintFlowHandler* handler =
- new MockCloudPrintFlowHandler(mock_path, mock_print_ticket,
- mock_title, mock_file_type);
+ new MockCloudPrintFlowHandler(mock_path, mock_title, mock_file_type);
mock_flow_handler_ = handler->AsWeakPtr();
EXPECT_CALL(*mock_flow_handler_.get(), SetDialogDelegate(_));
EXPECT_CALL(*mock_flow_handler_.get(), SetDialogDelegate(NULL));
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 800efdc..c64afc3 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -126,11 +126,6 @@ const char kCloudPrintFile[] = "cloud-print-file";
// Defaults to "application/pdf" if unspecified.
const char kCloudPrintFileType[] = "cloud-print-file-type";
-// Used with kCloudPrintFile to specify a JSON print ticket for the resulting
-// print job.
-// Defaults to null if unspecified.
-const char kCloudPrintPrintTicket[] = "cloud-print-print-ticket";
-
// Used with kCloudPrintFile to specify a title for the resulting print
// job.
const char kCloudPrintJobTitle[] = "cloud-print-job-title";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 74ac8da..ab81c2f 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -53,7 +53,6 @@ extern const char kCloudPrintDeleteFile[];
extern const char kCloudPrintFile[];
extern const char kCloudPrintJobTitle[];
extern const char kCloudPrintFileType[];
-extern const char kCloudPrintPrintTicket[];
extern const char kCloudPrintProxyId[];
extern const char kCloudPrintServiceURL[];
extern const char kComponentUpdaterDebug[];