Index: chrome/browser/ui/webui/options/browser_options_handler.cc |
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc |
index a92334e8d5e1e9e969ed63c3b2bf577390d527d8..c38888a0cec96e1c6b63eefa2d87ba5b850f3777 100644 |
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc |
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc |
@@ -13,6 +13,7 @@ |
#include "base/bind_helpers.h" |
#include "base/command_line.h" |
#include "base/memory/singleton.h" |
+#include "base/metrics/field_trial.h" |
#include "base/metrics/histogram.h" |
#include "base/path_service.h" |
#include "base/prefs/pref_service.h" |
@@ -256,6 +257,11 @@ void BrowserOptionsHandler::GetLocalizedValues(base::DictionaryValue* values) { |
{ "homePageShowHomeButton", IDS_OPTIONS_TOOLBAR_SHOW_HOME_BUTTON }, |
{ "homePageUseNewTab", IDS_OPTIONS_HOMEPAGE_USE_NEWTAB }, |
{ "homePageUseURL", IDS_OPTIONS_HOMEPAGE_USE_URL }, |
+ { "hotwordSearchDescription", IDS_HOTWORD_SEARCH_PREF_DESCRIPTION }, |
+ { "hotwordSearchIncognito", IDS_HOTWORD_SEARCH_INCOGNITO_PREF_CHKBOX }, |
+ { "hotwordSearchTimeout", IDS_HOTWORD_SEARCH_TIMEOUT_PREF_CHKBOX }, |
+ { "hotwordSearchTimeoutDescription", |
+ IDS_HOTWORD_SEARCH_TIMEOUT_PREF_DESCRIPTION }, |
{ "importData", IDS_OPTIONS_IMPORT_DATA_BUTTON }, |
{ "improveBrowsingExperience", IDS_OPTIONS_IMPROVE_BROWSING_EXPERIENCE }, |
{ "languageAndSpellCheckSettingsButton", |
@@ -476,6 +482,10 @@ void BrowserOptionsHandler::GetLocalizedValues(base::DictionaryValue* values) { |
values->SetString( |
"defaultSearchGroupLabel", |
l10n_util::GetStringFUTF16(IDS_SEARCH_PREF_EXPLANATION, omnibox_url)); |
+ base::string16 hotword_url = base::ASCIIToUTF16(chrome::kHotwordLearnMoreURL); |
+ values->SetString( |
+ "hotwordSearchEnable", |
+ l10n_util::GetStringFUTF16(IDS_HOTWORD_SEARCH_PREF_CHKBOX, hotword_url)); |
#if defined(OS_CHROMEOS) |
Profile* profile = Profile::FromWebUI(web_ui()); |
@@ -698,6 +708,10 @@ void BrowserOptionsHandler::RegisterMessages() { |
base::Unretained(this))); |
} |
#endif |
+ web_ui()->RegisterMessageCallback( |
+ "requestHotwordAvailabile", |
+ base::Bind(&BrowserOptionsHandler::HandleRequestHotwordAvailable, |
+ base::Unretained(this))); |
} |
void BrowserOptionsHandler::Uninitialize() { |
@@ -1504,6 +1518,17 @@ void BrowserOptionsHandler::RemoveCloudPrintConnectorSection() { |
#endif // defined(OS_CHROMEOS) |
#endif // defined(ENABLE_FULL_PRINTING) |
+void BrowserOptionsHandler::SendHotwordAvailable() { |
+ std::string group = base::FieldTrialList::FindFullName("VoiceTrigger"); |
+ if (group != "" && group != "Disabled") |
+ web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection"); |
+} |
+ |
+void BrowserOptionsHandler::HandleRequestHotwordAvailable( |
+ const base::ListValue* args) { |
+ SendHotwordAvailable(); |
+} |
+ |
#if defined(OS_CHROMEOS) |
void BrowserOptionsHandler::HandleOpenWallpaperManager( |
const base::ListValue* args) { |