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

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

Issue 693393004: Add error indicators to always-on andno-dsp hotword checkboxes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review Comments Created 6 years, 1 month 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
« no previous file with comments | « chrome/browser/resources/options/hotword_search_setting_indicator.css ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2c79d98ca25c7582c0c41ce0a9e09ea420e4d9ee..983fc3f5b0633640ce98452c65ea52819795c9ab 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -1621,25 +1621,26 @@ void BrowserOptionsHandler::HandleRequestHotwordAvailable(
const base::ListValue* args) {
Profile* profile = Profile::FromWebUI(web_ui());
std::string group = base::FieldTrialList::FindFullName("VoiceTrigger");
- base::FundamentalValue enabled(
- profile->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled));
if (group != "" && group != "Disabled" &&
HotwordServiceFactory::IsHotwordAllowed(profile)) {
// Update the current error value.
HotwordServiceFactory::IsServiceAvailable(profile);
int error = HotwordServiceFactory::GetCurrentError(profile);
+
+ std::string function_name;
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableExperimentalHotwording)) {
if (HotwordServiceFactory::IsHotwordHardwareAvailable()) {
- web_ui()->CallJavascriptFunction(
- "BrowserOptions.showHotwordAlwaysOnSection");
+ function_name = "BrowserOptions.showHotwordAlwaysOnSection";
} else {
- web_ui()->CallJavascriptFunction(
- "BrowserOptions.showHotwordNoDSPSection");
+ function_name = "BrowserOptions.showHotwordNoDspSection";
}
- } else if (!error) {
- web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection",
- enabled);
+ } else {
+ function_name = "BrowserOptions.showHotwordSection";
+ }
+
+ if (!error) {
+ web_ui()->CallJavascriptFunction(function_name);
} else {
base::string16 hotword_help_url =
base::ASCIIToUTF16(chrome::kHotwordLearnMoreURL);
@@ -1648,8 +1649,7 @@ void BrowserOptionsHandler::HandleRequestHotwordAvailable(
error_message = base::StringValue(
l10n_util::GetStringFUTF16(error, hotword_help_url));
}
- web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection",
- enabled, error_message);
+ web_ui()->CallJavascriptFunction(function_name, error_message);
}
}
}
« no previous file with comments | « chrome/browser/resources/options/hotword_search_setting_indicator.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698