OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 A helper object used from the google assistant section |
| 7 * to interact with the browser. |
| 8 */ |
| 9 |
| 10 cr.define('settings', function() { |
| 11 console.log("setting up assistant browser proxy"); |
| 12 /** @interface */ |
| 13 class GoogleAssistantBrowserProxy { |
| 14 /** |
| 15 * Enables or disables the Google Assistant. |
| 16 * @param {boolean} assistantEnabled |
| 17 */ |
| 18 setGoogleAssistantEnabled(assistantEnabled) {} |
| 19 |
| 20 /** |
| 21 * Enables or disables screen context for the Google Assistant. |
| 22 * @param {boolean} contextEnabled |
| 23 */ |
| 24 setGoogleAssistantContextEnabled(contextEnabled) {} |
| 25 |
| 26 /** |
| 27 * Launches into the Google Assistant app settings. |
| 28 */ |
| 29 launchGoogleAssistantSettings() {} |
| 30 } |
| 31 |
| 32 /** |
| 33 * @implements {settings.GoogleAssistantBrowserProxy} |
| 34 */ |
| 35 class GoogleAssistantBrowserProxyImpl { |
| 36 /** @override */ |
| 37 setGoogleAssistantEnabled(assistantEnabled) { |
| 38 chrome.send('setGoogleAssistantEnabled', [assistantEnabled]); |
| 39 } |
| 40 |
| 41 /** @override */ |
| 42 setGoogleAssistantContextEnabled(contextEnabled) { |
| 43 chrome.send('setGoogleAssistantContextEnabled', [contextEnabled]); |
| 44 } |
| 45 |
| 46 /** @override */ |
| 47 showGoogleAssistantSettings() { |
| 48 chrome.send('showGoogleAssistantSettings'); |
| 49 } |
| 50 |
| 51 } |
| 52 |
| 53 // The singleton instance_ is replaced with a test version of this wrapper |
| 54 // during testing. |
| 55 cr.addSingletonGetter(GoogleAssistantBrowserProxyImpl); |
| 56 |
| 57 return { |
| 58 GoogleAssistantBrowserProxy: GoogleAssistantBrowserProxy, |
| 59 GoogleAssistantBrowserProxyImpl: GoogleAssistantBrowserProxyImpl, |
| 60 }; |
| 61 }); |
OLD | NEW |