Chromium Code Reviews| 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 321df72e984ba23e516b2d74f8fe5e2aa5fcc103..6f7a6a29e2a79529d0b056be8e18c58e95436c04 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 fcn_name; |
|
rpetterson
2014/11/03 18:14:16
what does "fcn" stand for? maybe a name that makes
kcarattini
2014/11/03 23:39:24
Done.
|
| if (CommandLine::ForCurrentProcess()->HasSwitch( |
| switches::kEnableExperimentalHotwording)) { |
| if (HotwordServiceFactory::IsHotwordHardwareAvailable()) { |
| - web_ui()->CallJavascriptFunction( |
| - "BrowserOptions.showHotwordAlwaysOnSection"); |
| + fcn_name = "BrowserOptions.showHotwordAlwaysOnSection"; |
| } else { |
| - web_ui()->CallJavascriptFunction( |
| - "BrowserOptions.showHotwordNoDSPSection"); |
| + fcn_name = "BrowserOptions.showHotwordNoDSPSection"; |
| } |
| - } else if (!error) { |
| - web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection", |
| - enabled); |
| + } else { |
| + fcn_name = "BrowserOptions.showHotwordSection"; |
| + } |
| + |
| + if (!error) { |
| + web_ui()->CallJavascriptFunction(fcn_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(fcn_name, error_message); |
| } |
| } |
| } |