Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(818)

Side by Side Diff: chrome/browser/resources/hotword/page_audio_manager.js

Issue 1011913005: Hotword: Adds a field for always_on_available to the API StatusDetails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Typo Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 * Sends the response to the tab. 447 * Sends the response to the tab.
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 always-on is available, then we do not show the promo, as the promo
458 // only works with the sometimes-on pref.
457 if (!tab.incognito && hotwordStatus.available && 459 if (!tab.incognito && hotwordStatus.available &&
458 !hotwordStatus.enabledSet) { 460 !hotwordStatus.enabledSet && !hotwordStatus.alwaysOnAvailable) {
459 response = hotwordStatus; 461 response = hotwordStatus;
460 } 462 }
461 463
462 try { 464 try {
463 sendResponse(response); 465 sendResponse(response);
464 } catch (err) { 466 } catch (err) {
465 // Suppress the exception thrown by sendResponse() when the page doesn't 467 // Suppress the exception thrown by sendResponse() when the page doesn't
466 // specify a response callback in the call to 468 // specify a response callback in the call to
467 // chrome.runtime.sendMessage(). 469 // chrome.runtime.sendMessage().
468 // Unfortunately, there doesn't appear to be a way to detect one-way 470 // 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
522 this.stopHotwording_(); 524 this.stopHotwording_();
523 this.disconnectAllClients_(); 525 this.disconnectAllClients_();
524 } 526 }
525 } 527 }
526 }; 528 };
527 529
528 return { 530 return {
529 PageAudioManager: PageAudioManager 531 PageAudioManager: PageAudioManager
530 }; 532 };
531 }); 533 });
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/hotword_private/hotword_private_api.cc ('k') | chrome/common/extensions/api/hotword_private.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698