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

Unified Diff: chrome/browser/resources/options/browser_options.js

Issue 2644713002: cros: Use runtime stylus detection for ash palette. (Closed)
Patch Set: Fix test Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/options/browser_options.js
diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js
index 96283c3d8b4cd069c9555a1113b6eace1f524bb4..b4dbd5ccdba51c4d51c3cabf80179cdb1665c63c 100644
--- a/chrome/browser/resources/options/browser_options.js
+++ b/chrome/browser/resources/options/browser_options.js
@@ -339,12 +339,10 @@ cr.define('options', function() {
// Device section (ChromeOS only).
if (cr.isChromeOS) {
- if (loadTimeData.getBoolean('showStylusSettings')) {
- $('stylus-settings-link').onclick = function(event) {
- PageManager.showPageByName('stylus-overlay');
- };
- $('stylus-row').hidden = false;
- }
+ // Probe for stylus hardware state. C++ will invoke
+ // BrowserOptions.setStylusInputStatus_ when the data is available.
+ chrome.send('requestStylusHardwareState');
+
if (loadTimeData.getBoolean('showPowerStatus')) {
$('power-settings-link').onclick = function(evt) {
PageManager.showPageByName('power-overlay');
@@ -1814,6 +1812,21 @@ cr.define('options', function() {
},
/**
+ * Called when stylus hardware detection probing is complete.
+ * @param {boolean} hasStylus
+ * @private
+ */
+ setStylusInputStatus_: function(hasStylus) {
+ if (!hasStylus)
+ return;
+
+ $('stylus-settings-link').onclick = function(event) {
+ PageManager.showPageByName('stylus-overlay');
+ };
+ $('stylus-row').hidden = false;
+ },
+
+ /**
* This is called from chromium code when system timezone "managed" state
* is changed. Enables or disables dependent settings.
* @param {boolean} managed Is true when system Timezone is managed by
@@ -2412,6 +2425,7 @@ cr.define('options', function() {
'setNowSectionVisible',
'setProfilesInfo',
'setSpokenFeedbackCheckboxState',
+ 'setStylusInputStatus',
'setSystemTimezoneAutomaticDetectionManaged',
'setSystemTimezoneManaged',
'setThemesResetButtonEnabled',
« no previous file with comments | « chrome/browser/chromeos/note_taking_helper_unittest.cc ('k') | chrome/browser/resources/settings/device_page/device_page.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698