OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "ui/views/corewm/tooltip_aura.h" | 5 #include "ui/views/corewm/tooltip_aura.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
9 #include "ui/aura/root_window.h" | 9 #include "ui/aura/root_window.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // Max visual tooltip width. If a tooltip is greater than this width, it will | 23 // Max visual tooltip width. If a tooltip is greater than this width, it will |
24 // be wrapped. | 24 // be wrapped. |
25 const int kTooltipMaxWidthPixels = 400; | 25 const int kTooltipMaxWidthPixels = 400; |
26 | 26 |
27 const size_t kMaxLines = 10; | 27 const size_t kMaxLines = 10; |
28 | 28 |
29 // TODO(derat): This padding is needed on Chrome OS devices but seems excessive | 29 // TODO(derat): This padding is needed on Chrome OS devices but seems excessive |
30 // when running the same binary on a Linux workstation; presumably there's a | 30 // when running the same binary on a Linux workstation; presumably there's a |
31 // difference in font metrics. Rationalize this. | 31 // difference in font metrics. Rationalize this. |
32 const int kTooltipVerticalPadding = 2; | 32 const int kTooltipVerticalPadding = 2; |
33 const int kTooltipTimeoutMs = 500; | |
34 | 33 |
35 // FIXME: get cursor offset from actual cursor size. | 34 // FIXME: get cursor offset from actual cursor size. |
36 const int kCursorOffsetX = 10; | 35 const int kCursorOffsetX = 10; |
37 const int kCursorOffsetY = 15; | 36 const int kCursorOffsetY = 15; |
38 | 37 |
39 // Creates a widget of type TYPE_TOOLTIP | 38 // Creates a widget of type TYPE_TOOLTIP |
40 views::Widget* CreateTooltipWidget(aura::Window* tooltip_window) { | 39 views::Widget* CreateTooltipWidget(aura::Window* tooltip_window) { |
41 views::Widget* widget = new views::Widget; | 40 views::Widget* widget = new views::Widget; |
42 views::Widget::InitParams params; | 41 views::Widget::InitParams params; |
43 // For aura, since we set the type to TYPE_TOOLTIP, the widget will get | 42 // For aura, since we set the type to TYPE_TOOLTIP, the widget will get |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 268 } |
270 | 269 |
271 void TooltipAura::OnWidgetDestroying(views::Widget* widget) { | 270 void TooltipAura::OnWidgetDestroying(views::Widget* widget) { |
272 DCHECK_EQ(widget_, widget); | 271 DCHECK_EQ(widget_, widget); |
273 widget_ = NULL; | 272 widget_ = NULL; |
274 tooltip_window_ = NULL; | 273 tooltip_window_ = NULL; |
275 } | 274 } |
276 | 275 |
277 } // namespace corewm | 276 } // namespace corewm |
278 } // namespace views | 277 } // namespace views |
OLD | NEW |