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

Side by Side Diff: chrome/browser/printing/print_dialog_cloud.cc

Issue 816403003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/printing/print_dialog_cloud.h" 5 #include "chrome/browser/printing/print_dialog_cloud.h"
6 6
7 7
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 bool result = true; 189 bool result = true;
190 base::DictionaryValue* params = 190 base::DictionaryValue* params =
191 static_cast<base::DictionaryValue*>(parsed_value.get()); 191 static_cast<base::DictionaryValue*>(parsed_value.get());
192 result &= params->GetDouble("dpi", &parameters.dpi); 192 result &= params->GetDouble("dpi", &parameters.dpi);
193 result &= params->GetDouble("min_shrink", &parameters.min_shrink); 193 result &= params->GetDouble("min_shrink", &parameters.min_shrink);
194 result &= params->GetDouble("max_shrink", &parameters.max_shrink); 194 result &= params->GetDouble("max_shrink", &parameters.max_shrink);
195 result &= params->GetBoolean("selection_only", &parameters.selection_only); 195 result &= params->GetBoolean("selection_only", &parameters.selection_only);
196 return result; 196 return result;
197 } 197 }
198 198
199 base::string16 GetSwitchValueString16(const CommandLine& command_line, 199 base::string16 GetSwitchValueString16(const base::CommandLine& command_line,
200 const char* switchName) { 200 const char* switchName) {
201 #if defined(OS_WIN) 201 #if defined(OS_WIN)
202 return command_line.GetSwitchValueNative(switchName); 202 return command_line.GetSwitchValueNative(switchName);
203 #elif defined(OS_POSIX) 203 #elif defined(OS_POSIX)
204 // POSIX Command line string types are different. 204 // POSIX Command line string types are different.
205 CommandLine::StringType native_switch_val; 205 base::CommandLine::StringType native_switch_val;
206 native_switch_val = command_line.GetSwitchValueASCII(switchName); 206 native_switch_val = command_line.GetSwitchValueASCII(switchName);
207 // Convert the ASCII string to UTF16 to prepare to pass. 207 // Convert the ASCII string to UTF16 to prepare to pass.
208 return base::ASCIIToUTF16(native_switch_val); 208 return base::ASCIIToUTF16(native_switch_val);
209 #endif 209 #endif
210 } 210 }
211 211
212 void CloudPrintDataSenderHelper::CallJavascriptFunction( 212 void CloudPrintDataSenderHelper::CallJavascriptFunction(
213 const std::string& function_name, 213 const std::string& function_name,
214 const base::Value& arg1, 214 const base::Value& arg1,
215 const base::Value& arg2) { 215 const base::Value& arg2) {
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 const base::RefCountedMemory* data, 741 const base::RefCountedMemory* data,
742 const base::string16& print_job_title, 742 const base::string16& print_job_title,
743 const base::string16& print_ticket, 743 const base::string16& print_ticket,
744 const std::string& file_type) { 744 const std::string& file_type) {
745 internal_cloud_print_helpers::CreateDialogImpl(browser_context, modal_parent, 745 internal_cloud_print_helpers::CreateDialogImpl(browser_context, modal_parent,
746 data, print_job_title, 746 data, print_job_title,
747 print_ticket, file_type); 747 print_ticket, file_type);
748 } 748 }
749 749
750 bool CreatePrintDialogFromCommandLine(Profile* profile, 750 bool CreatePrintDialogFromCommandLine(Profile* profile,
751 const CommandLine& command_line) { 751 const base::CommandLine& command_line) {
752 DCHECK(command_line.HasSwitch(switches::kCloudPrintFile)); 752 DCHECK(command_line.HasSwitch(switches::kCloudPrintFile));
753 if (!command_line.GetSwitchValuePath(switches::kCloudPrintFile).empty()) { 753 if (!command_line.GetSwitchValuePath(switches::kCloudPrintFile).empty()) {
754 base::FilePath cloud_print_file; 754 base::FilePath cloud_print_file;
755 cloud_print_file = 755 cloud_print_file =
756 command_line.GetSwitchValuePath(switches::kCloudPrintFile); 756 command_line.GetSwitchValuePath(switches::kCloudPrintFile);
757 if (!cloud_print_file.empty()) { 757 if (!cloud_print_file.empty()) {
758 base::string16 print_job_title; 758 base::string16 print_job_title;
759 base::string16 print_job_print_ticket; 759 base::string16 print_job_print_ticket;
760 if (command_line.HasSwitch(switches::kCloudPrintJobTitle)) { 760 if (command_line.HasSwitch(switches::kCloudPrintJobTitle)) {
761 print_job_title = 761 print_job_title =
(...skipping 13 matching lines...) Expand all
775 775
776 print_dialog_cloud::CreatePrintDialogForFile(profile, NULL, 776 print_dialog_cloud::CreatePrintDialogForFile(profile, NULL,
777 cloud_print_file, print_job_title, print_job_print_ticket, file_type); 777 cloud_print_file, print_job_title, print_job_print_ticket, file_type);
778 return true; 778 return true;
779 } 779 }
780 } 780 }
781 return false; 781 return false;
782 } 782 }
783 783
784 } // namespace print_dialog_cloud 784 } // namespace print_dialog_cloud
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698