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

Side by Side Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 559303002: Hotword Audio Verification app: control the hotword settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@launch-state
Patch Set: Created 6 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/webui/options/browser_options_handler.h" 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 base::Bind(&BrowserOptionsHandler::ShowCloudPrintDevicesPage, 744 base::Bind(&BrowserOptionsHandler::ShowCloudPrintDevicesPage,
745 base::Unretained(this))); 745 base::Unretained(this)));
746 } 746 }
747 #endif 747 #endif
748 web_ui()->RegisterMessageCallback( 748 web_ui()->RegisterMessageCallback(
749 "requestHotwordAvailable", 749 "requestHotwordAvailable",
750 base::Bind(&BrowserOptionsHandler::HandleRequestHotwordAvailable, 750 base::Bind(&BrowserOptionsHandler::HandleRequestHotwordAvailable,
751 base::Unretained(this))); 751 base::Unretained(this)));
752 752
753 web_ui()->RegisterMessageCallback( 753 web_ui()->RegisterMessageCallback(
754 "launchHotwordAudioVerificationApp",
755 base::Bind(
756 &BrowserOptionsHandler::HandleLaunchHotwordAudioVerificationApp,
757 base::Unretained(this)));
758
759 web_ui()->RegisterMessageCallback(
754 "launchEasyUnlockSetup", 760 "launchEasyUnlockSetup",
755 base::Bind(&BrowserOptionsHandler::HandleLaunchEasyUnlockSetup, 761 base::Bind(&BrowserOptionsHandler::HandleLaunchEasyUnlockSetup,
756 base::Unretained(this))); 762 base::Unretained(this)));
757 #if defined(OS_WIN) 763 #if defined(OS_WIN)
758 web_ui()->RegisterMessageCallback( 764 web_ui()->RegisterMessageCallback(
759 "refreshExtensionControlIndicators", 765 "refreshExtensionControlIndicators",
760 base::Bind( 766 base::Bind(
761 &BrowserOptionsHandler::HandleRefreshExtensionControlIndicators, 767 &BrowserOptionsHandler::HandleRefreshExtensionControlIndicators,
762 base::Unretained(this))); 768 base::Unretained(this)));
763 #endif // defined(OS_WIN) 769 #endif // defined(OS_WIN)
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 enabled, error_message); 1604 enabled, error_message);
1599 } 1605 }
1600 if (CommandLine::ForCurrentProcess()->HasSwitch( 1606 if (CommandLine::ForCurrentProcess()->HasSwitch(
1601 switches::kEnableExperimentalHotwording)) { 1607 switches::kEnableExperimentalHotwording)) {
1602 web_ui()->CallJavascriptFunction( 1608 web_ui()->CallJavascriptFunction(
1603 "BrowserOptions.showHotwordAlwaysOnSection"); 1609 "BrowserOptions.showHotwordAlwaysOnSection");
1604 } 1610 }
1605 } 1611 }
1606 } 1612 }
1607 1613
1614 void BrowserOptionsHandler::HandleLaunchHotwordAudioVerificationApp(
1615 const base::ListValue* args) {
1616 Profile* profile = Profile::FromWebUI(web_ui());
1617 HotwordService* hotword_service =
1618 HotwordServiceFactory::GetForProfile(profile);
1619 if (!hotword_service) {
1620 return;
1621 }
1622
1623 bool retrain = false;
1624 args->GetBoolean(0, &retrain);
1625
1626 if (retrain) {
1627 DCHECK(profile->GetPrefs()->GetBoolean(
rpetterson 2014/09/11 20:14:17 I would do all these DCHECKs in the similar if sta
kcarattini 2014/09/12 01:02:08 Done.
1628 prefs::kHotwordAlwaysOnSearchEnabled));
1629 DCHECK(profile->GetPrefs()->GetBoolean(
1630 prefs::kHotwordAudioLoggingEnabled));
1631 } else {
1632 DCHECK(!profile->GetPrefs()->GetBoolean(
1633 prefs::kHotwordAlwaysOnSearchEnabled));
1634 }
1635
1636 if (retrain) {
rpetterson 2014/09/11 20:14:17 Would the following be clearer? LaunchMode launch
kcarattini 2014/09/12 01:02:08 Done.
1637 hotword_service->LaunchHotwordAudioVerificationApp(
1638 HotwordService::SPEECH_TRAINING);
1639 } else if (profile->GetPrefs()->GetBoolean(
1640 prefs::kHotwordAudioLoggingEnabled)) {
1641 // TODO(kcarattini): Make sure the Chrome Audio Logging pref is synced
1642 // to the account-level Audio History setting from footprints.
1643 hotword_service->LaunchHotwordAudioVerificationApp(
1644 HotwordService::HOTWORD_ONLY);
1645 } else {
1646 hotword_service->LaunchHotwordAudioVerificationApp(
1647 HotwordService::HOTWORD_AND_AUDIO_HISTORY);
1648 }
1649 }
1650
1608 void BrowserOptionsHandler::HandleLaunchEasyUnlockSetup( 1651 void BrowserOptionsHandler::HandleLaunchEasyUnlockSetup(
1609 const base::ListValue* args) { 1652 const base::ListValue* args) {
1610 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->LaunchSetup(); 1653 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->LaunchSetup();
1611 } 1654 }
1612 1655
1613 void BrowserOptionsHandler::HandleRefreshExtensionControlIndicators( 1656 void BrowserOptionsHandler::HandleRefreshExtensionControlIndicators(
1614 const base::ListValue* args) { 1657 const base::ListValue* args) {
1615 SetupExtensionControlledIndicators(); 1658 SetupExtensionControlledIndicators();
1616 } 1659 }
1617 1660
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 extension = extensions::GetExtensionOverridingProxy( 1906 extension = extensions::GetExtensionOverridingProxy(
1864 Profile::FromWebUI(web_ui())); 1907 Profile::FromWebUI(web_ui()));
1865 AppendExtensionData("proxy", extension, &extension_controlled); 1908 AppendExtensionData("proxy", extension, &extension_controlled);
1866 1909
1867 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", 1910 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators",
1868 extension_controlled); 1911 extension_controlled);
1869 #endif // defined(OS_WIN) 1912 #endif // defined(OS_WIN)
1870 } 1913 }
1871 1914
1872 } // namespace options 1915 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698