| OLD | NEW |
| 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/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 13 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" | 14 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" |
| 14 #include "chromeos/printing/ppd_provider.h" | 15 #include "chromeos/printing/ppd_provider.h" |
| 15 #include "chromeos/printing/printer_configuration.h" | 16 #include "chromeos/printing/printer_configuration.h" |
| 16 #include "chromeos/printing/printer_discoverer.h" | 17 #include "chromeos/printing/printer_discoverer.h" |
| 17 #include "ui/shell_dialogs/select_file_dialog.h" | 18 #include "ui/shell_dialogs/select_file_dialog.h" |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 class ListValue; | 21 class ListValue; |
| 21 } // namespace base | 22 } // namespace base |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 int index, | 82 int index, |
| 82 void* params) override; | 83 void* params) override; |
| 83 | 84 |
| 84 void HandleStartDiscovery(const base::ListValue* args); | 85 void HandleStartDiscovery(const base::ListValue* args); |
| 85 void HandleStopDiscovery(const base::ListValue* args); | 86 void HandleStopDiscovery(const base::ListValue* args); |
| 86 | 87 |
| 87 // chromeos::PrinterDiscoverer::Observer override: | 88 // chromeos::PrinterDiscoverer::Observer override: |
| 88 void OnPrintersFound(const std::vector<Printer>& printers) override; | 89 void OnPrintersFound(const std::vector<Printer>& printers) override; |
| 89 void OnDiscoveryDone() override; | 90 void OnDiscoveryDone() override; |
| 90 | 91 |
| 92 // Invokes debugd to add the printer to CUPS. If |ipp_everywhere| is true, |
| 93 // automatic configuration will be attempted and |ppd_path| is ignored. |
| 94 // |ppd_path| is the path to a Postscript Printer Description file that will |
| 95 // be used to configure the printer capabilities. This file must be in |
| 96 // Downloads or the PPD Cache. |
| 97 void AddPrinterToCups(std::unique_ptr<Printer> printer, |
| 98 const base::FilePath& ppd_path, |
| 99 bool ipp_everywhere); |
| 100 |
| 101 // Callback for PpdProvider::ResolveCallback. |
| 102 void OnPPDResolved(std::unique_ptr<Printer> printer, |
| 103 printing::PpdProvider::CallbackResultCode result, |
| 104 base::FilePath ppd_path); |
| 105 |
| 91 std::unique_ptr<chromeos::PrinterDiscoverer> printer_discoverer_; | 106 std::unique_ptr<chromeos::PrinterDiscoverer> printer_discoverer_; |
| 92 std::unique_ptr<chromeos::printing::PpdProvider> ppd_provider_; | 107 std::unique_ptr<chromeos::printing::PpdProvider> ppd_provider_; |
| 93 | 108 |
| 94 Profile* profile_; | 109 Profile* profile_; |
| 95 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; | 110 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; |
| 96 std::string webui_callback_id_; | 111 std::string webui_callback_id_; |
| 97 | 112 |
| 98 base::WeakPtrFactory<CupsPrintersHandler> weak_factory_; | 113 base::WeakPtrFactory<CupsPrintersHandler> weak_factory_; |
| 99 | 114 |
| 100 DISALLOW_COPY_AND_ASSIGN(CupsPrintersHandler); | 115 DISALLOW_COPY_AND_ASSIGN(CupsPrintersHandler); |
| 101 }; | 116 }; |
| 102 | 117 |
| 103 } // namespace settings | 118 } // namespace settings |
| 104 } // namespace chromeos | 119 } // namespace chromeos |
| 105 | 120 |
| 106 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CUPS_PRINTERS_HANDLER_H_ | 121 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CUPS_PRINTERS_HANDLER_H_ |
| OLD | NEW |