summaryrefslogtreecommitdiffstats
path: root/chrome/browser/printing
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-14 20:24:37 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-14 20:24:37 +0000
commit675a1ae4fbc455339214511b96b31675996869fc (patch)
treeecec6bededbeb3ece31069f0940e0ac425748bab /chrome/browser/printing
parent67eb33fa89b2d667a3484f714c99b183909720ad (diff)
downloadchromium_src-675a1ae4fbc455339214511b96b31675996869fc.zip
chromium_src-675a1ae4fbc455339214511b96b31675996869fc.tar.gz
chromium_src-675a1ae4fbc455339214511b96b31675996869fc.tar.bz2
Cleanup various bits of printing code.
Review URL: https://codereview.chromium.org/27146002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228518 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/printing')
-rw-r--r--chrome/browser/printing/print_system_task_proxy.cc26
-rw-r--r--chrome/browser/printing/print_system_task_proxy.h31
2 files changed, 9 insertions, 48 deletions
diff --git a/chrome/browser/printing/print_system_task_proxy.cc b/chrome/browser/printing/print_system_task_proxy.cc
index 74819f7..9957512 100644
--- a/chrome/browser/printing/print_system_task_proxy.cc
+++ b/chrome/browser/printing/print_system_task_proxy.cc
@@ -4,8 +4,6 @@
#include "chrome/browser/printing/print_system_task_proxy.h"
-#include <ctype.h>
-
#include <string>
#include "base/bind.h"
@@ -17,11 +15,6 @@
#include "printing/print_job_constants.h"
#include "printing/print_settings.h"
-#if defined(USE_CUPS)
-#include <cups/cups.h>
-#include <cups/ppd.h>
-#endif
-
using content::BrowserThread;
const char kPrinterId[] = "printerId";
@@ -63,19 +56,18 @@ void PrintSystemTaskProxy::SendDefaultPrinter(
void PrintSystemTaskProxy::EnumeratePrinters() {
VLOG(1) << "Enumerate printers start";
- ListValue* printers = new ListValue;
+ base::ListValue* printers = new base::ListValue;
printing::PrinterList printer_list;
print_backend_->EnumeratePrinters(&printer_list);
if (!has_logged_printers_count_) {
// Record the total number of printers.
- UMA_HISTOGRAM_COUNTS("PrintPreview.NumberOfPrinters",
- printer_list.size());
+ UMA_HISTOGRAM_COUNTS("PrintPreview.NumberOfPrinters", printer_list.size());
}
int i = 0;
for (printing::PrinterList::iterator iter = printer_list.begin();
iter != printer_list.end(); ++iter, ++i) {
- DictionaryValue* printer_info = new DictionaryValue;
+ base::DictionaryValue* printer_info = new base::DictionaryValue;
std::string printerName;
#if defined(OS_MACOSX)
// On Mac, |iter->printer_description| specifies the printer name and
@@ -97,7 +89,7 @@ void PrintSystemTaskProxy::EnumeratePrinters() {
base::Bind(&PrintSystemTaskProxy::SetupPrinterList, this, printers));
}
-void PrintSystemTaskProxy::SetupPrinterList(ListValue* printers) {
+void PrintSystemTaskProxy::SetupPrinterList(base::ListValue* printers) {
if (handler_.get())
handler_->SetupPrinterList(*printers);
delete printers;
@@ -115,7 +107,7 @@ void PrintSystemTaskProxy::GetPrinterCapabilities(
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&PrintSystemTaskProxy::SendFailedToGetPrinterCapabilities,
- this, printer_name));
+ this, printer_name));
return;
}
@@ -125,11 +117,11 @@ void PrintSystemTaskProxy::GetPrinterCapabilities(
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&PrintSystemTaskProxy::SendFailedToGetPrinterCapabilities,
- this, printer_name));
+ this, printer_name));
return;
}
- DictionaryValue settings_info;
+ base::DictionaryValue settings_info;
settings_info.SetString(kPrinterId, printer_name);
settings_info.SetBoolean(kDisableColorOption, !info.color_changeable);
settings_info.SetBoolean(printing::kSettingSetColorAsDefault,
@@ -139,7 +131,7 @@ void PrintSystemTaskProxy::GetPrinterCapabilities(
// Refactor pld API code below
if (info.duplex_capable) {
settings_info.SetBoolean(kSetDuplexAsDefault,
- info.duplex_default != printing::SIMPLEX);
+ info.duplex_default != printing::SIMPLEX);
settings_info.SetInteger(kPrinterDefaultDuplexValue,
printing::LONG_EDGE);
} else {
@@ -155,7 +147,7 @@ void PrintSystemTaskProxy::GetPrinterCapabilities(
}
void PrintSystemTaskProxy::SendPrinterCapabilities(
- DictionaryValue* settings_info) {
+ base::DictionaryValue* settings_info) {
if (handler_.get())
handler_->SendPrinterCapabilities(*settings_info);
delete settings_info;
diff --git a/chrome/browser/printing/print_system_task_proxy.h b/chrome/browser/printing/print_system_task_proxy.h
index 33c6945..7622676 100644
--- a/chrome/browser/printing/print_system_task_proxy.h
+++ b/chrome/browser/printing/print_system_task_proxy.h
@@ -7,11 +7,9 @@
#include <string>
-#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/sequenced_task_runner_helpers.h"
-#include "build/build_config.h"
#include "content/public/browser/browser_thread.h"
class PrintPreviewHandler;
@@ -26,21 +24,6 @@ class PrintBackend;
struct PrinterCapsAndDefaults;
}
-#if defined(UNIT_TEST) && defined(USE_CUPS) && !defined(OS_MACOSX)
-typedef struct cups_option_s cups_option_t;
-
-namespace printing_internal {
-// Helper function to parse the lpoptions custom settings. |num_options| and
-// |options| will be updated if the custom settings for |printer_name| are
-// found, otherwise nothing is done.
-// NOTE: This function is declared here so it can be exposed for unit testing.
-void parse_lpoptions(const base::FilePath& filepath,
- const std::string& printer_name, int* num_options,
- cups_option_t** options);
-} // namespace printing_internal
-
-#endif
-
class PrintSystemTaskProxy
: public base::RefCountedThreadSafe<
PrintSystemTaskProxy, content::BrowserThread::DeleteOnUIThread> {
@@ -60,20 +43,6 @@ class PrintSystemTaskProxy
content::BrowserThread::UI>;
friend class base::DeleteHelper<PrintSystemTaskProxy>;
-#if defined(UNIT_TEST) && defined(USE_CUPS)
- FRIEND_TEST_ALL_PREFIXES(PrintSystemTaskProxyTest, DetectDuplexModeCUPS);
- FRIEND_TEST_ALL_PREFIXES(PrintSystemTaskProxyTest, DetectNoDuplexModeCUPS);
-#endif
-
- bool ParsePrinterCapabilities(
- const printing::PrinterCapsAndDefaults& printer_info,
- const std::string& printer_name,
- bool* set_color_as_default,
- int* printer_color_space_for_color,
- int* printer_color_space_for_black,
- bool* set_duplex_as_default,
- int* default_duplex_setting_value);
-
void SendDefaultPrinter(const std::string& default_printer,
const std::string& cloud_print_data);
void SetupPrinterList(base::ListValue* printers);