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 #include "ui/views/controls/link.h" | 5 #include "ui/views/controls/link.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "ui/base/accessibility/accessible_view_state.h" | 11 #include "ui/base/accessibility/accessible_view_state.h" |
12 #include "ui/events/event.h" | 12 #include "ui/events/event.h" |
13 #include "ui/events/keycodes/keyboard_codes.h" | 13 #include "ui/events/keycodes/keyboard_codes.h" |
14 #include "ui/gfx/canvas.h" | 14 #include "ui/gfx/canvas.h" |
15 #include "ui/gfx/color_utils.h" | 15 #include "ui/gfx/color_utils.h" |
16 #include "ui/gfx/font.h" | 16 #include "ui/gfx/font.h" |
17 #include "ui/views/controls/link_listener.h" | 17 #include "ui/views/controls/link_listener.h" |
18 | 18 |
19 #if defined(USE_AURA) | 19 #if defined(USE_AURA) |
20 #include "ui/base/cursor/cursor.h" | 20 #include "ui/base/cursor/cursor.h" |
21 #endif | 21 #endif |
22 | 22 |
23 namespace views { | 23 namespace views { |
24 | 24 |
25 const char Link::kViewClassName[] = "Link"; | 25 const char Link::kViewClassName[] = "Link"; |
26 | 26 |
27 Link::Link() : Label(string16()) { | 27 Link::Link() : Label(base::string16()) { |
28 Init(); | 28 Init(); |
29 } | 29 } |
30 | 30 |
31 Link::Link(const string16& title) : Label(title) { | 31 Link::Link(const base::string16& title) : Label(title) { |
32 Init(); | 32 Init(); |
33 } | 33 } |
34 | 34 |
35 Link::~Link() { | 35 Link::~Link() { |
36 } | 36 } |
37 | 37 |
38 SkColor Link::GetDefaultEnabledColor() { | 38 SkColor Link::GetDefaultEnabledColor() { |
39 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
40 return color_utils::GetSysSkColor(COLOR_HOTLIGHT); | 40 return color_utils::GetSysSkColor(COLOR_HOTLIGHT); |
41 #else | 41 #else |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 void Link::RecalculateFont() { | 221 void Link::RecalculateFont() { |
222 // Underline the link iff it is enabled and |underline_| is true. | 222 // Underline the link iff it is enabled and |underline_| is true. |
223 const int style = font().GetStyle(); | 223 const int style = font().GetStyle(); |
224 const int intended_style = (enabled() && underline_) ? | 224 const int intended_style = (enabled() && underline_) ? |
225 (style | gfx::Font::UNDERLINE) : (style & ~gfx::Font::UNDERLINE); | 225 (style | gfx::Font::UNDERLINE) : (style & ~gfx::Font::UNDERLINE); |
226 if (style != intended_style) | 226 if (style != intended_style) |
227 Label::SetFont(font().DeriveFont(0, intended_style)); | 227 Label::SetFont(font().DeriveFont(0, intended_style)); |
228 } | 228 } |
229 | 229 |
230 } // namespace views | 230 } // namespace views |
OLD | NEW |