| 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..052bc51f8376f0a3fc23caf88b1b1805ba0376c4 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);
|
| }
|
| }
|
| }
|
|
|