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

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

Issue 800523002: [Hotword] Sync Audio History pref every 24 hours, when opening chrome://settings and . . . (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another compile error Created 6 years 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/ui/webui/options/browser_options_handler.h ('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 6cd7245380864daf316a1121434b3a04fa3fa538..d59dead61a80ecffe77cabf4f5d2cb5aec4903f4 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,15 @@ void BrowserOptionsHandler::ShowCloudPrintDevicesPage(
#endif
+void BrowserOptionsHandler::ShowHotwordAudioHistorySection(
+ bool always_on, bool success, bool logging_enabled) {
+ if (success && logging_enabled) {
Dan Beam 2014/12/12 20:04:20 if !success or !logging_enabled should this sectio
rpetterson 2014/12/12 20:19:36 Ideally, if !success we would show an error. I act
Dan Beam 2014/12/12 20:25:46 i generally ask this type of question whenever I s
rpetterson 2014/12/12 21:39:56 Since I prefer doing things the right way, I've up
+ web_ui()->CallJavascriptFunction("BrowserOptions.showAudioHistorySection",
+ base::FundamentalValue(always_on));
+ }
+ // TODO(rlp): Add version with error display.
+}
+
void BrowserOptionsHandler::HandleRequestHotwordAvailable(
const base::ListValue* args) {
Profile* profile = Profile::FromWebUI(web_ui());
@@ -1707,10 +1717,14 @@ 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)
Dan Beam 2014/12/12 20:04:20 curlies
rpetterson 2014/12/12 20:19:36 Done.
+ hotword_service->GetAudioHistoryHandler()->GetAudioHistoryEnabled(
+ base::Bind(&BrowserOptionsHandler::ShowHotwordAudioHistorySection,
+ weak_ptr_factory_.GetWeakPtr(),
+ always_on));
}
if (!error) {
@@ -1745,8 +1759,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(
« no previous file with comments | « chrome/browser/ui/webui/options/browser_options_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698