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

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: Rebase 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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 enabled, error_message); 1639 enabled, error_message);
1634 } 1640 }
1635 if (CommandLine::ForCurrentProcess()->HasSwitch( 1641 if (CommandLine::ForCurrentProcess()->HasSwitch(
1636 switches::kEnableExperimentalHotwording)) { 1642 switches::kEnableExperimentalHotwording)) {
1637 web_ui()->CallJavascriptFunction( 1643 web_ui()->CallJavascriptFunction(
1638 "BrowserOptions.showHotwordAlwaysOnSection"); 1644 "BrowserOptions.showHotwordAlwaysOnSection");
1639 } 1645 }
1640 } 1646 }
1641 } 1647 }
1642 1648
1649 void BrowserOptionsHandler::HandleLaunchHotwordAudioVerificationApp(
1650 const base::ListValue* args) {
1651 Profile* profile = Profile::FromWebUI(web_ui());
1652
1653 bool retrain = false;
1654 bool success = args->GetBoolean(0, &retrain);
1655 DCHECK(success);
1656 HotwordService::LaunchMode launch_mode =
1657 HotwordService::HOTWORD_AND_AUDIO_HISTORY;
1658
1659 if (retrain) {
1660 DCHECK(profile->GetPrefs()->GetBoolean(
1661 prefs::kHotwordAlwaysOnSearchEnabled));
1662 DCHECK(profile->GetPrefs()->GetBoolean(
1663 prefs::kHotwordAudioLoggingEnabled));
1664
1665 launch_mode = HotwordService::SPEECH_TRAINING;
1666 } else if (profile->GetPrefs()->GetBoolean(
1667 prefs::kHotwordAudioLoggingEnabled)) {
1668 DCHECK(!profile->GetPrefs()->GetBoolean(
1669 prefs::kHotwordAlwaysOnSearchEnabled));
1670
1671 // TODO(kcarattini): Make sure the Chrome Audio Logging pref is synced
1672 // to the account-level Audio History setting from footprints.
1673 launch_mode = HotwordService::HOTWORD_ONLY;
1674 } else {
1675 DCHECK(!profile->GetPrefs()->GetBoolean(
1676 prefs::kHotwordAlwaysOnSearchEnabled));
1677 }
1678
1679 HotwordService* hotword_service =
1680 HotwordServiceFactory::GetForProfile(profile);
1681 if (!hotword_service)
1682 return;
1683
1684 hotword_service->LaunchHotwordAudioVerificationApp(launch_mode);
1685 }
1686
1643 void BrowserOptionsHandler::HandleLaunchEasyUnlockSetup( 1687 void BrowserOptionsHandler::HandleLaunchEasyUnlockSetup(
1644 const base::ListValue* args) { 1688 const base::ListValue* args) {
1645 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->LaunchSetup(); 1689 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->LaunchSetup();
1646 } 1690 }
1647 1691
1648 void BrowserOptionsHandler::HandleRefreshExtensionControlIndicators( 1692 void BrowserOptionsHandler::HandleRefreshExtensionControlIndicators(
1649 const base::ListValue* args) { 1693 const base::ListValue* args) {
1650 SetupExtensionControlledIndicators(); 1694 SetupExtensionControlledIndicators();
1651 } 1695 }
1652 1696
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 1976
1933 void BrowserOptionsHandler::SetMetricsReportingCheckbox(bool checked, 1977 void BrowserOptionsHandler::SetMetricsReportingCheckbox(bool checked,
1934 bool disabled) { 1978 bool disabled) {
1935 web_ui()->CallJavascriptFunction( 1979 web_ui()->CallJavascriptFunction(
1936 "BrowserOptions.setMetricsReportingCheckboxState", 1980 "BrowserOptions.setMetricsReportingCheckboxState",
1937 base::FundamentalValue(checked), 1981 base::FundamentalValue(checked),
1938 base::FundamentalValue(disabled)); 1982 base::FundamentalValue(disabled));
1939 } 1983 }
1940 1984
1941 } // namespace options 1985 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/browser_options_handler.h ('k') | chrome/common/extensions/api/hotword_private.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698