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

Unified Diff: chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc

Issue 2968073002: register voice interaction preference. (Closed)
Patch Set: add flag sync logic Created 3 years, 5 months 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
Index: chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc
diff --git a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc b/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc
index 7d2d7cd4f0a666cbc541fcbf515c37d222d8f31d..ad4f3b433aae8c459d722fbf223a7567d05c828f 100644
--- a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc
+++ b/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc
@@ -168,10 +168,12 @@ ArcVoiceInteractionFrameworkService::ArcVoiceInteractionFrameworkService(
ArcBridgeService* bridge_service)
: ArcService(bridge_service), binding_(this) {
arc_bridge_service()->voice_interaction_framework()->AddObserver(this);
+ ArcSessionManager::Get()->AddObserver(this);
}
ArcVoiceInteractionFrameworkService::~ArcVoiceInteractionFrameworkService() {
arc_bridge_service()->voice_interaction_framework()->RemoveObserver(this);
+ ArcSessionManager::Get()->RemoveObserver(this);
}
void ArcVoiceInteractionFrameworkService::OnInstanceReady() {
@@ -319,6 +321,13 @@ void ArcVoiceInteractionFrameworkService::HideMetalayer() {
SetMetalayerVisibility(false);
}
+void ArcVoiceInteractionFrameworkService::OnArcPlayStoreEnabledChanged(
+ bool enabled) {
+ if (!enabled)
+ ProfileManager::GetActiveUserProfile()->GetPrefs()->SetBoolean(
+ prefs::kVoiceInteractionPrefSynced, false);
+}
+
void ArcVoiceInteractionFrameworkService::StartVoiceInteractionSetupWizard() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
arc::mojom::VoiceInteractionFrameworkInstance* framework_instance =
@@ -377,6 +386,28 @@ void ArcVoiceInteractionFrameworkService::SetVoiceInteractionContextEnabled(
framework_instance->SetVoiceInteractionContextEnabled(enable);
}
+void ArcVoiceInteractionFrameworkService::UpdateVoiceInteractionPrefs() {
+ if (!ProfileManager::GetActiveUserProfile()->GetPrefs()->GetBoolean(
+ prefs::kVoiceInteractionPrefSynced)) {
+ mojom::VoiceInteractionFrameworkInstance* framework_instance =
+ ARC_GET_INSTANCE_FOR_METHOD(
+ arc_bridge_service()->voice_interaction_framework(),
+ GetVoiceInteractionSettings);
+ if (!framework_instance)
+ return;
+ framework_instance->GetVoiceInteractionSettings(base::Bind(
+ [](bool defined, bool feature_enabled, bool context_enabled) {
+ auto* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs();
+ prefs->SetBoolean(prefs::kVoiceInteractionPrefSynced, defined);
+ if (!defined)
+ return;
+ prefs->SetBoolean(prefs::kVoiceInteractionEnabled, feature_enabled);
+ prefs->SetBoolean(prefs::kVoiceInteractionContextEnabled,
+ context_enabled);
+ }));
+ }
+}
+
void ArcVoiceInteractionFrameworkService::StartSessionFromUserInteraction(
const gfx::Rect& rect) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);

Powered by Google App Engine
This is Rietveld 408576698