| OLD | NEW |
| 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> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 int GetMaxWidth(const gfx::Point& location) const; | 62 int GetMaxWidth(const gfx::Point& location) const; |
| 63 | 63 |
| 64 // Returns the bounds to fit the tooltip in. | 64 // Returns the bounds to fit the tooltip in. |
| 65 gfx::Rect GetBoundsForTooltip(const gfx::Point& origin) const; | 65 gfx::Rect GetBoundsForTooltip(const gfx::Point& origin) const; |
| 66 | 66 |
| 67 // Trims the tooltip to fit in the width |max_width|, setting |text| to the | 67 // Trims the tooltip to fit in the width |max_width|, setting |text| to the |
| 68 // clipped result, |width| to the width (in pixels) of the clipped text | 68 // clipped result, |width| to the width (in pixels) of the clipped text |
| 69 // and |line_count| to the number of lines of text in the tooltip. |x| and |y| | 69 // and |line_count| to the number of lines of text in the tooltip. |x| and |y| |
| 70 // give the location of the tooltip in screen coordinates. |max_width| comes | 70 // give the location of the tooltip in screen coordinates. |max_width| comes |
| 71 // from GetMaxWidth(). | 71 // from GetMaxWidth(). |
| 72 static void TrimTooltipToFit(int max_width, | 72 static void TrimTooltipToFit(float max_width, |
| 73 string16* text, | 73 string16* text, |
| 74 int* width, | 74 float* width, |
| 75 int* line_count); | 75 int* line_count); |
| 76 | 76 |
| 77 void TooltipTimerFired(); | 77 void TooltipTimerFired(); |
| 78 void TooltipShownTimerFired(); | 78 void TooltipShownTimerFired(); |
| 79 | 79 |
| 80 // Updates the tooltip if required (if there is any change in the tooltip | 80 // Updates the tooltip if required (if there is any change in the tooltip |
| 81 // text or the aura::Window. | 81 // text or the aura::Window. |
| 82 void UpdateIfRequired(); | 82 void UpdateIfRequired(); |
| 83 | 83 |
| 84 // Only used in tests. | 84 // Only used in tests. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 std::map<aura::Window*, int> tooltip_shown_timeout_map_; | 120 std::map<aura::Window*, int> tooltip_shown_timeout_map_; |
| 121 | 121 |
| 122 DISALLOW_COPY_AND_ASSIGN(TooltipController); | 122 DISALLOW_COPY_AND_ASSIGN(TooltipController); |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 } // namespace corewm | 125 } // namespace corewm |
| 126 } // namespace views | 126 } // namespace views |
| 127 | 127 |
| 128 #endif // UI_VIEWS_COREWM_TOOLTIP_CONTROLLER_H_ | 128 #endif // UI_VIEWS_COREWM_TOOLTIP_CONTROLLER_H_ |
| OLD | NEW |