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

Unified Diff: chrome/browser/resources/settings/device_page/stylus.js

Issue 2630623002: cros: Allow user to configure note taking app in md-settings. (Closed)
Patch Set: Address comments Created 3 years, 11 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/settings/device_page/stylus.js
diff --git a/chrome/browser/resources/settings/device_page/stylus.js b/chrome/browser/resources/settings/device_page/stylus.js
index a31df1d433c5b0290731fa10c112a73d6955aa59..1f2497bd5002be7bc8aae68f46516a0014a2ca88 100644
--- a/chrome/browser/resources/settings/device_page/stylus.js
+++ b/chrome/browser/resources/settings/device_page/stylus.js
@@ -7,6 +7,9 @@
* 'settings-stylus' is the settings subpage with stylus-specific settings.
*/
+/** @const */ var FIND_MORE_APPS_URL = 'https://play.google.com/store/apps/' +
+ 'collection/promotion_30023cb_stylus_apps';
+
Polymer({
is: 'settings-stylus',
@@ -16,5 +19,69 @@ Polymer({
type: Object,
notify: true,
},
- }
+
+ /**
+ * Note taking apps the user can pick between.
+ * @type {Array<{name:string, value:string, preferred:boolean}>}
+ * @private
+ */
+ appChoices_: {
+ type: Array,
+ value: () => {}
stevenjb 2017/01/25 01:40:08 Unfortunately we can no longer use ES6 in settings
jdufault 2017/02/03 21:32:08 Done.
+ },
+
+ /**
+ * True if the ARC container has not finished starting yet.
+ * @private
+ */
+ waitingForAndroid_: {
+ type: Boolean,
+ value: false
+ },
+ },
+
+ ready: function() {
+ settings.DevicePageBrowserProxyImpl.getInstance().onNoteTakingAppsUpdated(
+ this.onNoteAppsUpdated_.bind(this));
+ settings.DevicePageBrowserProxyImpl.getInstance().requestNoteTakingApps();
stevenjb 2017/01/25 01:40:08 Since we have several proxy calls here, we should
jdufault 2017/02/03 21:32:08 Done.
+ },
+
+ /** @private */
+ onSelectedAppChanged_: function() {
+ settings.DevicePageBrowserProxyImpl.getInstance().setPreferredNoteTakingApp(
+ this.$.menu.value);
+ },
+
+ /**
+ * @param {Array<{name:string, value:string, preferred:boolean}>} apps
stevenjb 2017/01/25 01:40:08 {name:string, value:string, preferred:boolean} sho
jdufault 2017/02/03 21:32:09 Done.
+ * @param {boolean} waitingForAndroid
+ * @private
+ */
+ onNoteAppsUpdated_: function(apps, waitingForAndroid) {
+ this.waitingForAndroid_ = waitingForAndroid;
+ this.appChoices_ = apps;
+ },
+
+ /**
+ * @param {Array<{name:string, value:string, preferred:boolean}>} apps
+ * @param {boolean} waitingForAndroid
+ * @private
+ */
+ showNoApps_: function(apps, waitingForAndroid) {
+ return apps.length == 0 && !waitingForAndroid;
+ },
+
+ /**
+ * @param {Array<{name:string, value:string, preferred:boolean}>} apps
+ * @param {boolean} waitingForAndroid
+ * @private
+ */
+ showApps_: function(apps, waitingForAndroid) {
+ return apps.length > 0 && !waitingForAndroid;
+ },
+
+ /** @private */
+ onFindAppsTap_: function() {
+ window.open(FIND_MORE_APPS_URL);
+ },
});

Powered by Google App Engine
This is Rietveld 408576698