OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 /** | 6 /** |
7 * Encapsulated handling of the stylus overlay. | 7 * Encapsulated handling of the stylus overlay. |
8 * @constructor | 8 * @constructor |
9 * @extends {options.SettingsDialog} | 9 * @extends {options.SettingsDialog} |
10 */ | 10 */ |
11 function StylusOverlay() { | 11 function StylusOverlay() { |
12 options.SettingsDialog.call(this, 'stylus-overlay', | 12 options.SettingsDialog.call( |
13 loadTimeData.getString('stylusOverlayTabTitle'), | 13 this, 'stylus-overlay', loadTimeData.getString('stylusOverlayTabTitle'), |
14 'stylus-overlay', | 14 'stylus-overlay', |
15 assertInstanceof($('stylus-confirm'), HTMLButtonElement), | 15 assertInstanceof($('stylus-confirm'), HTMLButtonElement), |
16 assertInstanceof($('stylus-cancel'), HTMLButtonElement)); | 16 assertInstanceof($('stylus-cancel'), HTMLButtonElement)); |
17 } | 17 } |
18 | 18 |
19 cr.addSingletonGetter(StylusOverlay); | 19 cr.addSingletonGetter(StylusOverlay); |
20 | 20 |
21 StylusOverlay.prototype = { | 21 StylusOverlay.prototype = { |
22 __proto__: options.SettingsDialog.prototype, | 22 __proto__: options.SettingsDialog.prototype, |
23 | 23 |
(...skipping 16 matching lines...) Expand all Loading... |
40 * change the selection. | 40 * change the selection. |
41 * @type {?string} | 41 * @type {?string} |
42 */ | 42 */ |
43 selectedNoteTakingAppId_: null, | 43 selectedNoteTakingAppId_: null, |
44 | 44 |
45 /** @override */ | 45 /** @override */ |
46 initializePage: function() { | 46 initializePage: function() { |
47 options.SettingsDialog.prototype.initializePage.call(this); | 47 options.SettingsDialog.prototype.initializePage.call(this); |
48 | 48 |
49 // Disable some elements when enable stylus tools pref is false. | 49 // Disable some elements when enable stylus tools pref is false. |
50 Preferences.getInstance().addEventListener('settings.enable_stylus_tools', | 50 Preferences.getInstance().addEventListener( |
51 function(e) { | 51 'settings.enable_stylus_tools', function(e) { |
52 this.stylusToolsEnabled_ = e.value.value; | 52 this.stylusToolsEnabled_ = e.value.value; |
53 $('launch-palette-on-eject-input').disabled = !e.value.value; | 53 $('launch-palette-on-eject-input').disabled = !e.value.value; |
54 this.updateNoteTakingAppsSelectDisabled_(); | 54 this.updateNoteTakingAppsSelectDisabled_(); |
55 }.bind(this)); | 55 }.bind(this)); |
56 | 56 |
57 $('stylus-note-taking-app-select') | 57 $('stylus-note-taking-app-select') |
58 .addEventListener( | 58 .addEventListener( |
59 'change', this.handleNoteTakingAppSelected_.bind(this)); | 59 'change', this.handleNoteTakingAppSelected_.bind(this)); |
60 | 60 |
61 var stylusAppsUrl = "https://play.google.com/store/apps/collection/" + | 61 var stylusAppsUrl = 'https://play.google.com/store/apps/collection/' + |
62 "promotion_30023cb_stylus_apps"; | 62 'promotion_30023cb_stylus_apps'; |
63 $('stylus-find-more-link').onclick = function(event) { | 63 $('stylus-find-more-link').onclick = function(event) { |
64 chrome.send('showPlayStoreApps', [stylusAppsUrl]); | 64 chrome.send('showPlayStoreApps', [stylusAppsUrl]); |
65 }; | 65 }; |
66 }, | 66 }, |
67 | 67 |
68 /** @override */ | 68 /** @override */ |
69 handleConfirm: function() { | 69 handleConfirm: function() { |
70 options.SettingsDialog.prototype.handleConfirm.call(this); | 70 options.SettingsDialog.prototype.handleConfirm.call(this); |
71 | 71 |
72 if (this.selectedNoteTakingAppId_) { | 72 if (this.selectedNoteTakingAppId_) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 handleNoteTakingAppSelected_: function() { | 144 handleNoteTakingAppSelected_: function() { |
145 this.selectedNoteTakingAppId_ = $('stylus-note-taking-app-select').value; | 145 this.selectedNoteTakingAppId_ = $('stylus-note-taking-app-select').value; |
146 }, | 146 }, |
147 }; | 147 }; |
148 | 148 |
149 cr.makePublic(StylusOverlay, [ | 149 cr.makePublic(StylusOverlay, [ |
150 'updateNoteTakingApps', | 150 'updateNoteTakingApps', |
151 ]); | 151 ]); |
152 | 152 |
153 // Export | 153 // Export |
154 return { | 154 return {StylusOverlay: StylusOverlay}; |
155 StylusOverlay: StylusOverlay | |
156 }; | |
157 }); | 155 }); |
OLD | NEW |