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 #include "chrome/browser/ui/views/tabs/side_tab.h" | 5 #include "chrome/browser/ui/views/tabs/side_tab.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "grit/app_resources.h" | 8 #include "grit/app_resources.h" |
9 #include "grit/theme_resources.h" | 9 #include "grit/theme_resources.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 void SideTab::OnPaint(gfx::Canvas* canvas) { | 78 void SideTab::OnPaint(gfx::Canvas* canvas) { |
79 // TODO: should render the active tab differently. | 79 // TODO: should render the active tab differently. |
80 if (ShouldPaintHighlight()) { | 80 if (ShouldPaintHighlight()) { |
81 SkPaint paint; | 81 SkPaint paint; |
82 paint.setColor(kTabBackgroundColor); | 82 paint.setColor(kTabBackgroundColor); |
83 paint.setAntiAlias(true); | 83 paint.setAntiAlias(true); |
84 SkRect border_rect = { SkIntToScalar(0), SkIntToScalar(0), | 84 SkRect border_rect = { SkIntToScalar(0), SkIntToScalar(0), |
85 SkIntToScalar(width()), SkIntToScalar(height()) }; | 85 SkIntToScalar(width()), SkIntToScalar(height()) }; |
86 canvas->AsCanvasSkia()->drawRoundRect(border_rect, | 86 canvas->AsCanvasSkia()->skia_canvas()->drawRoundRect( |
87 SkIntToScalar(kRoundRectRadius), | 87 border_rect, |
88 SkIntToScalar(kRoundRectRadius), | 88 SkIntToScalar(kRoundRectRadius), |
89 paint); | 89 SkIntToScalar(kRoundRectRadius), |
| 90 paint); |
90 } | 91 } |
91 | 92 |
92 if (ShouldShowIcon()) | 93 if (ShouldShowIcon()) |
93 PaintIcon(canvas); | 94 PaintIcon(canvas); |
94 | 95 |
95 PaintTitle(canvas, kTextColor); | 96 PaintTitle(canvas, kTextColor); |
96 } | 97 } |
97 | 98 |
98 gfx::Size SideTab::GetPreferredSize() { | 99 gfx::Size SideTab::GetPreferredSize() { |
99 return gfx::Size(0, GetPreferredHeight()); | 100 return gfx::Size(0, GetPreferredHeight()); |
100 } | 101 } |
101 | 102 |
102 const gfx::Rect& SideTab::GetTitleBounds() const { | 103 const gfx::Rect& SideTab::GetTitleBounds() const { |
103 return title_bounds_; | 104 return title_bounds_; |
104 } | 105 } |
105 | 106 |
106 const gfx::Rect& SideTab::GetIconBounds() const { | 107 const gfx::Rect& SideTab::GetIconBounds() const { |
107 return icon_bounds_; | 108 return icon_bounds_; |
108 } | 109 } |
109 | 110 |
110 bool SideTab::ShouldPaintHighlight() const { | 111 bool SideTab::ShouldPaintHighlight() const { |
111 return IsSelected() || !controller(); | 112 return IsSelected() || !controller(); |
112 } | 113 } |
113 | 114 |
114 bool SideTab::ShouldShowIcon() const { | 115 bool SideTab::ShouldShowIcon() const { |
115 return data().mini || data().show_icon; | 116 return data().mini || data().show_icon; |
116 } | 117 } |
OLD | NEW |