| 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 6cd7245380864daf316a1121434b3a04fa3fa538..4e46cf5ed1e5642d4be39463122e591c6f018e38 100644
|
| --- a/chrome/browser/ui/webui/options/browser_options_handler.cc
|
| +++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
|
| @@ -44,6 +44,7 @@
|
| #include "chrome/browser/profiles/profile_shortcut_manager.h"
|
| #include "chrome/browser/profiles/profile_window.h"
|
| #include "chrome/browser/profiles/profiles_state.h"
|
| +#include "chrome/browser/search/hotword_audio_history_handler.h"
|
| #include "chrome/browser/search/hotword_service.h"
|
| #include "chrome/browser/search/hotword_service_factory.h"
|
| #include "chrome/browser/search/search.h"
|
| @@ -1674,6 +1675,16 @@ void BrowserOptionsHandler::ShowCloudPrintDevicesPage(
|
|
|
| #endif
|
|
|
| +void BrowserOptionsHandler::SetHotwordAudioHistorySectionVisible(
|
| + bool always_on, bool success, bool logging_enabled) {
|
| + web_ui()->CallJavascriptFunction(
|
| + "BrowserOptions.setAudioHistorySectionVisible",
|
| + base::FundamentalValue(logging_enabled),
|
| + base::FundamentalValue(always_on));
|
| +
|
| + // TODO(rlp): Add version with error display if !success.
|
| +}
|
| +
|
| void BrowserOptionsHandler::HandleRequestHotwordAvailable(
|
| const base::ListValue* args) {
|
| Profile* profile = Profile::FromWebUI(web_ui());
|
| @@ -1707,10 +1718,16 @@ void BrowserOptionsHandler::HandleRequestHotwordAvailable(
|
| // Audio history should be displayed if it's enabled regardless of the
|
| // hotword error state. An additional message is displayed if always-on
|
| // hotwording is enabled.
|
| - if (profile->GetPrefs()->GetBoolean(prefs::kHotwordAudioLoggingEnabled) &&
|
| - HotwordService::IsExperimentalHotwordingEnabled()) {
|
| - web_ui()->CallJavascriptFunction("BrowserOptions.showAudioHistorySection",
|
| - base::FundamentalValue(always_on));
|
| + if (HotwordService::IsExperimentalHotwordingEnabled()) {
|
| + HotwordService* hotword_service =
|
| + HotwordServiceFactory::GetForProfile(profile);
|
| + if (hotword_service) {
|
| + hotword_service->GetAudioHistoryHandler()->GetAudioHistoryEnabled(
|
| + base::Bind(
|
| + &BrowserOptionsHandler::SetHotwordAudioHistorySectionVisible,
|
| + weak_ptr_factory_.GetWeakPtr(),
|
| + always_on));
|
| + }
|
| }
|
|
|
| if (!error) {
|
| @@ -1745,8 +1762,6 @@ void BrowserOptionsHandler::HandleLaunchHotwordAudioVerificationApp(
|
| prefs::kHotwordAudioLoggingEnabled));
|
|
|
| launch_mode = HotwordService::RETRAIN;
|
| - // TODO(rlp): Make sure the Chrome Audio History pref is synced
|
| - // to the account-level Audio History setting from footprints.
|
| } else if (profile->GetPrefs()->GetBoolean(
|
| prefs::kHotwordAudioLoggingEnabled)) {
|
| DCHECK(!profile->GetPrefs()->GetBoolean(
|
|
|