| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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('hotword', function() { | 5 cr.define('hotword', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Class used to manage the interaction between hotwording and the | 9 * Class used to manage the interaction between hotwording and the |
| 10 * NTP/google.com. Injects a content script to interact with NTP/google.com | 10 * NTP/google.com. Injects a content script to interact with NTP/google.com |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 this.messageListener_ = this.handleMessageFromPage_.bind(this); | 41 this.messageListener_ = this.handleMessageFromPage_.bind(this); |
| 42 | 42 |
| 43 // Need to setup listeners on startup, otherwise events that caused the | 43 // Need to setup listeners on startup, otherwise events that caused the |
| 44 // event page to start up, will be lost. | 44 // event page to start up, will be lost. |
| 45 this.setupListeners_(); | 45 this.setupListeners_(); |
| 46 | 46 |
| 47 this.stateManager_.onStatusChanged.addListener(function() { | 47 this.stateManager_.onStatusChanged.addListener(function() { |
| 48 this.updateListeners_(); | 48 this.updateListeners_(); |
| 49 this.updateTabState_(); | 49 this.updateTabState_(); |
| 50 }.bind(this)); | 50 }.bind(this)); |
| 51 }; | 51 } |
| 52 | 52 |
| 53 var CommandToPage = hotword.constants.CommandToPage; | 53 var CommandToPage = hotword.constants.CommandToPage; |
| 54 var CommandFromPage = hotword.constants.CommandFromPage; | 54 var CommandFromPage = hotword.constants.CommandFromPage; |
| 55 | 55 |
| 56 PageAudioManager.prototype = { | 56 PageAudioManager.prototype = { |
| 57 /** | 57 /** |
| 58 * Helper function to test if a URL path is eligible for hotwording. | 58 * Helper function to test if a URL path is eligible for hotwording. |
| 59 * @param {!string} url URL to check. | 59 * @param {!string} url URL to check. |
| 60 * @param {!string} base Base URL to compare against.. | 60 * @param {!string} base Base URL to compare against.. |
| 61 * @return {boolean} True if url is an eligible hotword URL. | 61 * @return {boolean} True if url is an eligible hotword URL. |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 } else { | 532 } else { |
| 533 this.removeListeners_(); | 533 this.removeListeners_(); |
| 534 this.stopHotwording_(); | 534 this.stopHotwording_(); |
| 535 this.disconnectAllClients_(); | 535 this.disconnectAllClients_(); |
| 536 } | 536 } |
| 537 } | 537 } |
| 538 }; | 538 }; |
| 539 | 539 |
| 540 return {PageAudioManager: PageAudioManager}; | 540 return {PageAudioManager: PageAudioManager}; |
| 541 }); | 541 }); |
| OLD | NEW |