Commit fbcb7a30 authored by David Black's avatar David Black Committed by Commit Bot

Add onboarding mode to Assistant state.

Onboarding mode will be wired up to the feature in a follow up CL.

Bug: b:157510970
Change-Id: Ifec0007db64361b00c2cb3451cc579a1aa884431
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2252926
Commit-Queue: David Black <dmblack@google.com>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: default avatarJeroen Dhollander <jeroendh@google.com>
Cr-Commit-Position: refs/heads/master@{#784220}
parent 5708ce2d
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "ash/assistant/assistant_state_controller.h" #include "ash/assistant/assistant_state_controller.h"
#include <memory> #include <memory>
#include <string>
#include "ash/assistant/assistant_controller_impl.h" #include "ash/assistant/assistant_controller_impl.h"
#include "ash/session/session_controller_impl.h" #include "ash/session/session_controller_impl.h"
...@@ -15,6 +16,19 @@ ...@@ -15,6 +16,19 @@
namespace ash { namespace ash {
namespace {
using chromeos::assistant::AssistantOnboardingMode;
using chromeos::assistant::prefs::ConsentStatus;
using chromeos::assistant::prefs::kAssistantConsentStatus;
using chromeos::assistant::prefs::kAssistantContextEnabled;
using chromeos::assistant::prefs::kAssistantEnabled;
using chromeos::assistant::prefs::kAssistantHotwordAlwaysOn;
using chromeos::assistant::prefs::kAssistantHotwordEnabled;
using chromeos::assistant::prefs::kAssistantLaunchWithMicOpen;
using chromeos::assistant::prefs::kAssistantNotificationEnabled;
using chromeos::assistant::prefs::kAssistantOnboardingMode;
class TestAssistantStateObserver : public AssistantStateObserver { class TestAssistantStateObserver : public AssistantStateObserver {
public: public:
TestAssistantStateObserver() = default; TestAssistantStateObserver() = default;
...@@ -42,6 +56,10 @@ class TestAssistantStateObserver : public AssistantStateObserver { ...@@ -42,6 +56,10 @@ class TestAssistantStateObserver : public AssistantStateObserver {
void OnAssistantNotificationEnabled(bool notification_enabled) override { void OnAssistantNotificationEnabled(bool notification_enabled) override {
notification_enabled_ = notification_enabled; notification_enabled_ = notification_enabled;
} }
void OnAssistantOnboardingModeChanged(
AssistantOnboardingMode onboarding_mode) override {
onboarding_mode_ = onboarding_mode;
}
int consent_status() const { return consent_status_; } int consent_status() const { return consent_status_; }
bool context_enabled() const { return context_enabled_; } bool context_enabled() const { return context_enabled_; }
...@@ -50,15 +68,17 @@ class TestAssistantStateObserver : public AssistantStateObserver { ...@@ -50,15 +68,17 @@ class TestAssistantStateObserver : public AssistantStateObserver {
bool hotword_enabled() const { return hotword_enabled_; } bool hotword_enabled() const { return hotword_enabled_; }
bool launch_with_mic_open() const { return launch_with_mic_open_; } bool launch_with_mic_open() const { return launch_with_mic_open_; }
bool notification_enabled() const { return notification_enabled_; } bool notification_enabled() const { return notification_enabled_; }
AssistantOnboardingMode onboarding_mode() const { return onboarding_mode_; }
private: private:
int consent_status_ = chromeos::assistant::prefs::ConsentStatus::kUnknown; int consent_status_ = ConsentStatus::kUnknown;
bool context_enabled_ = false; bool context_enabled_ = false;
bool settings_enabled_ = false; bool settings_enabled_ = false;
bool hotword_always_on_ = false; bool hotword_always_on_ = false;
bool hotword_enabled_ = false; bool hotword_enabled_ = false;
bool launch_with_mic_open_ = false; bool launch_with_mic_open_ = false;
bool notification_enabled_ = false; bool notification_enabled_ = false;
AssistantOnboardingMode onboarding_mode_ = AssistantOnboardingMode::kDefault;
DISALLOW_COPY_AND_ASSIGN(TestAssistantStateObserver); DISALLOW_COPY_AND_ASSIGN(TestAssistantStateObserver);
}; };
...@@ -89,61 +109,54 @@ class AssistantStateControllerTest : public AshTestBase { ...@@ -89,61 +109,54 @@ class AssistantStateControllerTest : public AshTestBase {
DISALLOW_COPY_AND_ASSIGN(AssistantStateControllerTest); DISALLOW_COPY_AND_ASSIGN(AssistantStateControllerTest);
}; };
} // namespace
TEST_F(AssistantStateControllerTest, InitObserver) { TEST_F(AssistantStateControllerTest, InitObserver) {
prefs()->SetInteger( prefs()->SetInteger(kAssistantConsentStatus,
chromeos::assistant::prefs::kAssistantConsentStatus, ConsentStatus::kActivityControlAccepted);
chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted); prefs()->SetBoolean(kAssistantContextEnabled, true);
prefs()->SetBoolean(chromeos::assistant::prefs::kAssistantContextEnabled, prefs()->SetBoolean(kAssistantEnabled, true);
true); prefs()->SetBoolean(kAssistantHotwordAlwaysOn, true);
prefs()->SetBoolean(chromeos::assistant::prefs::kAssistantEnabled, true); prefs()->SetBoolean(kAssistantHotwordEnabled, true);
prefs()->SetBoolean(chromeos::assistant::prefs::kAssistantHotwordAlwaysOn, prefs()->SetBoolean(kAssistantLaunchWithMicOpen, true);
true); prefs()->SetBoolean(kAssistantNotificationEnabled, true);
prefs()->SetBoolean(chromeos::assistant::prefs::kAssistantHotwordEnabled, prefs()->SetString(kAssistantOnboardingMode, "Default");
true);
prefs()->SetBoolean(chromeos::assistant::prefs::kAssistantLaunchWithMicOpen,
true);
prefs()->SetBoolean(chromeos::assistant::prefs::kAssistantNotificationEnabled,
true);
// The observer class should get an instant notification about the current // The observer class should get an instant notification about the current
// pref value. // pref value.
AssistantState::Get()->AddObserver(observer()); AssistantState::Get()->AddObserver(observer());
EXPECT_EQ(chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted, EXPECT_EQ(observer()->consent_status(),
observer()->consent_status()); ConsentStatus::kActivityControlAccepted);
EXPECT_EQ(observer()->context_enabled(), true); EXPECT_EQ(observer()->context_enabled(), true);
EXPECT_EQ(observer()->settings_enabled(), true); EXPECT_EQ(observer()->settings_enabled(), true);
EXPECT_EQ(observer()->hotword_always_on(), true); EXPECT_EQ(observer()->hotword_always_on(), true);
EXPECT_EQ(observer()->hotword_enabled(), true); EXPECT_EQ(observer()->hotword_enabled(), true);
EXPECT_EQ(observer()->launch_with_mic_open(), true); EXPECT_EQ(observer()->launch_with_mic_open(), true);
EXPECT_EQ(observer()->notification_enabled(), true); EXPECT_EQ(observer()->notification_enabled(), true);
EXPECT_EQ(observer()->onboarding_mode(), AssistantOnboardingMode::kDefault);
AssistantState::Get()->RemoveObserver(observer()); AssistantState::Get()->RemoveObserver(observer());
} }
TEST_F(AssistantStateControllerTest, NotifyConsentStatus) { TEST_F(AssistantStateControllerTest, NotifyConsentStatus) {
AssistantState::Get()->AddObserver(observer()); AssistantState::Get()->AddObserver(observer());
prefs()->SetInteger(chromeos::assistant::prefs::kAssistantConsentStatus, prefs()->SetInteger(kAssistantConsentStatus, ConsentStatus::kUnauthorized);
chromeos::assistant::prefs::ConsentStatus::kUnauthorized); EXPECT_EQ(observer()->consent_status(), ConsentStatus::kUnauthorized);
EXPECT_EQ(chromeos::assistant::prefs::ConsentStatus::kUnauthorized,
observer()->consent_status());
prefs()->SetInteger( prefs()->SetInteger(kAssistantConsentStatus,
chromeos::assistant::prefs::kAssistantConsentStatus, ConsentStatus::kActivityControlAccepted);
chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted); EXPECT_EQ(observer()->consent_status(),
EXPECT_EQ(chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted, ConsentStatus::kActivityControlAccepted);
observer()->consent_status());
AssistantState::Get()->RemoveObserver(observer()); AssistantState::Get()->RemoveObserver(observer());
} }
TEST_F(AssistantStateControllerTest, NotifyContextEnabled) { TEST_F(AssistantStateControllerTest, NotifyContextEnabled) {
AssistantState::Get()->AddObserver(observer()); AssistantState::Get()->AddObserver(observer());
prefs()->SetBoolean(chromeos::assistant::prefs::kAssistantContextEnabled, prefs()->SetBoolean(kAssistantContextEnabled, false);
false);
EXPECT_EQ(observer()->context_enabled(), false); EXPECT_EQ(observer()->context_enabled(), false);
prefs()->SetBoolean(chromeos::assistant::prefs::kAssistantContextEnabled, prefs()->SetBoolean(kAssistantContextEnabled, true);
true);
EXPECT_EQ(observer()->context_enabled(), true); EXPECT_EQ(observer()->context_enabled(), true);
AssistantState::Get()->RemoveObserver(observer()); AssistantState::Get()->RemoveObserver(observer());
} }
...@@ -151,10 +164,10 @@ TEST_F(AssistantStateControllerTest, NotifyContextEnabled) { ...@@ -151,10 +164,10 @@ TEST_F(AssistantStateControllerTest, NotifyContextEnabled) {
TEST_F(AssistantStateControllerTest, NotifySettingsEnabled) { TEST_F(AssistantStateControllerTest, NotifySettingsEnabled) {
AssistantState::Get()->AddObserver(observer()); AssistantState::Get()->AddObserver(observer());
prefs()->SetBoolean(chromeos::assistant::prefs::kAssistantEnabled, false); prefs()->SetBoolean(kAssistantEnabled, false);
EXPECT_EQ(observer()->settings_enabled(), false); EXPECT_EQ(observer()->settings_enabled(), false);
prefs()->SetBoolean(chromeos::assistant::prefs::kAssistantEnabled, true); prefs()->SetBoolean(kAssistantEnabled, true);
EXPECT_EQ(observer()->settings_enabled(), true); EXPECT_EQ(observer()->settings_enabled(), true);
AssistantState::Get()->RemoveObserver(observer()); AssistantState::Get()->RemoveObserver(observer());
} }
...@@ -162,12 +175,10 @@ TEST_F(AssistantStateControllerTest, NotifySettingsEnabled) { ...@@ -162,12 +175,10 @@ TEST_F(AssistantStateControllerTest, NotifySettingsEnabled) {
TEST_F(AssistantStateControllerTest, NotifyHotwordAlwaysOn) { TEST_F(AssistantStateControllerTest, NotifyHotwordAlwaysOn) {
AssistantState::Get()->AddObserver(observer()); AssistantState::Get()->AddObserver(observer());
prefs()->SetBoolean(chromeos::assistant::prefs::kAssistantHotwordAlwaysOn, prefs()->SetBoolean(kAssistantHotwordAlwaysOn, false);
false);
EXPECT_EQ(observer()->hotword_always_on(), false); EXPECT_EQ(observer()->hotword_always_on(), false);
prefs()->SetBoolean(chromeos::assistant::prefs::kAssistantHotwordAlwaysOn, prefs()->SetBoolean(kAssistantHotwordAlwaysOn, true);
true);
EXPECT_EQ(observer()->hotword_always_on(), true); EXPECT_EQ(observer()->hotword_always_on(), true);
AssistantState::Get()->RemoveObserver(observer()); AssistantState::Get()->RemoveObserver(observer());
} }
...@@ -175,12 +186,10 @@ TEST_F(AssistantStateControllerTest, NotifyHotwordAlwaysOn) { ...@@ -175,12 +186,10 @@ TEST_F(AssistantStateControllerTest, NotifyHotwordAlwaysOn) {
TEST_F(AssistantStateControllerTest, NotifyHotwordEnabled) { TEST_F(AssistantStateControllerTest, NotifyHotwordEnabled) {
AssistantState::Get()->AddObserver(observer()); AssistantState::Get()->AddObserver(observer());
prefs()->SetBoolean(chromeos::assistant::prefs::kAssistantHotwordEnabled, prefs()->SetBoolean(kAssistantHotwordEnabled, false);
false);
EXPECT_EQ(observer()->hotword_enabled(), false); EXPECT_EQ(observer()->hotword_enabled(), false);
prefs()->SetBoolean(chromeos::assistant::prefs::kAssistantHotwordEnabled, prefs()->SetBoolean(kAssistantHotwordEnabled, true);
true);
EXPECT_EQ(observer()->hotword_enabled(), true); EXPECT_EQ(observer()->hotword_enabled(), true);
AssistantState::Get()->RemoveObserver(observer()); AssistantState::Get()->RemoveObserver(observer());
} }
...@@ -188,12 +197,10 @@ TEST_F(AssistantStateControllerTest, NotifyHotwordEnabled) { ...@@ -188,12 +197,10 @@ TEST_F(AssistantStateControllerTest, NotifyHotwordEnabled) {
TEST_F(AssistantStateControllerTest, NotifyLaunchWithMicOpen) { TEST_F(AssistantStateControllerTest, NotifyLaunchWithMicOpen) {
AssistantState::Get()->AddObserver(observer()); AssistantState::Get()->AddObserver(observer());
prefs()->SetBoolean(chromeos::assistant::prefs::kAssistantLaunchWithMicOpen, prefs()->SetBoolean(kAssistantLaunchWithMicOpen, false);
false);
EXPECT_EQ(observer()->launch_with_mic_open(), false); EXPECT_EQ(observer()->launch_with_mic_open(), false);
prefs()->SetBoolean(chromeos::assistant::prefs::kAssistantLaunchWithMicOpen, prefs()->SetBoolean(kAssistantLaunchWithMicOpen, true);
true);
EXPECT_EQ(observer()->launch_with_mic_open(), true); EXPECT_EQ(observer()->launch_with_mic_open(), true);
AssistantState::Get()->RemoveObserver(observer()); AssistantState::Get()->RemoveObserver(observer());
} }
...@@ -201,14 +208,23 @@ TEST_F(AssistantStateControllerTest, NotifyLaunchWithMicOpen) { ...@@ -201,14 +208,23 @@ TEST_F(AssistantStateControllerTest, NotifyLaunchWithMicOpen) {
TEST_F(AssistantStateControllerTest, NotifyNotificationEnabled) { TEST_F(AssistantStateControllerTest, NotifyNotificationEnabled) {
AssistantState::Get()->AddObserver(observer()); AssistantState::Get()->AddObserver(observer());
prefs()->SetBoolean(chromeos::assistant::prefs::kAssistantNotificationEnabled, prefs()->SetBoolean(kAssistantNotificationEnabled, false);
false);
EXPECT_EQ(observer()->notification_enabled(), false); EXPECT_EQ(observer()->notification_enabled(), false);
prefs()->SetBoolean(chromeos::assistant::prefs::kAssistantNotificationEnabled, prefs()->SetBoolean(kAssistantNotificationEnabled, true);
true);
EXPECT_EQ(observer()->notification_enabled(), true); EXPECT_EQ(observer()->notification_enabled(), true);
AssistantState::Get()->RemoveObserver(observer()); AssistantState::Get()->RemoveObserver(observer());
} }
TEST_F(AssistantStateControllerTest, NotifyOnboardingModeChanged) {
AssistantState::Get()->AddObserver(observer());
prefs()->SetString(kAssistantOnboardingMode, "Default");
EXPECT_EQ(observer()->onboarding_mode(), AssistantOnboardingMode::kDefault);
prefs()->SetString(kAssistantOnboardingMode, "Education");
EXPECT_EQ(observer()->onboarding_mode(), AssistantOnboardingMode::kEducation);
AssistantState::Get()->RemoveObserver(observer());
}
} // namespace ash } // namespace ash
...@@ -9,24 +9,49 @@ ...@@ -9,24 +9,49 @@
#include "ash/public/cpp/accelerators.h" #include "ash/public/cpp/accelerators.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece_forward.h" #include "base/strings/string_piece_forward.h"
#include "components/prefs/pref_change_registrar.h" #include "components/prefs/pref_change_registrar.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
namespace ash { namespace ash {
namespace { namespace {
using chromeos::assistant::AssistantOnboardingMode;
#define PRINT_VALUE(value) PrintValue(&result, #value, value())
template <typename T, std::enable_if_t<std::is_enum<T>::value>* = nullptr>
void PrintValue(std::stringstream* result, const base::Optional<T>& value) {
*result << base::NumberToString(static_cast<int>(value.value()));
}
template <typename T, std::enable_if_t<!std::is_enum<T>::value>* = nullptr>
void PrintValue(std::stringstream* result, const base::Optional<T>& value) {
*result << value.value();
}
template <typename T> template <typename T>
void PrintValue(std::stringstream* result, void PrintValue(std::stringstream* result,
const std::string& name, const std::string& name,
const base::Optional<T>& value) { const base::Optional<T>& value) {
*result << std::endl << " " << name << ": "; *result << std::endl << " " << name << ": ";
if (value.has_value()) if (value.has_value())
*result << value.value(); PrintValue(result, value);
else else
*result << ("(no value)"); *result << ("(no value)");
} }
#define PRINT_VALUE(value) PrintValue(&result, #value, value()) AssistantOnboardingMode ToAssistantOnboardingMode(
const std::string& onboarding_mode) {
if (onboarding_mode == "Education")
return AssistantOnboardingMode::kEducation;
else if (onboarding_mode != "Default")
NOTREACHED();
return AssistantOnboardingMode::kDefault;
}
} // namespace } // namespace
AssistantStateBase::AssistantStateBase() = default; AssistantStateBase::AssistantStateBase() = default;
...@@ -38,7 +63,7 @@ AssistantStateBase::~AssistantStateBase() { ...@@ -38,7 +63,7 @@ AssistantStateBase::~AssistantStateBase() {
std::string AssistantStateBase::ToString() const { std::string AssistantStateBase::ToString() const {
std::stringstream result; std::stringstream result;
result << "AssistantStatus:"; result << "AssistantStatus: ";
result << assistant_status_; result << assistant_status_;
PRINT_VALUE(settings_enabled); PRINT_VALUE(settings_enabled);
PRINT_VALUE(context_enabled); PRINT_VALUE(context_enabled);
...@@ -47,6 +72,7 @@ std::string AssistantStateBase::ToString() const { ...@@ -47,6 +72,7 @@ std::string AssistantStateBase::ToString() const {
PRINT_VALUE(locale); PRINT_VALUE(locale);
PRINT_VALUE(arc_play_store_enabled); PRINT_VALUE(arc_play_store_enabled);
PRINT_VALUE(locked_full_screen_enabled); PRINT_VALUE(locked_full_screen_enabled);
PRINT_VALUE(onboarding_mode);
return result.str(); return result.str();
} }
...@@ -96,6 +122,10 @@ void AssistantStateBase::RegisterPrefChanges(PrefService* pref_service) { ...@@ -96,6 +122,10 @@ void AssistantStateBase::RegisterPrefChanges(PrefService* pref_service) {
chromeos::assistant::prefs::kAssistantNotificationEnabled, chromeos::assistant::prefs::kAssistantNotificationEnabled,
base::BindRepeating(&AssistantStateBase::UpdateNotificationEnabled, base::BindRepeating(&AssistantStateBase::UpdateNotificationEnabled,
base::Unretained(this))); base::Unretained(this)));
pref_change_registrar_->Add(
chromeos::assistant::prefs::kAssistantOnboardingMode,
base::BindRepeating(&AssistantStateBase::UpdateOnboardingMode,
base::Unretained(this)));
pref_change_registrar_->Add( pref_change_registrar_->Add(
chromeos::assistant::prefs::kAssistantQuickAnswersEnabled, chromeos::assistant::prefs::kAssistantQuickAnswersEnabled,
base::BindRepeating(&AssistantStateBase::UpdateQuickAnswersEnabled, base::BindRepeating(&AssistantStateBase::UpdateQuickAnswersEnabled,
...@@ -108,6 +138,7 @@ void AssistantStateBase::RegisterPrefChanges(PrefService* pref_service) { ...@@ -108,6 +138,7 @@ void AssistantStateBase::RegisterPrefChanges(PrefService* pref_service) {
UpdateHotwordEnabled(); UpdateHotwordEnabled();
UpdateLaunchWithMicOpen(); UpdateLaunchWithMicOpen();
UpdateNotificationEnabled(); UpdateNotificationEnabled();
UpdateOnboardingMode();
UpdateQuickAnswersEnabled(); UpdateQuickAnswersEnabled();
} }
...@@ -133,6 +164,8 @@ void AssistantStateBase::InitializeObserver(AssistantStateObserver* observer) { ...@@ -133,6 +164,8 @@ void AssistantStateBase::InitializeObserver(AssistantStateObserver* observer) {
observer->OnAssistantLaunchWithMicOpen(launch_with_mic_open_.value()); observer->OnAssistantLaunchWithMicOpen(launch_with_mic_open_.value());
if (notification_enabled_.has_value()) if (notification_enabled_.has_value())
observer->OnAssistantNotificationEnabled(notification_enabled_.value()); observer->OnAssistantNotificationEnabled(notification_enabled_.value());
if (onboarding_mode_.has_value())
observer->OnAssistantOnboardingModeChanged(onboarding_mode_.value());
if (quick_answers_enabled_.has_value()) if (quick_answers_enabled_.has_value())
observer->OnAssistantQuickAnswersEnabled(quick_answers_enabled_.value()); observer->OnAssistantQuickAnswersEnabled(quick_answers_enabled_.value());
...@@ -229,6 +262,19 @@ void AssistantStateBase::UpdateNotificationEnabled() { ...@@ -229,6 +262,19 @@ void AssistantStateBase::UpdateNotificationEnabled() {
observer.OnAssistantNotificationEnabled(notification_enabled_.value()); observer.OnAssistantNotificationEnabled(notification_enabled_.value());
} }
void AssistantStateBase::UpdateOnboardingMode() {
AssistantOnboardingMode onboarding_mode =
ToAssistantOnboardingMode(pref_change_registrar_->prefs()->GetString(
chromeos::assistant::prefs::kAssistantOnboardingMode));
if (onboarding_mode_ == onboarding_mode)
return;
onboarding_mode_ = onboarding_mode;
for (auto& observer : observers_)
observer.OnAssistantOnboardingModeChanged(onboarding_mode_.value());
}
void AssistantStateBase::UpdateAssistantStatus( void AssistantStateBase::UpdateAssistantStatus(
chromeos::assistant::AssistantStatus status) { chromeos::assistant::AssistantStatus status) {
assistant_status_ = status; assistant_status_ = status;
......
...@@ -34,6 +34,8 @@ class ASH_PUBLIC_EXPORT AssistantStateObserver : public base::CheckedObserver { ...@@ -34,6 +34,8 @@ class ASH_PUBLIC_EXPORT AssistantStateObserver : public base::CheckedObserver {
virtual void OnAssistantHotwordEnabled(bool enabled) {} virtual void OnAssistantHotwordEnabled(bool enabled) {}
virtual void OnAssistantLaunchWithMicOpen(bool launch_with_mic_open) {} virtual void OnAssistantLaunchWithMicOpen(bool launch_with_mic_open) {}
virtual void OnAssistantNotificationEnabled(bool notification_enabled) {} virtual void OnAssistantNotificationEnabled(bool notification_enabled) {}
virtual void OnAssistantOnboardingModeChanged(
chromeos::assistant::AssistantOnboardingMode onboarding_mode) {}
virtual void OnAssistantStateDestroyed() {} virtual void OnAssistantStateDestroyed() {}
virtual void OnAssistantQuickAnswersEnabled(bool quick_answers_enabled) {} virtual void OnAssistantQuickAnswersEnabled(bool quick_answers_enabled) {}
virtual void OnAssistantStatusChanged( virtual void OnAssistantStatusChanged(
...@@ -88,6 +90,11 @@ class ASH_PUBLIC_EXPORT AssistantStateBase { ...@@ -88,6 +90,11 @@ class ASH_PUBLIC_EXPORT AssistantStateBase {
return notification_enabled_; return notification_enabled_;
} }
const base::Optional<chromeos::assistant::AssistantOnboardingMode>&
onboarding_mode() const {
return onboarding_mode_;
}
const base::Optional<chromeos::assistant::AssistantAllowedState>& const base::Optional<chromeos::assistant::AssistantAllowedState>&
allowed_state() const { allowed_state() const {
return allowed_state_; return allowed_state_;
...@@ -123,6 +130,7 @@ class ASH_PUBLIC_EXPORT AssistantStateBase { ...@@ -123,6 +130,7 @@ class ASH_PUBLIC_EXPORT AssistantStateBase {
void UpdateHotwordEnabled(); void UpdateHotwordEnabled();
void UpdateLaunchWithMicOpen(); void UpdateLaunchWithMicOpen();
void UpdateNotificationEnabled(); void UpdateNotificationEnabled();
void UpdateOnboardingMode();
void UpdateQuickAnswersEnabled(); void UpdateQuickAnswersEnabled();
// Called when new values of the listened states are received. // Called when new values of the listened states are received.
...@@ -161,6 +169,9 @@ class ASH_PUBLIC_EXPORT AssistantStateBase { ...@@ -161,6 +169,9 @@ class ASH_PUBLIC_EXPORT AssistantStateBase {
// Whether notification is enabled. // Whether notification is enabled.
base::Optional<bool> notification_enabled_; base::Optional<bool> notification_enabled_;
// The mode for the Assistant onboarding experience.
base::Optional<chromeos::assistant::AssistantOnboardingMode> onboarding_mode_;
// Whether the Assistant feature is allowed or disallowed for what reason. // Whether the Assistant feature is allowed or disallowed for what reason.
// nullopt if the data is not available yet. // nullopt if the data is not available yet.
base::Optional<chromeos::assistant::AssistantAllowedState> allowed_state_; base::Optional<chromeos::assistant::AssistantAllowedState> allowed_state_;
......
...@@ -42,6 +42,9 @@ enum AssistantAllowedState { ...@@ -42,6 +42,9 @@ enum AssistantAllowedState {
MAX_VALUE = DISALLOWED_BY_KIOSK_MODE, MAX_VALUE = DISALLOWED_BY_KIOSK_MODE,
}; };
// The mode of the Assistant onboarding experience.
enum class AssistantOnboardingMode { kDefault, kEducation };
// Enumeration of possible Assistant query sources. These values are persisted // Enumeration of possible Assistant query sources. These values are persisted
// to logs. Entries should not be renumbered and numeric values should never // to logs. Entries should not be renumbered and numeric values should never
// be reused. Append new values to the end. // be reused. Append new values to the end.
......
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