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

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

Issue 6879013: skia::PlatformCanvas is being deprecated. Going forward we will use gfx::Canvas wherever we need ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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/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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/native_view_photobooth_win.cc ('k') | chrome/browser/ui/views/tabs/tab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698