| 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 "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" | 9 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" |
| 10 #include "chromeos/printing/printer_configuration.h" |
| 10 | 11 |
| 11 namespace base { | 12 namespace base { |
| 12 class ListValue; | 13 class ListValue; |
| 13 } // namespace base | 14 } // namespace base |
| 14 | 15 |
| 15 class Profile; | 16 class Profile; |
| 16 | 17 |
| 17 namespace chromeos { | 18 namespace chromeos { |
| 18 namespace settings { | 19 namespace settings { |
| 19 | 20 |
| 20 // Chrome OS CUPS printing settings page UI handler. | 21 // Chrome OS CUPS printing settings page UI handler. |
| 21 class CupsPrintersHandler : public ::settings::SettingsPageUIHandler { | 22 class CupsPrintersHandler : public ::settings::SettingsPageUIHandler { |
| 22 public: | 23 public: |
| 23 explicit CupsPrintersHandler(content::WebUI* webui); | 24 explicit CupsPrintersHandler(content::WebUI* webui); |
| 24 ~CupsPrintersHandler() override; | 25 ~CupsPrintersHandler() override; |
| 25 | 26 |
| 26 // SettingsPageUIHandler overrides: | 27 // SettingsPageUIHandler overrides: |
| 27 void RegisterMessages() override; | 28 void RegisterMessages() override; |
| 28 void OnJavascriptAllowed() override{}; | 29 void OnJavascriptAllowed() override{}; |
| 29 void OnJavascriptDisallowed() override{}; | 30 void OnJavascriptDisallowed() override{}; |
| 30 | 31 |
| 31 private: | 32 private: |
| 32 // Gets all CUPS printers and return it to WebUI. | 33 // Gets all CUPS printers and return it to WebUI. |
| 33 void HandleGetCupsPrintersList(const base::ListValue* args); | 34 void HandleGetCupsPrintersList(const base::ListValue* args); |
| 34 | 35 |
| 35 void HandleUpdateCupsPrinter(const base::ListValue* args); | 36 void HandleUpdateCupsPrinter(const base::ListValue* args); |
| 36 void HandleRemoveCupsPrinter(const base::ListValue* args); | 37 void HandleRemoveCupsPrinter(const base::ListValue* args); |
| 38 void OnRemovedPrinter(const std::string& printer_id, bool success); |
| 39 |
| 40 void HandleAddCupsPrinter(const base::ListValue* args); |
| 41 void OnAddedPrinter(std::unique_ptr<Printer> printer, bool success); |
| 42 void OnAddPrinterError(); |
| 37 | 43 |
| 38 Profile* profile_; | 44 Profile* profile_; |
| 39 base::WeakPtrFactory<CupsPrintersHandler> weak_factory_; | 45 base::WeakPtrFactory<CupsPrintersHandler> weak_factory_; |
| 40 | 46 |
| 41 DISALLOW_COPY_AND_ASSIGN(CupsPrintersHandler); | 47 DISALLOW_COPY_AND_ASSIGN(CupsPrintersHandler); |
| 42 }; | 48 }; |
| 43 | 49 |
| 44 } // namespace settings | 50 } // namespace settings |
| 45 } // namespace chromeos | 51 } // namespace chromeos |
| 46 | 52 |
| 47 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CUPS_PRINTERS_HANDLER_H_ | 53 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CUPS_PRINTERS_HANDLER_H_ |
| OLD | NEW |