Commit 87cb08e7 authored by Ramin Halavati's avatar Ramin Halavati Committed by Commit Bot

Network Traffic annotation in HotwordAudioHistorySearch marked ChromeOS only.

Network traffic annotation in HotwordAudioHistorySearch is only used in
ChromeOS and is not called on other platforms. It is marked so that it would
not be caught by network traffic annotation tests.

BUG=656607

Change-Id: I7640f25711ff2f2194c7846c89c33e508493bfd8
Reviewed-on: https://chromium-review.googlesource.com/535559Reviewed-by: default avatarMatt Giuca <mgiuca@chromium.org>
Commit-Queue: Ramin Halavati <rhalavati@chromium.org>
Cr-Commit-Position: refs/heads/master@{#481820}
parent 63fbf039
......@@ -54,6 +54,8 @@ void HotwordAudioHistoryHandler::UpdateLocalPreference(
void HotwordAudioHistoryHandler::GetAudioHistoryEnabled(
const HotwordAudioHistoryCallback& callback) {
// Please add network traffic annotation if you want to remove this #if.
#if defined(OS_CHROMEOS)
history::WebHistoryService* web_history = GetWebHistory();
if (web_history) {
web_history->GetAudioHistoryEnabled(
......@@ -66,11 +68,17 @@ void HotwordAudioHistoryHandler::GetAudioHistoryEnabled(
PrefService* prefs = profile_->GetPrefs();
callback.Run(false, prefs->GetBoolean(prefs::kHotwordAudioLoggingEnabled));
}
#else
NOTREACHED()
<< ": This functions is supposed to be called only in Chrome OS.";
#endif // defined(OS_CHROMEOS)
}
void HotwordAudioHistoryHandler::SetAudioHistoryEnabled(
const bool enabled,
const HotwordAudioHistoryCallback& callback) {
// Please add network traffic annotation if you want to remove this #if.
#if defined(OS_CHROMEOS)
history::WebHistoryService* web_history = GetWebHistory();
if (web_history) {
web_history->SetAudioHistoryEnabled(
......@@ -84,6 +92,10 @@ void HotwordAudioHistoryHandler::SetAudioHistoryEnabled(
PrefService* prefs = profile_->GetPrefs();
callback.Run(false, prefs->GetBoolean(prefs::kHotwordAudioLoggingEnabled));
}
#else
NOTREACHED()
<< ": This functions is supposed to be called only in Chrome OS.";
#endif // defined(OS_CHROMEOS)
}
void HotwordAudioHistoryHandler::GetAudioHistoryComplete(
......
......@@ -365,8 +365,14 @@ HotwordService::HotwordService(Profile* profile)
&HotwordService::MaybeReinstallHotwordExtension),
weak_factory_.GetWeakPtr()));
// This service is actually used only on ChromeOS, and the next function
// results in a sequence of calls that triggers
// HotwordAudioHistoryHandler::GetAudioHistoryEnabled which is not supported
// on other platforms.
#if defined(OS_CHROMEOS)
SetAudioHistoryHandler(new HotwordAudioHistoryHandler(
profile_, base::ThreadTaskRunnerHandle::Get()));
#endif
if (HotwordServiceFactory::IsAlwaysOnAvailable() &&
IsHotwordAllowed()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment