Chromium Code Reviews| 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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 448 * @param {Tab} tab The tab that the request was sent from. | 448 * @param {Tab} tab The tab that the request was sent from. |
| 449 * @param {function(HotwordStatus)} sendResponse Callback function to | 449 * @param {function(HotwordStatus)} sendResponse Callback function to |
| 450 * respond to sender. | 450 * respond to sender. |
| 451 * @param {HotwordStatus} hotwordStatus Status of the hotword extension. | 451 * @param {HotwordStatus} hotwordStatus Status of the hotword extension. |
| 452 * @private | 452 * @private |
| 453 */ | 453 */ |
| 454 statusDone_: function(tab, sendResponse, hotwordStatus) { | 454 statusDone_: function(tab, sendResponse, hotwordStatus) { |
| 455 var response = {'doNotShowOptinMessage': true}; | 455 var response = {'doNotShowOptinMessage': true}; |
| 456 | 456 |
| 457 if (!tab.incognito && hotwordStatus.available && | 457 if (!tab.incognito && hotwordStatus.available && |
| 458 !hotwordStatus.enabledSet) { | 458 !hotwordStatus.enabledSet && !hotwordStatus.alwaysOnAvailable) { |
|
benwells
2015/03/17 03:02:55
Why is this !available? My reading of this is that
kcarattini
2015/03/17 04:22:17
That's correct. This promo is for the 'sometimes-o
| |
| 459 response = hotwordStatus; | 459 response = hotwordStatus; |
| 460 } | 460 } |
| 461 | 461 |
| 462 try { | 462 try { |
| 463 sendResponse(response); | 463 sendResponse(response); |
| 464 } catch (err) { | 464 } catch (err) { |
| 465 // Suppress the exception thrown by sendResponse() when the page doesn't | 465 // Suppress the exception thrown by sendResponse() when the page doesn't |
| 466 // specify a response callback in the call to | 466 // specify a response callback in the call to |
| 467 // chrome.runtime.sendMessage(). | 467 // chrome.runtime.sendMessage(). |
| 468 // Unfortunately, there doesn't appear to be a way to detect one-way | 468 // Unfortunately, there doesn't appear to be a way to detect one-way |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 522 this.stopHotwording_(); | 522 this.stopHotwording_(); |
| 523 this.disconnectAllClients_(); | 523 this.disconnectAllClients_(); |
| 524 } | 524 } |
| 525 } | 525 } |
| 526 }; | 526 }; |
| 527 | 527 |
| 528 return { | 528 return { |
| 529 PageAudioManager: PageAudioManager | 529 PageAudioManager: PageAudioManager |
| 530 }; | 530 }; |
| 531 }); | 531 }); |
| OLD | NEW |