queued_container_type.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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_KEYBOARD_UI_QUEUED_CONTAINER_TYPE_H_
  5. #define ASH_KEYBOARD_UI_QUEUED_CONTAINER_TYPE_H_
  6. #include "ash/public/cpp/keyboard/keyboard_types.h"
  7. #include "base/callback.h"
  8. #include "ui/gfx/geometry/rect.h"
  9. namespace keyboard {
  10. class KeyboardUIController;
  11. // Tracks a queued ContainerType change request. Couples a container type with a
  12. // callback to invoke once the necessary animation and container changes are
  13. // complete.
  14. // The callback will be invoked once this object goes out of scope. Success
  15. // is defined as the KeyboardUIController's current container behavior matching
  16. // the same container type as the queued container type.
  17. class QueuedContainerType {
  18. public:
  19. QueuedContainerType(KeyboardUIController* controller,
  20. ContainerType container_type,
  21. gfx::Rect bounds,
  22. base::OnceCallback<void(bool success)> callback);
  23. ~QueuedContainerType();
  24. ContainerType container_type() { return container_type_; }
  25. gfx::Rect target_bounds() { return bounds_; }
  26. private:
  27. KeyboardUIController* controller_;
  28. ContainerType container_type_;
  29. gfx::Rect bounds_;
  30. base::OnceCallback<void(bool success)> callback_;
  31. };
  32. } // namespace keyboard
  33. #endif // ASH_KEYBOARD_UI_QUEUED_CONTAINER_TYPE_H_