assistant_ui_model_observer.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_ASSISTANT_MODEL_ASSISTANT_UI_MODEL_OBSERVER_H_
  5. #define ASH_ASSISTANT_MODEL_ASSISTANT_UI_MODEL_OBSERVER_H_
  6. #include "base/component_export.h"
  7. #include "base/observer_list_types.h"
  8. #include "third_party/abseil-cpp/absl/types/optional.h"
  9. #include "ui/gfx/geometry/rect.h"
  10. namespace ash {
  11. namespace assistant {
  12. enum class AssistantEntryPoint;
  13. enum class AssistantExitPoint;
  14. } // namespace assistant
  15. enum class AssistantVisibility;
  16. // A checked observer which receives notification of changes to the Assistant UI
  17. // model.
  18. class COMPONENT_EXPORT(ASSISTANT_MODEL) AssistantUiModelObserver
  19. : public base::CheckedObserver {
  20. public:
  21. using AssistantEntryPoint = assistant::AssistantEntryPoint;
  22. using AssistantExitPoint = assistant::AssistantExitPoint;
  23. AssistantUiModelObserver(const AssistantUiModelObserver&) = delete;
  24. AssistantUiModelObserver& operator=(const AssistantUiModelObserver&) = delete;
  25. // Invoked when keyboard traversal mode is changed (enabled/disabled).
  26. virtual void OnKeyboardTraversalModeChanged(bool keyboard_traversal_mode) {}
  27. // Invoked when the UI visibility is changed from |old_visibility| to
  28. // |new_visibility|. The |source| of the visibility change event is provided
  29. // for interested observers.
  30. virtual void OnUiVisibilityChanged(
  31. AssistantVisibility new_visibility,
  32. AssistantVisibility old_visibility,
  33. absl::optional<AssistantEntryPoint> entry_point,
  34. absl::optional<AssistantExitPoint> exit_point) {}
  35. // Invoked when the usable display work area is changed. Observers should
  36. // respond to this event by ensuring they are sized/positioned within the
  37. // |usable_work_area|.
  38. virtual void OnUsableWorkAreaChanged(const gfx::Rect& usable_work_area) {}
  39. protected:
  40. AssistantUiModelObserver() = default;
  41. ~AssistantUiModelObserver() override = default;
  42. };
  43. } // namespace ash
  44. #endif // ASH_ASSISTANT_MODEL_ASSISTANT_UI_MODEL_OBSERVER_H_