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

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: Re-add lost code, small change to browser_options.js 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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 base::Bind(&BrowserOptionsHandler::ShowCloudPrintDevicesPage, 739 base::Bind(&BrowserOptionsHandler::ShowCloudPrintDevicesPage,
740 base::Unretained(this))); 740 base::Unretained(this)));
741 } 741 }
742 #endif 742 #endif
743 web_ui()->RegisterMessageCallback( 743 web_ui()->RegisterMessageCallback(
744 "requestHotwordAvailable", 744 "requestHotwordAvailable",
745 base::Bind(&BrowserOptionsHandler::HandleRequestHotwordAvailable, 745 base::Bind(&BrowserOptionsHandler::HandleRequestHotwordAvailable,
746 base::Unretained(this))); 746 base::Unretained(this)));
747 747
748 web_ui()->RegisterMessageCallback( 748 web_ui()->RegisterMessageCallback(
749 "launchHotwordAudioVerificationApp",
750 base::Bind(
751 &BrowserOptionsHandler::HandleLaunchHotwordAudioVerificationApp,
752 base::Unretained(this)));
753
754 web_ui()->RegisterMessageCallback(
749 "launchEasyUnlockSetup", 755 "launchEasyUnlockSetup",
750 base::Bind(&BrowserOptionsHandler::HandleLaunchEasyUnlockSetup, 756 base::Bind(&BrowserOptionsHandler::HandleLaunchEasyUnlockSetup,
751 base::Unretained(this))); 757 base::Unretained(this)));
752 #if defined(OS_WIN) 758 #if defined(OS_WIN)
753 web_ui()->RegisterMessageCallback( 759 web_ui()->RegisterMessageCallback(
754 "refreshExtensionControlIndicators", 760 "refreshExtensionControlIndicators",
755 base::Bind( 761 base::Bind(
756 &BrowserOptionsHandler::HandleRefreshExtensionControlIndicators, 762 &BrowserOptionsHandler::HandleRefreshExtensionControlIndicators,
757 base::Unretained(this))); 763 base::Unretained(this)));
758 #endif // defined(OS_WIN) 764 #endif // defined(OS_WIN)
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 enabled, error_message); 1622 enabled, error_message);
1617 } 1623 }
1618 if (CommandLine::ForCurrentProcess()->HasSwitch( 1624 if (CommandLine::ForCurrentProcess()->HasSwitch(
1619 switches::kEnableExperimentalHotwording)) { 1625 switches::kEnableExperimentalHotwording)) {
1620 web_ui()->CallJavascriptFunction( 1626 web_ui()->CallJavascriptFunction(
1621 "BrowserOptions.showHotwordAlwaysOnSection"); 1627 "BrowserOptions.showHotwordAlwaysOnSection");
1622 } 1628 }
1623 } 1629 }
1624 } 1630 }
1625 1631
1632 void BrowserOptionsHandler::HandleLaunchHotwordAudioVerificationApp(
1633 const base::ListValue* args) {
1634 Profile* profile = Profile::FromWebUI(web_ui());
1635 HotwordService* hotword_service =
1636 HotwordServiceFactory::GetForProfile(profile);
1637 if (!hotword_service) {
Dan Beam 2014/09/23 05:53:39 when will we hit this case?
kcarattini 2014/09/23 06:46:16 I think the hotword service should exist for all p
rpetterson 2014/09/23 19:02:21 No, not for incognito (and currently guest). Bette
1638 return;
1639 }
Dan Beam 2014/09/23 05:53:39 nit: no curlies
kcarattini 2014/09/23 06:46:16 Done.
1640
1641 bool retrain = false;
1642 args->GetBoolean(0, &retrain);
Dan Beam 2014/09/23 05:53:39 unless this is optional, bool success = args->G
kcarattini 2014/09/23 06:46:16 Done.
1643 HotwordService::LaunchMode launch_mode =
1644 HotwordService::HOTWORD_AND_AUDIO_HISTORY;
1645
1646 if (retrain) {
1647 DCHECK(profile->GetPrefs()->GetBoolean(
1648 prefs::kHotwordAlwaysOnSearchEnabled));
1649 DCHECK(profile->GetPrefs()->GetBoolean(
1650 prefs::kHotwordAudioLoggingEnabled));
1651
1652 launch_mode = HotwordService::SPEECH_TRAINING;
1653 } else if (profile->GetPrefs()->GetBoolean(
1654 prefs::kHotwordAudioLoggingEnabled)) {
1655 DCHECK(!profile->GetPrefs()->GetBoolean(
1656 prefs::kHotwordAlwaysOnSearchEnabled));
1657
1658 // TODO(kcarattini): Make sure the Chrome Audio Logging pref is synced
1659 // to the account-level Audio History setting from footprints.
1660 launch_mode = HotwordService::HOTWORD_ONLY;
1661 } else {
1662 DCHECK(!profile->GetPrefs()->GetBoolean(
1663 prefs::kHotwordAlwaysOnSearchEnabled));
1664 }
1665
1666 hotword_service->LaunchHotwordAudioVerificationApp(launch_mode);
1667 }
1668
1626 void BrowserOptionsHandler::HandleLaunchEasyUnlockSetup( 1669 void BrowserOptionsHandler::HandleLaunchEasyUnlockSetup(
1627 const base::ListValue* args) { 1670 const base::ListValue* args) {
1628 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->LaunchSetup(); 1671 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->LaunchSetup();
1629 } 1672 }
1630 1673
1631 void BrowserOptionsHandler::HandleRefreshExtensionControlIndicators( 1674 void BrowserOptionsHandler::HandleRefreshExtensionControlIndicators(
1632 const base::ListValue* args) { 1675 const base::ListValue* args) {
1633 SetupExtensionControlledIndicators(); 1676 SetupExtensionControlledIndicators();
1634 } 1677 }
1635 1678
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 extension = extensions::GetExtensionOverridingProxy( 1924 extension = extensions::GetExtensionOverridingProxy(
1882 Profile::FromWebUI(web_ui())); 1925 Profile::FromWebUI(web_ui()));
1883 AppendExtensionData("proxy", extension, &extension_controlled); 1926 AppendExtensionData("proxy", extension, &extension_controlled);
1884 1927
1885 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", 1928 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators",
1886 extension_controlled); 1929 extension_controlled);
1887 #endif // defined(OS_WIN) 1930 #endif // defined(OS_WIN)
1888 } 1931 }
1889 1932
1890 } // namespace options 1933 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698