Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: chrome/browser/ui/views/tabs/side_tab.cc

Issue 8122013: Allow CanvasSkia to bind to an existing SkCanvas. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 1 more fix Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/theme_resources.h" 8 #include "grit/theme_resources.h"
9 #include "grit/theme_resources_standard.h" 9 #include "grit/theme_resources_standard.h"
10 #include "grit/ui_resources.h" 10 #include "grit/ui_resources.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 79
80 void SideTab::OnPaint(gfx::Canvas* canvas) { 80 void SideTab::OnPaint(gfx::Canvas* canvas) {
81 // TODO: should render the active tab differently. 81 // TODO: should render the active tab differently.
82 if (ShouldPaintHighlight()) { 82 if (ShouldPaintHighlight()) {
83 SkPaint paint; 83 SkPaint paint;
84 paint.setColor(kTabBackgroundColor); 84 paint.setColor(kTabBackgroundColor);
85 paint.setAntiAlias(true); 85 paint.setAntiAlias(true);
86 SkRect border_rect = { SkIntToScalar(0), SkIntToScalar(0), 86 SkRect border_rect = { SkIntToScalar(0), SkIntToScalar(0),
87 SkIntToScalar(width()), SkIntToScalar(height()) }; 87 SkIntToScalar(width()), SkIntToScalar(height()) };
88 canvas->AsCanvasSkia()->drawRoundRect(border_rect, 88 canvas->GetSkCanvas()->drawRoundRect(border_rect,
89 SkIntToScalar(kRoundRectRadius), 89 SkIntToScalar(kRoundRectRadius),
90 SkIntToScalar(kRoundRectRadius), 90 SkIntToScalar(kRoundRectRadius),
91 paint); 91 paint);
92 } 92 }
93 93
94 if (ShouldShowIcon()) 94 if (ShouldShowIcon())
95 PaintIcon(canvas); 95 PaintIcon(canvas);
96 96
97 PaintTitle(canvas, kTextColor); 97 PaintTitle(canvas, kTextColor);
98 } 98 }
99 99
100 gfx::Size SideTab::GetPreferredSize() { 100 gfx::Size SideTab::GetPreferredSize() {
101 return gfx::Size(0, GetPreferredHeight()); 101 return gfx::Size(0, GetPreferredHeight());
102 } 102 }
103 103
104 const gfx::Rect& SideTab::GetTitleBounds() const { 104 const gfx::Rect& SideTab::GetTitleBounds() const {
105 return title_bounds_; 105 return title_bounds_;
106 } 106 }
107 107
108 const gfx::Rect& SideTab::GetIconBounds() const { 108 const gfx::Rect& SideTab::GetIconBounds() const {
109 return icon_bounds_; 109 return icon_bounds_;
110 } 110 }
111 111
112 bool SideTab::ShouldPaintHighlight() const { 112 bool SideTab::ShouldPaintHighlight() const {
113 return IsSelected() || !controller(); 113 return IsSelected() || !controller();
114 } 114 }
115 115
116 bool SideTab::ShouldShowIcon() const { 116 bool SideTab::ShouldShowIcon() const {
117 return data().mini || data().show_icon; 117 return data().mini || data().show_icon;
118 } 118 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698