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

Side by Side Diff: chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.h

Issue 2975013002: Make chromeos CUPS printing code namespaces consistent. (Closed)
Patch Set: Rebase Created 3 years, 5 months 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_UI_WEBUI_SETTINGS_CHROMEOS_CUPS_PRINTERS_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CUPS_PRINTERS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CUPS_PRINTERS_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CUPS_PRINTERS_HANDLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "chrome/browser/chromeos/printing/printer_configurer.h" 14 #include "chrome/browser/chromeos/printing/printer_configurer.h"
15 #include "chrome/browser/chromeos/printing/printer_detector.h" 15 #include "chrome/browser/chromeos/printing/printer_detector.h"
16 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" 16 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
17 #include "chromeos/printing/ppd_provider.h" 17 #include "chromeos/printing/ppd_provider.h"
18 #include "chromeos/printing/printer_configuration.h" 18 #include "chromeos/printing/printer_configuration.h"
19 #include "ui/shell_dialogs/select_file_dialog.h" 19 #include "ui/shell_dialogs/select_file_dialog.h"
20 20
21 namespace base { 21 namespace base {
22 class ListValue; 22 class ListValue;
23 } // namespace base 23 } // namespace base
24 24
25 class Profile; 25 class Profile;
26 26
27 namespace chromeos { 27 namespace chromeos {
28 namespace printing {
29 class PpdProvider;
30 }
31 28
32 class CombiningPrinterDetector; 29 class CombiningPrinterDetector;
30 class PpdProvider;
33 31
34 namespace settings { 32 namespace settings {
35 33
36 // Chrome OS CUPS printing settings page UI handler. 34 // Chrome OS CUPS printing settings page UI handler.
37 class CupsPrintersHandler : public ::settings::SettingsPageUIHandler, 35 class CupsPrintersHandler : public ::settings::SettingsPageUIHandler,
38 public ui::SelectFileDialog::Listener, 36 public ui::SelectFileDialog::Listener,
39 public PrinterDetector::Observer { 37 public PrinterDetector::Observer {
40 public: 38 public:
41 explicit CupsPrintersHandler(content::WebUI* webui); 39 explicit CupsPrintersHandler(content::WebUI* webui);
42 ~CupsPrintersHandler() override; 40 ~CupsPrintersHandler() override;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 80
83 // Given a manufacturer, get a list of all models of printers for which we can 81 // Given a manufacturer, get a list of all models of printers for which we can
84 // get drivers. Takes two arguments - the callback id and the manufacturer 82 // get drivers. Takes two arguments - the callback id and the manufacturer
85 // name for which we want to list models. The callback will be called with 83 // name for which we want to list models. The callback will be called with
86 // {success: <boolean>, models: Array<string>}. 84 // {success: <boolean>, models: Array<string>}.
87 void HandleGetCupsPrinterModels(const base::ListValue* args); 85 void HandleGetCupsPrinterModels(const base::ListValue* args);
88 86
89 void HandleSelectPPDFile(const base::ListValue* args); 87 void HandleSelectPPDFile(const base::ListValue* args);
90 88
91 // PpdProvider callback handlers. 89 // PpdProvider callback handlers.
92 void ResolveManufacturersDone( 90 void ResolveManufacturersDone(const std::string& js_callback,
93 const std::string& js_callback, 91 PpdProvider::CallbackResultCode result_code,
94 printing::PpdProvider::CallbackResultCode result_code, 92 const std::vector<std::string>& available);
95 const std::vector<std::string>& available); 93 void ResolvePrintersDone(const std::string& js_callback,
96 void ResolvePrintersDone( 94 PpdProvider::CallbackResultCode result_code,
97 const std::string& js_callback, 95 const std::vector<std::string>& available);
98 printing::PpdProvider::CallbackResultCode result_code,
99 const std::vector<std::string>& available);
100 96
101 // ui::SelectFileDialog::Listener override: 97 // ui::SelectFileDialog::Listener override:
102 void FileSelected(const base::FilePath& path, 98 void FileSelected(const base::FilePath& path,
103 int index, 99 int index,
104 void* params) override; 100 void* params) override;
105 101
106 void HandleStartDiscovery(const base::ListValue* args); 102 void HandleStartDiscovery(const base::ListValue* args);
107 void HandleStopDiscovery(const base::ListValue* args); 103 void HandleStopDiscovery(const base::ListValue* args);
108 104
109 // PrinterDetector::Observer implementations: 105 // PrinterDetector::Observer implementations:
110 void OnPrintersFound(const std::vector<Printer>& printers) override; 106 void OnPrintersFound(const std::vector<Printer>& printers) override;
111 void OnPrinterScanComplete() override; 107 void OnPrinterScanComplete() override;
112 108
113 // Invokes debugd to add the printer to CUPS. If |ipp_everywhere| is true, 109 // Invokes debugd to add the printer to CUPS. If |ipp_everywhere| is true,
114 // automatic configuration will be attempted and |ppd_path| is ignored. 110 // automatic configuration will be attempted and |ppd_path| is ignored.
115 // |ppd_path| is the path to a Postscript Printer Description file that will 111 // |ppd_path| is the path to a Postscript Printer Description file that will
116 // be used to configure the printer capabilities. This file must be in 112 // be used to configure the printer capabilities. This file must be in
117 // Downloads or the PPD Cache. 113 // Downloads or the PPD Cache.
118 void AddPrinterToCups(std::unique_ptr<Printer> printer, 114 void AddPrinterToCups(std::unique_ptr<Printer> printer,
119 const base::FilePath& ppd_path, 115 const base::FilePath& ppd_path,
120 bool ipp_everywhere); 116 bool ipp_everywhere);
121 117
122 std::unique_ptr<CombiningPrinterDetector> printer_detector_; 118 std::unique_ptr<CombiningPrinterDetector> printer_detector_;
123 scoped_refptr<printing::PpdProvider> ppd_provider_; 119 scoped_refptr<PpdProvider> ppd_provider_;
124 std::unique_ptr<PrinterConfigurer> printer_configurer_; 120 std::unique_ptr<PrinterConfigurer> printer_configurer_;
125 121
126 Profile* profile_; 122 Profile* profile_;
127 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; 123 scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
128 std::string webui_callback_id_; 124 std::string webui_callback_id_;
129 125
130 base::WeakPtrFactory<CupsPrintersHandler> weak_factory_; 126 base::WeakPtrFactory<CupsPrintersHandler> weak_factory_;
131 127
132 DISALLOW_COPY_AND_ASSIGN(CupsPrintersHandler); 128 DISALLOW_COPY_AND_ASSIGN(CupsPrintersHandler);
133 }; 129 };
134 130
135 } // namespace settings 131 } // namespace settings
136 } // namespace chromeos 132 } // namespace chromeos
137 133
138 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CUPS_PRINTERS_HANDLER_H_ 134 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CUPS_PRINTERS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698