| 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_SETTINGS_PAGE_UI_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_PAGE_UI_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_PAGE_UI_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_PAGE_UI_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "content/public/browser/web_ui_message_handler.h" | 10 #include "content/public/browser/web_ui_message_handler.h" |
| 11 | 11 |
| 12 namespace settings { | 12 namespace settings { |
| 13 | 13 |
| 14 // The base class handler of Javascript messages of settings pages. | 14 // The base class handler of Javascript messages of settings pages. |
| 15 class SettingsPageUIHandler : public content::WebUIMessageHandler { | 15 class SettingsPageUIHandler : public content::WebUIMessageHandler { |
| 16 public: | 16 public: |
| 17 SettingsPageUIHandler(); | 17 SettingsPageUIHandler(); |
| 18 ~SettingsPageUIHandler() override; | 18 ~SettingsPageUIHandler() override; |
| 19 | 19 |
| 20 // WebUIMessageHandler implementation. | |
| 21 void RegisterMessages() override {} | |
| 22 | |
| 23 protected: | 20 protected: |
| 24 // Helper method for responding to JS requests initiated with | 21 // Helper method for responding to JS requests initiated with |
| 25 // cr.sendWithPromise(), for the case where the returned promise should be | 22 // cr.sendWithPromise(), for the case where the returned promise should be |
| 26 // resolved (request succeeded). | 23 // resolved (request succeeded). |
| 27 void ResolveJavascriptCallback(const base::Value& callback_id, | 24 void ResolveJavascriptCallback(const base::Value& callback_id, |
| 28 const base::Value& response); | 25 const base::Value& response); |
| 29 | 26 |
| 30 // Helper method for responding to JS requests initiated with | 27 // Helper method for responding to JS requests initiated with |
| 31 // cr.sendWithPromise(), for the case where the returned promise should be | 28 // cr.sendWithPromise(), for the case where the returned promise should be |
| 32 // rejected (request failed). | 29 // rejected (request failed). |
| 33 void RejectJavascriptCallback(const base::Value& callback_id, | 30 void RejectJavascriptCallback(const base::Value& callback_id, |
| 34 const base::Value& response); | 31 const base::Value& response); |
| 35 | 32 |
| 36 private: | 33 private: |
| 37 DISALLOW_COPY_AND_ASSIGN(SettingsPageUIHandler); | 34 DISALLOW_COPY_AND_ASSIGN(SettingsPageUIHandler); |
| 38 }; | 35 }; |
| 39 | 36 |
| 40 } // namespace settings | 37 } // namespace settings |
| 41 | 38 |
| 42 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_PAGE_UI_HANDLER_H_ | 39 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_PAGE_UI_HANDLER_H_ |
| OLD | NEW |