Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_PRINTING_PRINT_SYSTEM_TASK_PROXY_H_ | 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_SYSTEM_TASK_PROXY_H_ |
| 6 #define CHROME_BROWSER_PRINTING_PRINT_SYSTEM_TASK_PROXY_H_ | 6 #define CHROME_BROWSER_PRINTING_PRINT_SYSTEM_TASK_PROXY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/gtest_prod_util.h" | |
| 9 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 12 #include "chrome/browser/ui/webui/print_preview_handler.h" | 13 #include "chrome/browser/ui/webui/print_preview_handler.h" |
| 13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 class DictionaryValue; | 17 class DictionaryValue; |
| 17 class FundamentalValue; | 18 class FundamentalValue; |
| 18 class StringValue; | 19 class StringValue; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace printing { | 22 namespace printing { |
| 22 class PrintBackend; | 23 class PrintBackend; |
| 24 struct PrinterCapsAndDefaults; | |
| 23 } | 25 } |
| 24 | 26 |
| 25 #if defined(UNIT_TEST) && defined(USE_CUPS) && !defined(OS_MACOSX) | 27 #if defined(UNIT_TEST) && defined(USE_CUPS) && !defined(OS_MACOSX) |
| 26 typedef struct cups_option_s cups_option_t; | 28 typedef struct cups_option_s cups_option_t; |
| 27 | 29 |
| 28 namespace printing_internal { | 30 namespace printing_internal { |
| 29 // Helper function to parse the lpoptions custom settings. |num_options| and | 31 // Helper function to parse the lpoptions custom settings. |num_options| and |
| 30 // |options| will be updated if the custom settings for |printer_name| are | 32 // |options| will be updated if the custom settings for |printer_name| are |
| 31 // found, otherwise nothing is done. | 33 // found, otherwise nothing is done. |
| 32 // NOTE: This function is declared here so it can be exposed for unit testing. | 34 // NOTE: This function is declared here so it can be exposed for unit testing. |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 47 void GetDefaultPrinter(); | 49 void GetDefaultPrinter(); |
| 48 | 50 |
| 49 void EnumeratePrinters(); | 51 void EnumeratePrinters(); |
| 50 | 52 |
| 51 void GetPrinterCapabilities(const std::string& printer_name); | 53 void GetPrinterCapabilities(const std::string& printer_name); |
| 52 | 54 |
| 53 private: | 55 private: |
| 54 friend struct content::BrowserThread::DeleteOnThread< | 56 friend struct content::BrowserThread::DeleteOnThread< |
| 55 content::BrowserThread::UI>; | 57 content::BrowserThread::UI>; |
| 56 friend class DeleteTask<PrintSystemTaskProxy>; | 58 friend class DeleteTask<PrintSystemTaskProxy>; |
| 59 #if defined(USE_CUPS) | |
| 60 FRIEND_TEST_ALL_PREFIXES(PrintSystemTaskProxyTest, DetectDuplexModeCUPS); | |
| 61 #endif | |
| 62 | |
| 63 // Only used for testing. | |
| 64 PrintSystemTaskProxy(); | |
|
kmadhusu
2011/11/16 20:43:29
if defined(UNIT_TEST) && defined(USE_CUPS)
Print
Lei Zhang
2011/11/17 00:20:16
Done.
| |
| 65 | |
| 66 #if defined(USE_CUPS) | |
| 67 bool GetPrinterCapabilitiesCUPS( | |
| 68 const printing::PrinterCapsAndDefaults& printer_info, | |
| 69 const std::string& printer_name, | |
| 70 bool* set_color_as_default, | |
| 71 int* printer_color_space_for_color, | |
| 72 int* printer_color_space_for_black, | |
| 73 bool* set_duplex_as_default, | |
| 74 int* default_duplex_setting_value); | |
| 75 #elif defined(OS_WIN) | |
| 76 void GetPrinterCapabilitiesWin( | |
| 77 const printing::PrinterCapsAndDefaults& printer_info, | |
| 78 bool* set_color_as_default, | |
| 79 int* printer_color_space_for_color, | |
| 80 int* printer_color_space_for_black, | |
| 81 bool* set_duplex_as_default, | |
| 82 int* default_duplex_setting_value); | |
| 83 #endif | |
| 57 | 84 |
| 58 void SendDefaultPrinter(const std::string* default_printer, | 85 void SendDefaultPrinter(const std::string* default_printer, |
| 59 const std::string* cloud_print_data); | 86 const std::string* cloud_print_data); |
| 60 void SetupPrinterList(base::ListValue* printers); | 87 void SetupPrinterList(base::ListValue* printers); |
| 61 void SendPrinterCapabilities(base::DictionaryValue* settings_info); | 88 void SendPrinterCapabilities(base::DictionaryValue* settings_info); |
| 62 | 89 |
| 63 ~PrintSystemTaskProxy(); | 90 ~PrintSystemTaskProxy(); |
| 64 | 91 |
| 65 base::WeakPtr<PrintPreviewHandler> handler_; | 92 base::WeakPtr<PrintPreviewHandler> handler_; |
| 66 | 93 |
| 67 scoped_refptr<printing::PrintBackend> print_backend_; | 94 scoped_refptr<printing::PrintBackend> print_backend_; |
| 68 | 95 |
| 69 bool has_logged_printers_count_; | 96 bool has_logged_printers_count_; |
| 70 | 97 |
| 71 DISALLOW_COPY_AND_ASSIGN(PrintSystemTaskProxy); | 98 DISALLOW_COPY_AND_ASSIGN(PrintSystemTaskProxy); |
| 72 }; | 99 }; |
| 73 | 100 |
| 74 #endif // CHROME_BROWSER_PRINTING_PRINT_SYSTEM_TASK_PROXY_H_ | 101 #endif // CHROME_BROWSER_PRINTING_PRINT_SYSTEM_TASK_PROXY_H_ |
| OLD | NEW |