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

Unified Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 134103005: [Hotword] Putting preferences under search for hotword service. Putting behind a flag. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: adding a line. maybe it will help? Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
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) {
« no previous file with comments | « chrome/browser/ui/webui/options/browser_options_handler.h ('k') | chrome/browser/ui/webui/options/settings_app_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698