OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 VIEWS_WIDGET_TOOLTIP_MANAGER_VIEWS_H_ | 5 #ifndef VIEWS_WIDGET_TOOLTIP_MANAGER_VIEWS_H_ |
6 #define VIEWS_WIDGET_TOOLTIP_MANAGER_VIEWS_H_ | 6 #define VIEWS_WIDGET_TOOLTIP_MANAGER_VIEWS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/message_pump_x.h" | |
11 #include "base/timer.h" | 10 #include "base/timer.h" |
12 #include "views/controls/label.h" | 11 #include "views/controls/label.h" |
13 #include "views/widget/native_widget.h" | 12 #include "views/widget/native_widget.h" |
14 #include "views/widget/tooltip_manager.h" | 13 #include "views/widget/tooltip_manager.h" |
15 #include "views/widget/widget_delegate.h" | 14 #include "views/widget/widget_delegate.h" |
16 #include "views/view.h" | 15 #include "views/view.h" |
17 | 16 |
18 typedef union _GdkEvent GdkEvent; | 17 typedef union _GdkEvent GdkEvent; |
19 typedef union _XEvent XEvent; | 18 typedef union _XEvent XEvent; |
| 19 namespace ui { |
| 20 union WaylandEvent; |
| 21 } |
20 | 22 |
21 namespace views { | 23 namespace views { |
22 | 24 |
23 namespace internal { | 25 namespace internal { |
24 class RootView; | 26 class RootView; |
25 } | 27 } |
26 | 28 |
27 class Widget; | 29 class Widget; |
28 | 30 |
29 // TooltipManager implementation for Views. | 31 // TooltipManager implementation for Views. |
30 class TooltipManagerViews : public TooltipManager, | 32 class TooltipManagerViews : public TooltipManager, |
31 public MessageLoopForUI::Observer { | 33 public MessageLoopForUI::Observer { |
32 public: | 34 public: |
33 explicit TooltipManagerViews(internal::RootView* root_view); | 35 explicit TooltipManagerViews(internal::RootView* root_view); |
34 virtual ~TooltipManagerViews(); | 36 virtual ~TooltipManagerViews(); |
35 | 37 |
36 // TooltipManager. | 38 // TooltipManager. |
37 virtual void UpdateTooltip() OVERRIDE; | 39 virtual void UpdateTooltip() OVERRIDE; |
38 virtual void TooltipTextChanged(View* view) OVERRIDE; | 40 virtual void TooltipTextChanged(View* view) OVERRIDE; |
39 virtual void ShowKeyboardTooltip(View* view) OVERRIDE; | 41 virtual void ShowKeyboardTooltip(View* view) OVERRIDE; |
40 virtual void HideKeyboardTooltip() OVERRIDE; | 42 virtual void HideKeyboardTooltip() OVERRIDE; |
41 | 43 |
| 44 #if defined(USE_WAYLAND) |
| 45 virtual base::MessagePumpObserver::EventStatus WillProcessEvent( |
| 46 ui::WaylandEvent* event) OVERRIDE; |
| 47 #else |
42 // MessageLoopForUI::Observer | 48 // MessageLoopForUI::Observer |
43 virtual base::MessagePumpObserver::EventStatus WillProcessXEvent( | 49 virtual base::MessagePumpObserver::EventStatus WillProcessXEvent( |
44 XEvent* xevent) OVERRIDE; | 50 XEvent* xevent) OVERRIDE; |
| 51 #endif |
45 | 52 |
46 private: | 53 private: |
47 void TooltipTimerFired(); | 54 void TooltipTimerFired(); |
48 View* GetViewForTooltip(int x, int y, bool for_keyboard); | 55 View* GetViewForTooltip(int x, int y, bool for_keyboard); |
49 | 56 |
50 // Updates the tooltip if required (if there is any change in the tooltip | 57 // Updates the tooltip if required (if there is any change in the tooltip |
51 // text or the view. | 58 // text or the view. |
52 void UpdateIfRequired(int x, int y, bool for_keyboard); | 59 void UpdateIfRequired(int x, int y, bool for_keyboard); |
53 | 60 |
54 // Updates the tooltip. Gets the tooltip text from tooltip_view_ and displays | 61 // Updates the tooltip. Gets the tooltip text from tooltip_view_ and displays |
(...skipping 16 matching lines...) Expand all Loading... |
71 | 78 |
72 gfx::Point curr_mouse_pos_; | 79 gfx::Point curr_mouse_pos_; |
73 base::RepeatingTimer<TooltipManagerViews> tooltip_timer_; | 80 base::RepeatingTimer<TooltipManagerViews> tooltip_timer_; |
74 | 81 |
75 DISALLOW_COPY_AND_ASSIGN(TooltipManagerViews); | 82 DISALLOW_COPY_AND_ASSIGN(TooltipManagerViews); |
76 }; | 83 }; |
77 | 84 |
78 } // namespace views | 85 } // namespace views |
79 | 86 |
80 #endif // VIEWS_WIDGET_TOOLTIP_MANAGER_VIEWS_H_ | 87 #endif // VIEWS_WIDGET_TOOLTIP_MANAGER_VIEWS_H_ |
OLD | NEW |