| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * 'settings-stylus' is the settings subpage with stylus-specific settings. | 7 * 'settings-stylus' is the settings subpage with stylus-specific settings. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /** @const */ var FIND_MORE_APPS_URL = 'https://play.google.com/store/apps/' + |
| 11 'collection/promotion_30023cb_stylus_apps'; |
| 12 |
| 10 Polymer({ | 13 Polymer({ |
| 11 is: 'settings-stylus', | 14 is: 'settings-stylus', |
| 12 | 15 |
| 13 properties: { | 16 properties: { |
| 14 /** Preferences state. */ | 17 /** Preferences state. */ |
| 15 prefs: { | 18 prefs: { |
| 16 type: Object, | 19 type: Object, |
| 17 notify: true, | 20 notify: true, |
| 18 }, | 21 }, |
| 19 } | 22 |
| 23 /** |
| 24 * Note taking apps the user can pick between. |
| 25 * @type {Array<{name:string, value:string, preferred:boolean}>} |
| 26 * @private |
| 27 */ |
| 28 appChoices_: { |
| 29 type: Array, |
| 30 value: function() { return []; } |
| 31 }, |
| 32 |
| 33 /** |
| 34 * True if the ARC container has not finished starting yet. |
| 35 * @private |
| 36 */ |
| 37 waitingForAndroid_: { |
| 38 type: Boolean, |
| 39 value: false |
| 40 }, |
| 41 }, |
| 42 |
| 43 |
| 44 /** @private {?settings.DevicePageBrowserProxy} */ |
| 45 browserProxy_: null, |
| 46 |
| 47 created: function() { |
| 48 this.browserProxy_ = settings.DevicePageBrowserProxyImpl.getInstance(); |
| 49 }, |
| 50 |
| 51 ready: function() { |
| 52 this.browserProxy_.setNoteTakingAppsUpdatedCallback( |
| 53 this.onNoteAppsUpdated_.bind(this)); |
| 54 this.browserProxy_.requestNoteTakingApps(); |
| 55 }, |
| 56 |
| 57 /** @private */ |
| 58 onSelectedAppChanged_: function() { |
| 59 this.browserProxy_.setPreferredNoteTakingApp(this.$.menu.value); |
| 60 }, |
| 61 |
| 62 /** |
| 63 * @param {Array<settings.NoteAppInfo>} apps |
| 64 * @param {boolean} waitingForAndroid |
| 65 * @private |
| 66 */ |
| 67 onNoteAppsUpdated_: function(apps, waitingForAndroid) { |
| 68 this.waitingForAndroid_ = waitingForAndroid; |
| 69 this.appChoices_ = apps; |
| 70 }, |
| 71 |
| 72 /** |
| 73 * @param {Array<settings.NoteAppInfo>} apps |
| 74 * @param {boolean} waitingForAndroid |
| 75 * @private |
| 76 */ |
| 77 showNoApps_: function(apps, waitingForAndroid) { |
| 78 return apps.length == 0 && !waitingForAndroid; |
| 79 }, |
| 80 |
| 81 /** |
| 82 * @param {Array<settings.NoteAppInfo>} apps |
| 83 * @param {boolean} waitingForAndroid |
| 84 * @private |
| 85 */ |
| 86 showApps_: function(apps, waitingForAndroid) { |
| 87 return apps.length > 0 && !waitingForAndroid; |
| 88 }, |
| 89 |
| 90 /** @private */ |
| 91 onFindAppsTap_: function() { |
| 92 window.open(FIND_MORE_APPS_URL); |
| 93 }, |
| 20 }); | 94 }); |
| OLD | NEW |