| 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 "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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |