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