| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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_DOWNLOADS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_DOWNLOADS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_DOWNLOADS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_DOWNLOADS_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" | 12 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" |
| 13 #include "ui/shell_dialogs/select_file_dialog.h" | 13 #include "ui/shell_dialogs/select_file_dialog.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class Value; | 16 class Value; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace settings { | 19 namespace settings { |
| 20 | 20 |
| 21 // Chrome "Downloads" settings page UI handler. | 21 // Chrome "Downloads" settings page UI handler. |
| 22 class DownloadsHandler : public SettingsPageUIHandler, | 22 class DownloadsHandler : public SettingsPageUIHandler, |
| 23 public ui::SelectFileDialog::Listener { | 23 public ui::SelectFileDialog::Listener { |
| 24 public: | 24 public: |
| 25 DownloadsHandler(); | 25 DownloadsHandler(); |
| 26 ~DownloadsHandler() override; | 26 ~DownloadsHandler() override; |
| 27 | 27 |
| 28 // SettingsPageUIHandler implementation. | 28 // SettingsPageUIHandler implementation. |
| 29 void RegisterMessages() override; | 29 void RegisterMessages() override; |
| 30 void OnJavascriptAllowed() override {} |
| 31 void OnJavascriptDisallowed() override {} |
| 30 | 32 |
| 31 private: | 33 private: |
| 32 // SelectFileDialog::Listener implementation. | 34 // SelectFileDialog::Listener implementation. |
| 33 void FileSelected(const base::FilePath& path, | 35 void FileSelected(const base::FilePath& path, |
| 34 int index, | 36 int index, |
| 35 void* params) override; | 37 void* params) override; |
| 36 | 38 |
| 37 // Callback for the "selectDownloadLocation" message. This will prompt the | 39 // Callback for the "selectDownloadLocation" message. This will prompt the |
| 38 // user for a destination folder using platform-specific APIs. | 40 // user for a destination folder using platform-specific APIs. |
| 39 void HandleSelectDownloadLocation(const base::ListValue* args); | 41 void HandleSelectDownloadLocation(const base::ListValue* args); |
| 40 | 42 |
| 41 scoped_refptr<ui::SelectFileDialog> select_folder_dialog_; | 43 scoped_refptr<ui::SelectFileDialog> select_folder_dialog_; |
| 42 | 44 |
| 43 DISALLOW_COPY_AND_ASSIGN(DownloadsHandler); | 45 DISALLOW_COPY_AND_ASSIGN(DownloadsHandler); |
| 44 }; | 46 }; |
| 45 | 47 |
| 46 } // namespace settings | 48 } // namespace settings |
| 47 | 49 |
| 48 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_DOWNLOADS_HANDLER_H_ | 50 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_DOWNLOADS_HANDLER_H_ |
| OLD | NEW |