| Index: chrome/browser/ui/webui/options/chromeos/options_stylus_handler.cc
|
| diff --git a/chrome/browser/ui/webui/options/chromeos/options_stylus_handler.cc b/chrome/browser/ui/webui/options/chromeos/options_stylus_handler.cc
|
| index d832ba9f4ca39872344dc3608055bff4d4ef7ab5..19e0edd6049f477879233195b7eb3ef037f6d48e 100644
|
| --- a/chrome/browser/ui/webui/options/chromeos/options_stylus_handler.cc
|
| +++ b/chrome/browser/ui/webui/options/chromeos/options_stylus_handler.cc
|
| @@ -9,6 +9,7 @@
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/grit/generated_resources.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| +#include "ui/events/devices/input_device_manager.h"
|
|
|
| namespace chromeos {
|
| namespace options {
|
| @@ -24,9 +25,11 @@ constexpr char kAppPreferredKey[] = "preferred";
|
|
|
| OptionsStylusHandler::OptionsStylusHandler() : weak_ptr_factory_(this) {
|
| NoteTakingHelper::Get()->AddObserver(this);
|
| + ui::InputDeviceManager::GetInstance()->AddObserver(this);
|
| }
|
|
|
| OptionsStylusHandler::~OptionsStylusHandler() {
|
| + ui::InputDeviceManager::GetInstance()->RemoveObserver(this);
|
| NoteTakingHelper::Get()->RemoveObserver(this);
|
| }
|
|
|
| @@ -60,9 +63,6 @@ void OptionsStylusHandler::GetLocalizedValues(
|
| "stylusNoteTakingAppWaitingForAndroid",
|
| l10n_util::GetStringUTF16(
|
| IDS_OPTIONS_STYLUS_NOTE_TAKING_APP_WAITING_FOR_ANDROID));
|
| -
|
| - localized_strings->SetBoolean("showStylusSettings",
|
| - ash::IsPaletteFeatureEnabled());
|
| }
|
|
|
| void OptionsStylusHandler::InitializePage() {
|
| @@ -74,12 +74,34 @@ void OptionsStylusHandler::RegisterMessages() {
|
| "setPreferredNoteTakingApp",
|
| base::Bind(&OptionsStylusHandler::SetPreferredNoteTakingApp,
|
| weak_ptr_factory_.GetWeakPtr()));
|
| + web_ui()->RegisterMessageCallback(
|
| + "requestStylusHardwareState",
|
| + base::Bind(&OptionsStylusHandler::RequestStylusHardwareState,
|
| + weak_ptr_factory_.GetWeakPtr()));
|
| }
|
|
|
| void OptionsStylusHandler::OnAvailableNoteTakingAppsUpdated() {
|
| UpdateNoteTakingApps();
|
| }
|
|
|
| +void OptionsStylusHandler::OnDeviceListsComplete() {
|
| + SendHasStylus();
|
| +}
|
| +
|
| +void OptionsStylusHandler::RequestStylusHardwareState(
|
| + const base::ListValue* args) {
|
| + if (ui::InputDeviceManager::GetInstance()->AreDeviceListsComplete())
|
| + SendHasStylus();
|
| +}
|
| +
|
| +void OptionsStylusHandler::SendHasStylus() {
|
| + DCHECK(ui::InputDeviceManager::GetInstance()->AreDeviceListsComplete());
|
| +
|
| + web_ui()->CallJavascriptFunctionUnsafe(
|
| + "BrowserOptions.setStylusInputStatus",
|
| + base::FundamentalValue(ash::HasStylusInput()));
|
| +}
|
| +
|
| void OptionsStylusHandler::UpdateNoteTakingApps() {
|
| bool waiting_for_android = false;
|
| note_taking_app_ids_.clear();
|
|
|