summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/webui/settings/settings_page_ui_handler.cc
blob: 93326fa23f5a79a271fecb5cc02159c72d733298 (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
// 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.

#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"

#include "content/public/browser/web_ui.h"

namespace settings {

SettingsPageUIHandler::SettingsPageUIHandler() {}

SettingsPageUIHandler::~SettingsPageUIHandler() {}

void SettingsPageUIHandler::ResolveJavascriptCallback(
    const base::Value& callback_id,
    const base::Value& response) {
  // cr.webUIResponse is a global JS function exposed from cr.js.
  web_ui()->CallJavascriptFunction(
      "cr.webUIResponse", callback_id,
      base::FundamentalValue(true), response);
}

void SettingsPageUIHandler::RejectJavascriptCallback(
    const base::Value& callback_id,
    const base::Value& response) {
  // cr.webUIResponse is a global JS function exposed from cr.js.
  web_ui()->CallJavascriptFunction(
      "cr.webUIResponse", callback_id,
      base::FundamentalValue(false), response);
}

}  // namespace settings