OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_PRINTING_PRINT_SYSTEM_TASK_PROXY_H_ | |
6 #define CHROME_BROWSER_PRINTING_PRINT_SYSTEM_TASK_PROXY_H_ | |
7 #pragma once | |
8 | |
9 #include "base/memory/ref_counted.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "build/build_config.h" | |
12 #include "chrome/browser/ui/webui/print_preview_handler.h" | |
13 #include "content/browser/browser_thread.h" | |
14 | |
15 namespace base { | |
16 class DictionaryValue; | |
17 class FundamentalValue; | |
18 class StringValue; | |
19 } | |
20 | |
21 namespace printing { | |
22 class PrintBackend; | |
23 } | |
24 | |
25 #if defined(UNIT_TEST) && defined(USE_CUPS) && !defined(OS_MACOSX) | |
26 typedef struct cups_option_s cups_option_t; | |
27 | |
28 namespace printing_internal { | |
29 // Helper function to parse the lpoptions custom settings. |num_options| and | |
30 // |options| will be updated if the custom settings for |printer_name| are | |
31 // found, otherwise nothing is done. | |
32 // NOTE: This function is declared here so it can be exposed for unit testing. | |
33 void parse_lpoptions(const FilePath& filepath, const std::string& printer_name, | |
34 int* num_options, cups_option_t** options); | |
35 } // namespace printing_internal | |
36 | |
37 #endif | |
38 | |
39 class PrintSystemTaskProxy | |
40 : public base::RefCountedThreadSafe<PrintSystemTaskProxy, | |
41 BrowserThread::DeleteOnUIThread> { | |
42 public: | |
43 PrintSystemTaskProxy(const base::WeakPtr<PrintPreviewHandler>& handler, | |
44 printing::PrintBackend* print_backend, | |
45 bool has_logged_printers_count); | |
46 | |
47 void GetDefaultPrinter(); | |
48 | |
49 void EnumeratePrinters(); | |
50 | |
51 void GetPrinterCapabilities(const std::string& printer_name); | |
52 | |
53 private: | |
54 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | |
55 friend class DeleteTask<PrintSystemTaskProxy>; | |
56 | |
57 void SendDefaultPrinter(const base::StringValue* default_printer, | |
58 const base::StringValue* cloud_print_data); | |
59 void SetupPrinterList(base::ListValue* printers); | |
60 void SendPrinterCapabilities(base::DictionaryValue* settings_info); | |
61 | |
62 ~PrintSystemTaskProxy(); | |
63 | |
64 base::WeakPtr<PrintPreviewHandler> handler_; | |
65 | |
66 scoped_refptr<printing::PrintBackend> print_backend_; | |
67 | |
68 bool has_logged_printers_count_; | |
69 | |
70 DISALLOW_COPY_AND_ASSIGN(PrintSystemTaskProxy); | |
71 }; | |
72 | |
73 #endif // CHROME_BROWSER_PRINTING_PRINT_SYSTEM_TASK_PROXY_H_ | |
OLD | NEW |