Chromium Code Reviews| 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: () => {} | |
|
stevenjb
2017/01/25 01:40:08
Unfortunately we can no longer use ES6 in settings
jdufault
2017/02/03 21:32:08
Done.
| |
| 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 ready: function() { | |
| 44 settings.DevicePageBrowserProxyImpl.getInstance().onNoteTakingAppsUpdated( | |
| 45 this.onNoteAppsUpdated_.bind(this)); | |
| 46 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.
| |
| 47 }, | |
| 48 | |
| 49 /** @private */ | |
| 50 onSelectedAppChanged_: function() { | |
| 51 settings.DevicePageBrowserProxyImpl.getInstance().setPreferredNoteTakingApp( | |
| 52 this.$.menu.value); | |
| 53 }, | |
| 54 | |
| 55 /** | |
| 56 * @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.
| |
| 57 * @param {boolean} waitingForAndroid | |
| 58 * @private | |
| 59 */ | |
| 60 onNoteAppsUpdated_: function(apps, waitingForAndroid) { | |
| 61 this.waitingForAndroid_ = waitingForAndroid; | |
| 62 this.appChoices_ = apps; | |
| 63 }, | |
| 64 | |
| 65 /** | |
| 66 * @param {Array<{name:string, value:string, preferred:boolean}>} apps | |
| 67 * @param {boolean} waitingForAndroid | |
| 68 * @private | |
| 69 */ | |
| 70 showNoApps_: function(apps, waitingForAndroid) { | |
| 71 return apps.length == 0 && !waitingForAndroid; | |
| 72 }, | |
| 73 | |
| 74 /** | |
| 75 * @param {Array<{name:string, value:string, preferred:boolean}>} apps | |
| 76 * @param {boolean} waitingForAndroid | |
| 77 * @private | |
| 78 */ | |
| 79 showApps_: function(apps, waitingForAndroid) { | |
| 80 return apps.length > 0 && !waitingForAndroid; | |
| 81 }, | |
| 82 | |
| 83 /** @private */ | |
| 84 onFindAppsTap_: function() { | |
| 85 window.open(FIND_MORE_APPS_URL); | |
| 86 }, | |
| 20 }); | 87 }); |
| OLD | NEW |