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