OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_AURA_SHELL_SHELL_TOOLTIP_MANAGER_H_ |
| 6 #define UI_AURA_SHELL_SHELL_TOOLTIP_MANAGER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/string16.h" |
| 11 #include "base/timer.h" |
| 12 #include "ui/aura/client/tooltip_client.h" |
| 13 #include "ui/aura/event_filter.h" |
| 14 #include "ui/aura/window_observer.h" |
| 15 #include "ui/aura_shell/aura_shell_export.h" |
| 16 #include "ui/gfx/point.h" |
| 17 |
| 18 namespace aura { |
| 19 class KeyEvent; |
| 20 class MouseEvent; |
| 21 class TouchEvent; |
| 22 class Window; |
| 23 } |
| 24 |
| 25 namespace aura_shell { |
| 26 |
| 27 // ShellTooltipManager provides tooltip functionality for aura shell. |
| 28 class AURA_SHELL_EXPORT ShellTooltipManager : public aura::TooltipClient, |
| 29 public aura::EventFilter, |
| 30 public aura::WindowObserver { |
| 31 public: |
| 32 ShellTooltipManager(); |
| 33 virtual ~ShellTooltipManager(); |
| 34 |
| 35 // Overridden from aura::TooltipClient. |
| 36 void UpdateTooltip(aura::Window* target); |
| 37 |
| 38 // Overridden from aura::EventFilter. |
| 39 virtual bool PreHandleKeyEvent(aura::Window* target, |
| 40 aura::KeyEvent* event) OVERRIDE; |
| 41 virtual bool PreHandleMouseEvent(aura::Window* target, |
| 42 aura::MouseEvent* event) OVERRIDE; |
| 43 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, |
| 44 aura::TouchEvent* event) OVERRIDE; |
| 45 |
| 46 // Overridden from aura::WindowObserver. |
| 47 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
| 48 |
| 49 private: |
| 50 class Tooltip; |
| 51 |
| 52 void TooltipTimerFired(); |
| 53 |
| 54 // Updates the tooltip if required (if there is any change in the tooltip |
| 55 // text or the aura::Window. |
| 56 void UpdateIfRequired(); |
| 57 |
| 58 aura::Window* tooltip_window_; |
| 59 string16 tooltip_text_; |
| 60 scoped_ptr<Tooltip> tooltip_; |
| 61 |
| 62 base::RepeatingTimer<ShellTooltipManager> tooltip_timer_; |
| 63 |
| 64 gfx::Point curr_mouse_loc_; |
| 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(ShellTooltipManager); |
| 67 }; |
| 68 |
| 69 } // namespace aura_shell |
| 70 |
| 71 #endif // UI_AURA_SHELL_SHELL_TOOLTIP_MANAGER_H_ |
OLD | NEW |