Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: chrome/browser/ui/webui/settings/settings_page_ui_handler.h

Issue 2040473002: Move {Resolve|Reject}JavascriptCallback helpers in WebUIMessageHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolvig conflicts with ToT Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/webui/settings/settings_page_ui_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 protected:
21 // Helper method for responding to JS requests initiated with
22 // cr.sendWithPromise(), for the case where the returned promise should be
23 // resolved (request succeeded).
24 void ResolveJavascriptCallback(const base::Value& callback_id,
25 const base::Value& response);
26
27 // Helper method for responding to JS requests initiated with
28 // cr.sendWithPromise(), for the case where the returned promise should be
29 // rejected (request failed).
30 void RejectJavascriptCallback(const base::Value& callback_id,
31 const base::Value& response);
32
33 private: 20 private:
34 // SettingsPageUIHandler subclasses must be JavaScript-lifecycle safe. 21 // SettingsPageUIHandler subclasses must be JavaScript-lifecycle safe.
35 void OnJavascriptAllowed() override = 0; 22 void OnJavascriptAllowed() override = 0;
36 void OnJavascriptDisallowed() override = 0; 23 void OnJavascriptDisallowed() override = 0;
37 24
38 DISALLOW_COPY_AND_ASSIGN(SettingsPageUIHandler); 25 DISALLOW_COPY_AND_ASSIGN(SettingsPageUIHandler);
39 }; 26 };
40 27
41 } // namespace settings 28 } // namespace settings
42 29
43 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_PAGE_UI_HANDLER_H_ 30 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_PAGE_UI_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/settings/settings_page_ui_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698