OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 DCHECK(hotword_service); | |
Dan Beam
2014/09/23 18:45:18
^ can you move |hotword_service|'s initialization
kcarattini
2014/09/23 23:56:50
Done.
| |
1638 | |
1639 bool retrain = false; | |
1640 bool success = args->GetBoolean(0, &retrain); | |
1641 DCHECK(success); | |
1642 HotwordService::LaunchMode launch_mode = | |
1643 HotwordService::HOTWORD_AND_AUDIO_HISTORY; | |
1644 | |
1645 if (retrain) { | |
1646 DCHECK(profile->GetPrefs()->GetBoolean( | |
1647 prefs::kHotwordAlwaysOnSearchEnabled)); | |
1648 DCHECK(profile->GetPrefs()->GetBoolean( | |
1649 prefs::kHotwordAudioLoggingEnabled)); | |
1650 | |
1651 launch_mode = HotwordService::SPEECH_TRAINING; | |
1652 } else if (profile->GetPrefs()->GetBoolean( | |
1653 prefs::kHotwordAudioLoggingEnabled)) { | |
1654 DCHECK(!profile->GetPrefs()->GetBoolean( | |
1655 prefs::kHotwordAlwaysOnSearchEnabled)); | |
1656 | |
1657 // TODO(kcarattini): Make sure the Chrome Audio Logging pref is synced | |
1658 // to the account-level Audio History setting from footprints. | |
1659 launch_mode = HotwordService::HOTWORD_ONLY; | |
1660 } else { | |
1661 DCHECK(!profile->GetPrefs()->GetBoolean( | |
1662 prefs::kHotwordAlwaysOnSearchEnabled)); | |
1663 } | |
1664 | |
1665 hotword_service->LaunchHotwordAudioVerificationApp(launch_mode); | |
1666 } | |
1667 | |
1626 void BrowserOptionsHandler::HandleLaunchEasyUnlockSetup( | 1668 void BrowserOptionsHandler::HandleLaunchEasyUnlockSetup( |
1627 const base::ListValue* args) { | 1669 const base::ListValue* args) { |
1628 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->LaunchSetup(); | 1670 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->LaunchSetup(); |
1629 } | 1671 } |
1630 | 1672 |
1631 void BrowserOptionsHandler::HandleRefreshExtensionControlIndicators( | 1673 void BrowserOptionsHandler::HandleRefreshExtensionControlIndicators( |
1632 const base::ListValue* args) { | 1674 const base::ListValue* args) { |
1633 SetupExtensionControlledIndicators(); | 1675 SetupExtensionControlledIndicators(); |
1634 } | 1676 } |
1635 | 1677 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1881 extension = extensions::GetExtensionOverridingProxy( | 1923 extension = extensions::GetExtensionOverridingProxy( |
1882 Profile::FromWebUI(web_ui())); | 1924 Profile::FromWebUI(web_ui())); |
1883 AppendExtensionData("proxy", extension, &extension_controlled); | 1925 AppendExtensionData("proxy", extension, &extension_controlled); |
1884 | 1926 |
1885 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", | 1927 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", |
1886 extension_controlled); | 1928 extension_controlled); |
1887 #endif // defined(OS_WIN) | 1929 #endif // defined(OS_WIN) |
1888 } | 1930 } |
1889 | 1931 |
1890 } // namespace options | 1932 } // namespace options |
OLD | NEW |