blob: f71d75a3b93b8960f82da74e88792637d8f6f7b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_PAGE_UI_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_PAGE_UI_HANDLER_H_
#include "base/macros.h"
#include "base/values.h"
#include "content/public/browser/web_ui_message_handler.h"
namespace settings {
// The base class handler of Javascript messages of settings pages.
class SettingsPageUIHandler : public content::WebUIMessageHandler {
public:
SettingsPageUIHandler();
~SettingsPageUIHandler() override;
// WebUIMessageHandler implementation.
void RegisterMessages() override {}
// TODO(dbeam): move to WebUIMessageHandler?
// Called when a navigation re-uses a renderer process (i.e. reload).
virtual void RenderViewReused() {}
protected:
// Helper method for responding to JS requests initiated with
// cr.sendWithPromise(), for the case where the returned promise should be
// resolved (request succeeded).
void ResolveJavascriptCallback(const base::Value& callback_id,
const base::Value& response);
// Helper method for responding to JS requests initiated with
// cr.sendWithPromise(), for the case where the returned promise should be
// rejected (request failed).
void RejectJavascriptCallback(const base::Value& callback_id,
const base::Value& response);
private:
DISALLOW_COPY_AND_ASSIGN(SettingsPageUIHandler);
};
} // namespace settings
#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_PAGE_UI_HANDLER_H_
|