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

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

Issue 2333283004: [CUPS] Implement the UI handler for adding a new printer. (Closed)
Patch Set: Address michaelpg@'s offline comment. Created 4 years, 2 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 "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 #include "ui/shell_dialogs/select_file_dialog.h" 11 #include "ui/shell_dialogs/select_file_dialog.h"
11 12
12 namespace base { 13 namespace base {
13 class ListValue; 14 class ListValue;
14 } // namespace base 15 } // namespace base
15 16
16 class Profile; 17 class Profile;
17 18
18 namespace chromeos { 19 namespace chromeos {
19 namespace settings { 20 namespace settings {
20 21
21 // Chrome OS CUPS printing settings page UI handler. 22 // Chrome OS CUPS printing settings page UI handler.
22 class CupsPrintersHandler : public ::settings::SettingsPageUIHandler, 23 class CupsPrintersHandler : public ::settings::SettingsPageUIHandler,
23 public ui::SelectFileDialog::Listener { 24 public ui::SelectFileDialog::Listener {
24 public: 25 public:
25 explicit CupsPrintersHandler(content::WebUI* webui); 26 explicit CupsPrintersHandler(content::WebUI* webui);
26 ~CupsPrintersHandler() override; 27 ~CupsPrintersHandler() override;
27 28
28 // SettingsPageUIHandler overrides: 29 // SettingsPageUIHandler overrides:
29 void RegisterMessages() override; 30 void RegisterMessages() override;
30 void OnJavascriptAllowed() override{}; 31 void OnJavascriptAllowed() override{};
31 void OnJavascriptDisallowed() override{}; 32 void OnJavascriptDisallowed() override{};
32 33
33 private: 34 private:
34 // Gets all CUPS printers and return it to WebUI. 35 // Gets all CUPS printers and return it to WebUI.
35 void HandleGetCupsPrintersList(const base::ListValue* args); 36 void HandleGetCupsPrintersList(const base::ListValue* args);
36 void HandleUpdateCupsPrinter(const base::ListValue* args); 37 void HandleUpdateCupsPrinter(const base::ListValue* args);
37 void HandleRemoveCupsPrinter(const base::ListValue* args); 38 void HandleRemoveCupsPrinter(const base::ListValue* args);
39 void OnRemovedPrinter(const std::string& printer_id, bool success);
40
41 void HandleAddCupsPrinter(const base::ListValue* args);
42 void OnAddedPrinter(std::unique_ptr<Printer> printer, bool success);
43 void OnAddPrinterError();
44
38 void HandleSelectPPDFile(const base::ListValue* args); 45 void HandleSelectPPDFile(const base::ListValue* args);
39 46
40 // ui::SelectFileDialog::Listener override: 47 // ui::SelectFileDialog::Listener override:
41 void FileSelected(const base::FilePath& path, 48 void FileSelected(const base::FilePath& path,
42 int index, 49 int index,
43 void* params) override; 50 void* params) override;
44 51
45 Profile* profile_; 52 Profile* profile_;
46 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; 53 scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
47 std::string webui_callback_id_; 54 std::string webui_callback_id_;
48 55
49 base::WeakPtrFactory<CupsPrintersHandler> weak_factory_; 56 base::WeakPtrFactory<CupsPrintersHandler> weak_factory_;
50 57
51 DISALLOW_COPY_AND_ASSIGN(CupsPrintersHandler); 58 DISALLOW_COPY_AND_ASSIGN(CupsPrintersHandler);
52 }; 59 };
53 60
54 } // namespace settings 61 } // namespace settings
55 } // namespace chromeos 62 } // namespace chromeos
56 63
57 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CUPS_PRINTERS_HANDLER_H_ 64 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CUPS_PRINTERS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698