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

Side by Side Diff: ui/views/corewm/tooltip_controller.h

Issue 15754002: ash: Add functionality to specify how long a tooltip is shown for a window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months 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 | « ui/aura/client/tooltip_client.h ('k') | ui/views/corewm/tooltip_controller.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 UI_VIEWS_COREWM_TOOLTIP_CONTROLLER_H_ 5 #ifndef UI_VIEWS_COREWM_TOOLTIP_CONTROLLER_H_
6 #define UI_VIEWS_COREWM_TOOLTIP_CONTROLLER_H_ 6 #define UI_VIEWS_COREWM_TOOLTIP_CONTROLLER_H_
7 7
8 #include <map>
9
8 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
9 #include "base/string16.h" 11 #include "base/string16.h"
10 #include "base/timer.h" 12 #include "base/timer.h"
11 #include "ui/aura/client/tooltip_client.h" 13 #include "ui/aura/client/tooltip_client.h"
12 #include "ui/aura/window_observer.h" 14 #include "ui/aura/window_observer.h"
13 #include "ui/base/events/event_handler.h" 15 #include "ui/base/events/event_handler.h"
14 #include "ui/gfx/point.h" 16 #include "ui/gfx/point.h"
15 #include "ui/gfx/screen_type_delegate.h" 17 #include "ui/gfx/screen_type_delegate.h"
16 #include "ui/views/views_export.h" 18 #include "ui/views/views_export.h"
17 19
(...skipping 11 matching lines...) Expand all
29 // TooltipController provides tooltip functionality for aura shell. 31 // TooltipController provides tooltip functionality for aura shell.
30 class VIEWS_EXPORT TooltipController : public aura::client::TooltipClient, 32 class VIEWS_EXPORT TooltipController : public aura::client::TooltipClient,
31 public ui::EventHandler, 33 public ui::EventHandler,
32 public aura::WindowObserver { 34 public aura::WindowObserver {
33 public: 35 public:
34 explicit TooltipController(gfx::ScreenType screen_type); 36 explicit TooltipController(gfx::ScreenType screen_type);
35 virtual ~TooltipController(); 37 virtual ~TooltipController();
36 38
37 // Overridden from aura::client::TooltipClient. 39 // Overridden from aura::client::TooltipClient.
38 virtual void UpdateTooltip(aura::Window* target) OVERRIDE; 40 virtual void UpdateTooltip(aura::Window* target) OVERRIDE;
41 virtual void SetTooltipShownTimeout(aura::Window* target,
42 int timeout_in_ms) OVERRIDE;
39 virtual void SetTooltipsEnabled(bool enable) OVERRIDE; 43 virtual void SetTooltipsEnabled(bool enable) OVERRIDE;
40 44
41 // Overridden from ui::EventHandler. 45 // Overridden from ui::EventHandler.
42 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; 46 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
43 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; 47 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
44 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; 48 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
45 virtual void OnCancelMode(ui::CancelModeEvent* event) OVERRIDE; 49 virtual void OnCancelMode(ui::CancelModeEvent* event) OVERRIDE;
46 50
47 // Overridden from aura::WindowObserver. 51 // Overridden from aura::WindowObserver.
48 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; 52 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 86
83 bool IsDragDropInProgress(); 87 bool IsDragDropInProgress();
84 88
85 // This lazily creates the Tooltip instance so that the tooltip window will 89 // This lazily creates the Tooltip instance so that the tooltip window will
86 // be initialized with appropriate drop shadows. 90 // be initialized with appropriate drop shadows.
87 Tooltip* GetTooltip(); 91 Tooltip* GetTooltip();
88 92
89 // Returns true if the cursor is visible. 93 // Returns true if the cursor is visible.
90 bool IsCursorVisible(); 94 bool IsCursorVisible();
91 95
96 int GetTooltipShownTimeout();
97
92 const gfx::ScreenType screen_type_; 98 const gfx::ScreenType screen_type_;
93 99
94 aura::Window* tooltip_window_; 100 aura::Window* tooltip_window_;
95 string16 tooltip_text_; 101 string16 tooltip_text_;
96 102
97 // These fields are for tracking state when the user presses a mouse button. 103 // These fields are for tracking state when the user presses a mouse button.
98 aura::Window* tooltip_window_at_mouse_press_; 104 aura::Window* tooltip_window_at_mouse_press_;
99 string16 tooltip_text_at_mouse_press_; 105 string16 tooltip_text_at_mouse_press_;
100 bool mouse_pressed_; 106 bool mouse_pressed_;
101 107
102 scoped_ptr<Tooltip> tooltip_; 108 scoped_ptr<Tooltip> tooltip_;
103 109
104 base::RepeatingTimer<TooltipController> tooltip_timer_; 110 base::RepeatingTimer<TooltipController> tooltip_timer_;
105 111
106 // Timer to timeout the life of an on-screen tooltip. We hide the tooltip when 112 // Timer to timeout the life of an on-screen tooltip. We hide the tooltip when
107 // this timer fires. 113 // this timer fires.
108 base::OneShotTimer<TooltipController> tooltip_shown_timer_; 114 base::OneShotTimer<TooltipController> tooltip_shown_timer_;
109 115
110 gfx::Point curr_mouse_loc_; 116 gfx::Point curr_mouse_loc_;
111 117
112 bool tooltips_enabled_; 118 bool tooltips_enabled_;
113 119
120 std::map<aura::Window*, int> tooltip_shown_timeout_map_;
121
114 DISALLOW_COPY_AND_ASSIGN(TooltipController); 122 DISALLOW_COPY_AND_ASSIGN(TooltipController);
115 }; 123 };
116 124
117 } // namespace corewm 125 } // namespace corewm
118 } // namespace views 126 } // namespace views
119 127
120 #endif // UI_VIEWS_COREWM_TOOLTIP_CONTROLLER_H_ 128 #endif // UI_VIEWS_COREWM_TOOLTIP_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ui/aura/client/tooltip_client.h ('k') | ui/views/corewm/tooltip_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698