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 "ui/shell_dialogs/select_file_dialog.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, |
| 23 public ui::SelectFileDialog::Listener { |
22 public: | 24 public: |
23 explicit CupsPrintersHandler(content::WebUI* webui); | 25 explicit CupsPrintersHandler(content::WebUI* webui); |
24 ~CupsPrintersHandler() override; | 26 ~CupsPrintersHandler() override; |
25 | 27 |
26 // SettingsPageUIHandler overrides: | 28 // SettingsPageUIHandler overrides: |
27 void RegisterMessages() override; | 29 void RegisterMessages() override; |
28 void OnJavascriptAllowed() override{}; | 30 void OnJavascriptAllowed() override{}; |
29 void OnJavascriptDisallowed() override{}; | 31 void OnJavascriptDisallowed() override{}; |
30 | 32 |
31 private: | 33 private: |
32 // Gets all CUPS printers and return it to WebUI. | 34 // Gets all CUPS printers and return it to WebUI. |
33 void HandleGetCupsPrintersList(const base::ListValue* args); | 35 void HandleGetCupsPrintersList(const base::ListValue* args); |
34 | |
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 HandleSelectPPDFile(const base::ListValue* args); |
| 39 |
| 40 // ui::SelectFileDialog::Listener override: |
| 41 void FileSelected(const base::FilePath& path, |
| 42 int index, |
| 43 void* params) override; |
37 | 44 |
38 Profile* profile_; | 45 Profile* profile_; |
| 46 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; |
| 47 std::string webui_callback_id_; |
| 48 |
39 base::WeakPtrFactory<CupsPrintersHandler> weak_factory_; | 49 base::WeakPtrFactory<CupsPrintersHandler> weak_factory_; |
40 | 50 |
41 DISALLOW_COPY_AND_ASSIGN(CupsPrintersHandler); | 51 DISALLOW_COPY_AND_ASSIGN(CupsPrintersHandler); |
42 }; | 52 }; |
43 | 53 |
44 } // namespace settings | 54 } // namespace settings |
45 } // namespace chromeos | 55 } // namespace chromeos |
46 | 56 |
47 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CUPS_PRINTERS_HANDLER_H_ | 57 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CUPS_PRINTERS_HANDLER_H_ |
OLD | NEW |