Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: views/widget/tooltip_manager_views.h

Issue 8417025: aura: Update how the tooltip manager works. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/widget/native_widget_views.cc ('k') | views/widget/tooltip_manager_views.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/timer.h" 10 #include "base/timer.h"
11 #include "views/controls/label.h" 11 #include "views/controls/label.h"
12 #include "views/widget/native_widget.h" 12 #include "views/widget/native_widget.h"
13 #include "views/widget/tooltip_manager.h" 13 #include "views/widget/tooltip_manager.h"
14 #include "views/widget/widget_delegate.h" 14 #include "views/widget/widget_delegate.h"
15 #include "views/view.h" 15 #include "views/view.h"
16 16
17 #if defined(USE_X11) 17 #if defined(USE_X11)
18 typedef union _XEvent XEvent; 18 typedef union _XEvent XEvent;
19 namespace ui { 19 namespace ui {
20 union WaylandEvent; 20 union WaylandEvent;
21 } 21 }
22 #endif 22 #endif
23 23
24 namespace views { 24 namespace views {
25 25
26 class MouseEvent;
26 class Widget; 27 class Widget;
27 28
28 // TooltipManager implementation for Views. 29 // TooltipManager implementation for Views.
29 class TooltipManagerViews : public TooltipManager, 30 class TooltipManagerViews : public TooltipManager {
30 public MessageLoopForUI::Observer {
31 public: 31 public:
32 explicit TooltipManagerViews(views::View* root_view); 32 explicit TooltipManagerViews(views::View* root_view);
33 virtual ~TooltipManagerViews(); 33 virtual ~TooltipManagerViews();
34 34
35 // Updates the state of the tooltip based on the mouse event. The mouse event
36 // is the same event that goes to a Widget (i.e. it is in the Widget's
37 // coordinate system).
38 void UpdateForMouseEvent(const MouseEvent& event);
39
35 // TooltipManager. 40 // TooltipManager.
36 virtual void UpdateTooltip() OVERRIDE; 41 virtual void UpdateTooltip() OVERRIDE;
37 virtual void TooltipTextChanged(View* view) OVERRIDE; 42 virtual void TooltipTextChanged(View* view) OVERRIDE;
38 virtual void ShowKeyboardTooltip(View* view) OVERRIDE; 43 virtual void ShowKeyboardTooltip(View* view) OVERRIDE;
39 virtual void HideKeyboardTooltip() OVERRIDE; 44 virtual void HideKeyboardTooltip() OVERRIDE;
40 45
41 #if defined(USE_WAYLAND)
42 virtual base::MessagePumpObserver::EventStatus WillProcessEvent(
43 ui::WaylandEvent* event) OVERRIDE;
44 #else
45 // MessageLoopForUI::Observer
46 virtual base::EventStatus WillProcessEvent(
47 const base::NativeEvent& event) OVERRIDE;
48 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE;
49 #endif
50
51 private: 46 private:
52 void TooltipTimerFired(); 47 void TooltipTimerFired();
53 View* GetViewForTooltip(int x, int y, bool for_keyboard); 48 View* GetViewForTooltip(int x, int y, bool for_keyboard);
54 49
55 // Updates the tooltip if required (if there is any change in the tooltip 50 // Updates the tooltip if required (if there is any change in the tooltip
56 // text or the view. 51 // text or the view.
57 void UpdateIfRequired(int x, int y, bool for_keyboard); 52 void UpdateIfRequired(int x, int y, bool for_keyboard);
58 53
59 // Updates the tooltip. Gets the tooltip text from tooltip_view_ and displays 54 // Updates the tooltip. Gets the tooltip text from tooltip_view_ and displays
60 // it at the current mouse position. 55 // it at the current mouse position.
(...skipping 18 matching lines...) Expand all
79 74
80 gfx::Point curr_mouse_pos_; 75 gfx::Point curr_mouse_pos_;
81 base::RepeatingTimer<TooltipManagerViews> tooltip_timer_; 76 base::RepeatingTimer<TooltipManagerViews> tooltip_timer_;
82 77
83 DISALLOW_COPY_AND_ASSIGN(TooltipManagerViews); 78 DISALLOW_COPY_AND_ASSIGN(TooltipManagerViews);
84 }; 79 };
85 80
86 } // namespace views 81 } // namespace views
87 82
88 #endif // VIEWS_WIDGET_TOOLTIP_MANAGER_VIEWS_H_ 83 #endif // VIEWS_WIDGET_TOOLTIP_MANAGER_VIEWS_H_
OLDNEW
« no previous file with comments | « views/widget/native_widget_views.cc ('k') | views/widget/tooltip_manager_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698