| 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 ASH_TOOLTIPS_TOOLTIP_CONTROLLER_H_ | 5 #ifndef ASH_TOOLTIPS_TOOLTIP_CONTROLLER_H_ |
| 6 #define ASH_TOOLTIPS_TOOLTIP_CONTROLLER_H_ | 6 #define ASH_TOOLTIPS_TOOLTIP_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "base/timer.h" | 11 #include "base/timer.h" |
| 12 #include "ui/aura/client/tooltip_client.h" | 12 #include "ui/aura/client/tooltip_client.h" |
| 13 #include "ui/aura/event_filter.h" | 13 #include "ui/aura/event_filter.h" |
| 14 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
| 15 #include "ash/ash_export.h" | 15 #include "ash/ash_export.h" |
| 16 #include "ui/gfx/point.h" | 16 #include "ui/gfx/point.h" |
| 17 | 17 |
| 18 namespace aura { | 18 namespace aura { |
| 19 class KeyEvent; | 19 class KeyEvent; |
| 20 class MouseEvent; | 20 class MouseEvent; |
| 21 class TouchEvent; | 21 class TouchEvent; |
| 22 class Window; | 22 class Window; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace aura_shell { | 25 namespace ash { |
| 26 | 26 |
| 27 namespace test { | 27 namespace test { |
| 28 class TooltipControllerTest; | 28 class TooltipControllerTest; |
| 29 } // namespace test | 29 } // namespace test |
| 30 | 30 |
| 31 namespace internal { | 31 namespace internal { |
| 32 | 32 |
| 33 // TooltipController provides tooltip functionality for aura shell. | 33 // TooltipController provides tooltip functionality for aura shell. |
| 34 class ASH_EXPORT TooltipController : public aura::client::TooltipClient, | 34 class ASH_EXPORT TooltipController : public aura::client::TooltipClient, |
| 35 public aura::EventFilter, | 35 public aura::EventFilter, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 46 aura::KeyEvent* event) OVERRIDE; | 46 aura::KeyEvent* event) OVERRIDE; |
| 47 virtual bool PreHandleMouseEvent(aura::Window* target, | 47 virtual bool PreHandleMouseEvent(aura::Window* target, |
| 48 aura::MouseEvent* event) OVERRIDE; | 48 aura::MouseEvent* event) OVERRIDE; |
| 49 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, | 49 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, |
| 50 aura::TouchEvent* event) OVERRIDE; | 50 aura::TouchEvent* event) OVERRIDE; |
| 51 | 51 |
| 52 // Overridden from aura::WindowObserver. | 52 // Overridden from aura::WindowObserver. |
| 53 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; | 53 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 friend class aura_shell::test::TooltipControllerTest; | 56 friend class ash::test::TooltipControllerTest; |
| 57 | 57 |
| 58 class Tooltip; | 58 class Tooltip; |
| 59 | 59 |
| 60 void TooltipTimerFired(); | 60 void TooltipTimerFired(); |
| 61 | 61 |
| 62 // Updates the tooltip if required (if there is any change in the tooltip | 62 // Updates the tooltip if required (if there is any change in the tooltip |
| 63 // text or the aura::Window. | 63 // text or the aura::Window. |
| 64 void UpdateIfRequired(); | 64 void UpdateIfRequired(); |
| 65 | 65 |
| 66 aura::Window* tooltip_window_; | 66 aura::Window* tooltip_window_; |
| 67 string16 tooltip_text_; | 67 string16 tooltip_text_; |
| 68 scoped_ptr<Tooltip> tooltip_; | 68 scoped_ptr<Tooltip> tooltip_; |
| 69 | 69 |
| 70 base::RepeatingTimer<TooltipController> tooltip_timer_; | 70 base::RepeatingTimer<TooltipController> tooltip_timer_; |
| 71 | 71 |
| 72 gfx::Point curr_mouse_loc_; | 72 gfx::Point curr_mouse_loc_; |
| 73 | 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(TooltipController); | 74 DISALLOW_COPY_AND_ASSIGN(TooltipController); |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 } // namespace internal | 77 } // namespace internal |
| 78 } // namespace aura_shell | 78 } // namespace ash |
| 79 | 79 |
| 80 #endif // ASH_TOOLTIPS_TOOLTIP_CONTROLLER_H_ | 80 #endif // ASH_TOOLTIPS_TOOLTIP_CONTROLLER_H_ |
| OLD | NEW |