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/bubble/tooltip_icon.h" | 5 #include "ui/views/bubble/tooltip_icon.h" |
6 | 6 |
7 #include "base/timer/timer.h" | 7 #include "base/timer/timer.h" |
8 #include "ui/accessibility/ax_node_data.h" | 8 #include "ui/accessibility/ax_node_data.h" |
9 #include "ui/gfx/paint_vector_icon.h" | 9 #include "ui/gfx/paint_vector_icon.h" |
10 #include "ui/gfx/vector_icons_public.h" | 10 #include "ui/vector_icons/vector_icons.h" |
11 #include "ui/views/bubble/bubble_frame_view.h" | 11 #include "ui/views/bubble/bubble_frame_view.h" |
12 #include "ui/views/bubble/info_bubble.h" | 12 #include "ui/views/bubble/info_bubble.h" |
13 #include "ui/views/mouse_watcher_view_host.h" | 13 #include "ui/views/mouse_watcher_view_host.h" |
14 | 14 |
15 namespace views { | 15 namespace views { |
16 | 16 |
17 TooltipIcon::TooltipIcon(const base::string16& tooltip) | 17 TooltipIcon::TooltipIcon(const base::string16& tooltip) |
18 : tooltip_(tooltip), | 18 : tooltip_(tooltip), |
19 mouse_inside_(false), | 19 mouse_inside_(false), |
20 bubble_(nullptr), | 20 bubble_(nullptr), |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 if (IsMouseHovered()) { | 61 if (IsMouseHovered()) { |
62 mouse_watcher_->Start(); | 62 mouse_watcher_->Start(); |
63 return; | 63 return; |
64 } | 64 } |
65 | 65 |
66 mouse_inside_ = false; | 66 mouse_inside_ = false; |
67 HideBubble(); | 67 HideBubble(); |
68 } | 68 } |
69 | 69 |
70 void TooltipIcon::SetDrawAsHovered(bool hovered) { | 70 void TooltipIcon::SetDrawAsHovered(bool hovered) { |
71 SetImage(gfx::CreateVectorIcon(gfx::VectorIconId::INFO_OUTLINE, 18, | 71 SetImage(gfx::CreateVectorIcon(ui::kInfoOutlineIcon, 18, |
72 hovered | 72 hovered |
73 ? SkColorSetARGB(0xBD, 0, 0, 0) | 73 ? SkColorSetARGB(0xBD, 0, 0, 0) |
74 : SkColorSetARGB(0xBD, 0x44, 0x44, 0x44))); | 74 : SkColorSetARGB(0xBD, 0x44, 0x44, 0x44))); |
75 } | 75 } |
76 | 76 |
77 void TooltipIcon::ShowBubble() { | 77 void TooltipIcon::ShowBubble() { |
78 if (bubble_) | 78 if (bubble_) |
79 return; | 79 return; |
80 | 80 |
81 SetDrawAsHovered(true); | 81 SetDrawAsHovered(true); |
(...skipping 24 matching lines...) Expand all Loading... |
106 | 106 |
107 void TooltipIcon::OnWidgetDestroyed(Widget* widget) { | 107 void TooltipIcon::OnWidgetDestroyed(Widget* widget) { |
108 observer_.Remove(widget); | 108 observer_.Remove(widget); |
109 | 109 |
110 SetDrawAsHovered(false); | 110 SetDrawAsHovered(false); |
111 mouse_watcher_.reset(); | 111 mouse_watcher_.reset(); |
112 bubble_ = nullptr; | 112 bubble_ = nullptr; |
113 } | 113 } |
114 | 114 |
115 } // namespace views | 115 } // namespace views |
OLD | NEW |