shelf_tooltip_preview_bubble.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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_SHELF_SHELF_TOOLTIP_PREVIEW_BUBBLE_H_
  5. #define ASH_SHELF_SHELF_TOOLTIP_PREVIEW_BUBBLE_H_
  6. #include <vector>
  7. #include "ash/ash_export.h"
  8. #include "ash/public/cpp/shelf_types.h"
  9. #include "ash/shelf/shelf_bubble.h"
  10. #include "ash/shelf/shelf_tooltip_manager.h"
  11. #include "ash/shelf/window_preview.h"
  12. #include "ash/wm/window_mirror_view.h"
  13. #include "base/timer/timer.h"
  14. #include "ui/aura/window.h"
  15. #include "ui/views/controls/label.h"
  16. namespace ash {
  17. // The implementation of tooltip bubbles for the shelf item.
  18. class ASH_EXPORT ShelfTooltipPreviewBubble : public ShelfBubble,
  19. public WindowPreview::Delegate {
  20. public:
  21. ShelfTooltipPreviewBubble(views::View* anchor,
  22. const std::vector<aura::Window*>& windows,
  23. ShelfTooltipManager* manager,
  24. ShelfAlignment alignment);
  25. ShelfTooltipPreviewBubble(const ShelfTooltipPreviewBubble&) = delete;
  26. ShelfTooltipPreviewBubble& operator=(const ShelfTooltipPreviewBubble&) =
  27. delete;
  28. ~ShelfTooltipPreviewBubble() override;
  29. private:
  30. // Removes the given preview from the list of previewed windows.
  31. void RemovePreview(WindowPreview* preview);
  32. // BubbleDialogDelegateView overrides:
  33. void OnMouseExited(const ui::MouseEvent& event) override;
  34. // ShelfBubble:
  35. bool ShouldCloseOnPressDown() override;
  36. bool ShouldCloseOnMouseExit() override;
  37. // WindowPreview::Delegate:
  38. float GetMaxPreviewRatio() const override;
  39. void OnPreviewDismissed(WindowPreview* preview) override;
  40. void OnPreviewActivated(WindowPreview* preview) override;
  41. void DismissAfterDelay();
  42. void Dismiss();
  43. std::vector<WindowPreview*> previews_;
  44. ShelfTooltipManager* manager_;
  45. base::OneShotTimer dismiss_timer_;
  46. };
  47. } // namespace ash
  48. #endif // ASH_SHELF_SHELF_TOOLTIP_PREVIEW_BUBBLE_H_