| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_ | 5 #ifndef ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_ |
| 6 #define ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_ | 6 #define ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/shelf/shelf_layout_manager_observer.h" | 9 #include "ash/shelf/shelf_layout_manager_observer.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/strings/string16.h" | |
| 13 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
| 14 #include "ui/aura/window_observer.h" | 13 #include "ui/aura/window_observer.h" |
| 15 #include "ui/events/event_handler.h" | 14 #include "ui/events/event_handler.h" |
| 15 #include "ui/views/pointer_watcher.h" |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 class BubbleDialogDelegateView; | 18 class BubbleDialogDelegateView; |
| 19 class View; | 19 class View; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace ash { | 22 namespace ash { |
| 23 class ShelfLayoutManager; | 23 class ShelfLayoutManager; |
| 24 class ShelfView; | 24 class ShelfView; |
| 25 | 25 |
| 26 namespace test { | 26 namespace test { |
| 27 class ShelfTooltipManagerTest; | 27 class ShelfTooltipManagerTest; |
| 28 class ShelfViewTest; | 28 class ShelfViewTest; |
| 29 } | 29 } |
| 30 | 30 |
| 31 // ShelfTooltipManager manages the tooltip bubble that appears for shelf items. | 31 // ShelfTooltipManager manages the tooltip bubble that appears for shelf items. |
| 32 class ASH_EXPORT ShelfTooltipManager : public ui::EventHandler, | 32 class ASH_EXPORT ShelfTooltipManager : public ui::EventHandler, |
| 33 public aura::WindowObserver, | 33 public aura::WindowObserver, |
| 34 public views::PointerWatcher, |
| 34 public ShelfLayoutManagerObserver { | 35 public ShelfLayoutManagerObserver { |
| 35 public: | 36 public: |
| 36 explicit ShelfTooltipManager(ShelfView* shelf_view); | 37 explicit ShelfTooltipManager(ShelfView* shelf_view); |
| 37 ~ShelfTooltipManager() override; | 38 ~ShelfTooltipManager() override; |
| 38 | 39 |
| 39 // Initializes the tooltip manager once the shelf is shown. | 40 // Initializes the tooltip manager once the shelf is shown. |
| 40 void Init(); | 41 void Init(); |
| 41 | 42 |
| 42 // Closes the tooltip. | 43 // Closes the tooltip. |
| 43 void Close(); | 44 void Close(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 55 // Set the timer delay in ms for testing. | 56 // Set the timer delay in ms for testing. |
| 56 void set_timer_delay_for_test(int timer_delay) { timer_delay_ = timer_delay; } | 57 void set_timer_delay_for_test(int timer_delay) { timer_delay_ = timer_delay; } |
| 57 | 58 |
| 58 protected: | 59 protected: |
| 59 // ui::EventHandler overrides: | 60 // ui::EventHandler overrides: |
| 60 void OnEvent(ui::Event* event) override; | 61 void OnEvent(ui::Event* event) override; |
| 61 | 62 |
| 62 // aura::WindowObserver overrides: | 63 // aura::WindowObserver overrides: |
| 63 void OnWindowDestroying(aura::Window* window) override; | 64 void OnWindowDestroying(aura::Window* window) override; |
| 64 | 65 |
| 66 // views::PointerWatcher overrides: |
| 67 void OnMousePressed(const ui::MouseEvent& event, |
| 68 const gfx::Point& location_in_screen) override; |
| 69 void OnTouchPressed(const ui::TouchEvent& event, |
| 70 const gfx::Point& location_in_screen) override; |
| 71 |
| 65 // ShelfLayoutManagerObserver overrides: | 72 // ShelfLayoutManagerObserver overrides: |
| 66 void WillDeleteShelf() override; | 73 void WillDeleteShelf() override; |
| 67 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; | 74 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; |
| 68 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override; | 75 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override; |
| 69 | 76 |
| 70 private: | 77 private: |
| 71 class ShelfTooltipBubble; | 78 class ShelfTooltipBubble; |
| 72 friend class test::ShelfViewTest; | 79 friend class test::ShelfViewTest; |
| 73 friend class test::ShelfTooltipManagerTest; | 80 friend class test::ShelfTooltipManagerTest; |
| 74 | 81 |
| 75 int timer_delay_; | 82 int timer_delay_; |
| 76 base::OneShotTimer timer_; | 83 base::OneShotTimer timer_; |
| 77 | 84 |
| 78 ShelfView* shelf_view_; | 85 ShelfView* shelf_view_; |
| 79 aura::Window* root_window_; | 86 aura::Window* root_window_; |
| 80 ShelfLayoutManager* shelf_layout_manager_; | 87 ShelfLayoutManager* shelf_layout_manager_; |
| 81 views::BubbleDialogDelegateView* bubble_; | 88 views::BubbleDialogDelegateView* bubble_; |
| 82 | 89 |
| 83 base::WeakPtrFactory<ShelfTooltipManager> weak_factory_; | 90 base::WeakPtrFactory<ShelfTooltipManager> weak_factory_; |
| 84 | 91 |
| 85 DISALLOW_COPY_AND_ASSIGN(ShelfTooltipManager); | 92 DISALLOW_COPY_AND_ASSIGN(ShelfTooltipManager); |
| 86 }; | 93 }; |
| 87 | 94 |
| 88 } // namespace ash | 95 } // namespace ash |
| 89 | 96 |
| 90 #endif // ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_ | 97 #endif // ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_ |
| OLD | NEW |