Chromium Code Reviews| Index: chrome/browser/ui/webui/settings/chromeos/a11y_handler.cc |
| diff --git a/chrome/browser/ui/webui/settings/chromeos/a11y_handler.cc b/chrome/browser/ui/webui/settings/chromeos/a11y_handler.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9a0067b232546945dae1399a6ac4bd6b396d2aa4 |
| --- /dev/null |
| +++ b/chrome/browser/ui/webui/settings/chromeos/a11y_handler.cc |
| @@ -0,0 +1,42 @@ |
| +// 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/chromeos/a11y_handler.h" |
| + |
| +#include "base/bind.h" |
| +#include "base/command_line.h" |
| +#include "base/values.h" |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "chromeos/chromeos_switches.h" |
| +#include "content/public/browser/web_ui.h" |
| + |
| +namespace chromeos { |
| +namespace settings { |
| + |
| +A11yHandler::A11yHandler(content::WebUI* webui) |
| + : profile_(Profile::FromWebUI(webui)) { |
| +} |
| + |
| +A11yHandler::~A11yHandler() { |
| +} |
| + |
| +void A11yHandler::RegisterMessages() { |
| + web_ui()->RegisterMessageCallback( |
| + "initializeAccessibilityPage", |
| + base::Bind(&A11yHandler::HandleInitialize, |
| + base::Unretained(this))); |
| +} |
| + |
| +void A11yHandler::HandleInitialize(const base::ListValue* args) { |
| + const base::FundamentalValue show_experimental_features( |
| + base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + chromeos::switches::kEnableExperimentalAccessibilityFeatures)); |
|
Dan Beam
2016/03/11 22:07:20
can you just push this value into loadTimeData ins
|
| + web_ui()->CallJavascriptFunction( |
| + "cr.webUIListenerCallback", |
| + base::StringValue("show-experimental-features"), |
| + show_experimental_features); |
| +} |
| + |
| +} // namespace settings |
| +} // namespace chromeos |