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/tab_icon_view.cc

Issue 10824296: Enables HiDPI favicon to be displayed in tab strip on CrOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 4 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) 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 "chrome/browser/ui/views/tab_icon_view.h" 5 #include "chrome/browser/ui/views/tab_icon_view.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif 10 #endif
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 93
94 void TabIconView::PaintThrobber(gfx::Canvas* canvas) { 94 void TabIconView::PaintThrobber(gfx::Canvas* canvas) {
95 gfx::ImageSkia throbber(*GetThemeProvider()->GetImageSkiaNamed( 95 gfx::ImageSkia throbber(*GetThemeProvider()->GetImageSkiaNamed(
96 is_light_ ? IDR_THROBBER_LIGHT : IDR_THROBBER)); 96 is_light_ ? IDR_THROBBER_LIGHT : IDR_THROBBER));
97 int image_size = throbber.height(); 97 int image_size = throbber.height();
98 PaintIcon(canvas, throbber, throbber_frame_ * image_size, 0, image_size, 98 PaintIcon(canvas, throbber, throbber_frame_ * image_size, 0, image_size,
99 image_size, false); 99 image_size, false);
100 } 100 }
101 101
102 void TabIconView::PaintFavicon(gfx::Canvas* canvas, const SkBitmap& image) { 102 void TabIconView::PaintFavicon(gfx::Canvas* canvas,
103 const gfx::ImageSkia& image) {
103 PaintIcon(canvas, image, 0, 0, image.width(), image.height(), true); 104 PaintIcon(canvas, image, 0, 0, image.width(), image.height(), true);
104 } 105 }
105 106
106 void TabIconView::PaintIcon(gfx::Canvas* canvas, 107 void TabIconView::PaintIcon(gfx::Canvas* canvas,
107 const gfx::ImageSkia& image, 108 const gfx::ImageSkia& image,
108 int src_x, 109 int src_x,
109 int src_y, 110 int src_y,
110 int src_w, 111 int src_w,
111 int src_h, 112 int src_h,
112 bool filter) { 113 bool filter) {
(...skipping 22 matching lines...) Expand all
135 dest_h, filter); 136 dest_h, filter);
136 } 137 }
137 138
138 void TabIconView::OnPaint(gfx::Canvas* canvas) { 139 void TabIconView::OnPaint(gfx::Canvas* canvas) {
139 bool rendered = false; 140 bool rendered = false;
140 141
141 if (throbber_running_) { 142 if (throbber_running_) {
142 rendered = true; 143 rendered = true;
143 PaintThrobber(canvas); 144 PaintThrobber(canvas);
144 } else { 145 } else {
145 SkBitmap favicon = model_->GetFaviconForTabIconView(); 146 gfx::ImageSkia favicon = model_->GetFaviconForTabIconView();
146 if (!favicon.isNull()) { 147 if (!favicon.isNull()) {
147 rendered = true; 148 rendered = true;
148 PaintFavicon(canvas, favicon); 149 PaintFavicon(canvas, favicon);
149 } 150 }
150 } 151 }
151 152
152 if (!rendered) 153 if (!rendered)
153 PaintFavicon(canvas, *g_default_favicon); 154 PaintFavicon(canvas, *g_default_favicon);
154 } 155 }
155 156
156 gfx::Size TabIconView::GetPreferredSize() { 157 gfx::Size TabIconView::GetPreferredSize() {
157 return gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize); 158 return gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize);
158 } 159 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tab_icon_view.h ('k') | chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698