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