#ifndef ASH_USER_EDUCATION_USER_EDUCATION_UTIL_H_
#define ASH_USER_EDUCATION_USER_EDUCATION_UTIL_H_
#include <optional>
#include <string>
#include <utility>
#include "ash/ash_export.h"
#include "base/values.h"
#include "components/user_education/common/help_bubble/help_bubble_params.h"
#include "components/user_manager/user_type.h"
#include "ui/base/interaction/element_tracker.h"
#include "ui/base/mojom/ui_base_types.mojom-shared.h"
#include "ui/base/ui_base_types.h"
class AccountId;
class PrefService;
namespace gfx {
struct VectorIcon;
}
namespace ui {
class ElementIdentifier;
}
namespace views {
class View;
}
namespace ash {
enum class HelpBubbleId;
enum class TimeBucket;
enum class TutorialId;
struct UserSession;
namespace user_education_util {
ASH_EXPORT user_education::HelpBubbleParams::ExtendedProperties
CreateExtendedProperties(const gfx::VectorIcon& body_icon);
ASH_EXPORT user_education::HelpBubbleParams::ExtendedProperties
CreateExtendedProperties(HelpBubbleId help_bubble_id);
ASH_EXPORT user_education::HelpBubbleParams::ExtendedProperties
CreateExtendedProperties(ui::mojom::ModalType modal_type);
ASH_EXPORT user_education::HelpBubbleParams::ExtendedProperties
CreateExtendedPropertiesWithAccessibleName(const std::string& accessible_name);
ASH_EXPORT user_education::HelpBubbleParams::ExtendedProperties
CreateExtendedPropertiesWithBodyText(const std::string& body_text);
Creates an extended properties instance by merging `properties`.
Example usage:
const user_education::HelpBubbleParams::ExtendedProperties
extended_properties = CreateExtendedProperties(
CreateExtendedProperties(HelpBubbleId::kTest),
CreateExtendedProperties(ui::mojom::ModalType::kSystem));
*/
template <typename... Properties>
ASH_EXPORT user_education::HelpBubbleParams::ExtendedProperties
CreateExtendedProperties(Properties&&... properties) {
user_education::HelpBubbleParams::ExtendedProperties extended_properties;
base::Value::Dict& values = extended_properties.values();
([&] { values.Merge(std::move(properties.values())); }(), ...);
return extended_properties;
}
ASH_EXPORT const AccountId& GetAccountId(const UserSession* user_session);
ASH_EXPORT std::optional<std::string> GetHelpBubbleAccessibleName(
const user_education::HelpBubbleParams::ExtendedProperties&
extended_properties);
ASH_EXPORT std::optional<std::reference_wrapper<const gfx::VectorIcon>>
GetHelpBubbleBodyIcon(
const user_education::HelpBubbleParams::ExtendedProperties&
extended_properties);
ASH_EXPORT std::optional<std::string> GetHelpBubbleBodyText(
const user_education::HelpBubbleParams::ExtendedProperties&
extended_properties);
ASH_EXPORT HelpBubbleId GetHelpBubbleId(
const user_education::HelpBubbleParams::ExtendedProperties&
extended_properties);
ASH_EXPORT ui::mojom::ModalType GetHelpBubbleModalType(
const user_education::HelpBubbleParams::ExtendedProperties&
extended_properties);
ASH_EXPORT PrefService* GetLastActiveUserPrefService();
ASH_EXPORT views::View* GetMatchingViewInRootWindow(
int64_t display_id,
ui::ElementIdentifier element_id);
ASH_EXPORT TimeBucket GetTimeBucket(base::TimeDelta time_delta);
ASH_EXPORT std::optional<user_manager::UserType> GetUserType(
const AccountId& account_id);
ASH_EXPORT bool IsPrimaryAccountActive();
ASH_EXPORT bool IsPrimaryAccountPrefServiceActive();
ASH_EXPORT bool IsPrimaryAccountId(const AccountId& account_id);
ASH_EXPORT std::string ToString(TutorialId tutorial_id);
}
}
#endif