OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * @fileoverview 'settings-google-assistant-page' is the settings page |
| 7 * containing Google Assistant settings. |
| 8 */ |
| 9 Polymer({ |
| 10 is: 'settings-google-assistant-page', |
| 11 |
| 12 behaviors: [I18nBehavior], |
| 13 |
| 14 properties: { |
| 15 /** Preferences state. */ |
| 16 prefs: { |
| 17 type: Object, |
| 18 notify: true, |
| 19 }, |
| 20 }, |
| 21 |
| 22 /** @private {?settings.GoogleAssistantBrowserProxy} */ |
| 23 browserProxy_: null, |
| 24 |
| 25 /** @override */ |
| 26 created: function() { |
| 27 this.browserProxy_ = settings.GoogleAssistantBrowserProxyImpl.getInstance(); |
| 28 }, |
| 29 |
| 30 /** |
| 31 * @param {boolean} toggleValue |
| 32 * @return {string} |
| 33 * @private |
| 34 */ |
| 35 getAssistantOnOffLabel_: function(toggleValue) { |
| 36 return this.i18n(toggleValue ? 'googleAssistantOn' : 'googleAssistantOff'); |
| 37 }, |
| 38 |
| 39 /** |
| 40 * @param {boolean} toggleValue |
| 41 * @return {string} |
| 42 * @private |
| 43 */ |
| 44 getAssistantOnOffClass_: function(toggleValue) { |
| 45 return toggleValue ? 'highlighted-on' : 'highlighted-off'; |
| 46 }, |
| 47 |
| 48 /** |
| 49 * @param {!Event} event |
| 50 * @private |
| 51 */ |
| 52 onGoogleAssistantEnableChange_: function(event) { |
| 53 this.browserProxy_.setGoogleAssistantEnabled( |
| 54 !!this.prefs.settings.voice_interaction.enabled.value); |
| 55 }, |
| 56 |
| 57 /** |
| 58 * @param {!Event} event |
| 59 * @private |
| 60 */ |
| 61 onGoogleAssistantContextEnableChange_: function(event) { |
| 62 this.browserProxy_.setGoogleAssistantContextEnabled( |
| 63 !!this.prefs.settings.voice_interaction.context.enabled.value); |
| 64 }, |
| 65 |
| 66 /** |
| 67 * @param {!Event} event |
| 68 * @private |
| 69 */ |
| 70 onGoogleAssistantSettingsTapped_: function(event) { |
| 71 this.browserProxy_.showGoogleAssistantSettings(); |
| 72 }, |
| 73 }); |
OLD | NEW |