| 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/tabs/tab.h" | 5 #include "chrome/browser/ui/views/tabs/tab.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 const gfx::Rect& bounds, | 275 const gfx::Rect& bounds, |
| 276 bool filter, | 276 bool filter, |
| 277 const SkPaint& paint) { | 277 const SkPaint& paint) { |
| 278 // Center the image within bounds. | 278 // Center the image within bounds. |
| 279 int dst_x = bounds.x() - (icon_width - bounds.width()) / 2; | 279 int dst_x = bounds.x() - (icon_width - bounds.width()) / 2; |
| 280 int dst_y = bounds.y() - (icon_height - bounds.height()) / 2; | 280 int dst_y = bounds.y() - (icon_height - bounds.height()) / 2; |
| 281 DrawIconAtLocation(canvas, image, image_offset, dst_x, dst_y, icon_width, | 281 DrawIconAtLocation(canvas, image, image_offset, dst_x, dst_y, icon_width, |
| 282 icon_height, filter, paint); | 282 icon_height, filter, paint); |
| 283 } | 283 } |
| 284 | 284 |
| 285 // Draws the icon image at the bottom right corner of |bounds|. | |
| 286 void DrawIconBottomRight(gfx::Canvas* canvas, | |
| 287 const gfx::ImageSkia& image, | |
| 288 int image_offset, | |
| 289 int icon_width, | |
| 290 int icon_height, | |
| 291 const gfx::Rect& bounds, | |
| 292 bool filter, | |
| 293 const SkPaint& paint) { | |
| 294 int dst_x = bounds.x() + bounds.width() - icon_width; | |
| 295 int dst_y = bounds.y() + bounds.height() - icon_height; | |
| 296 DrawIconAtLocation(canvas, image, image_offset, dst_x, dst_y, icon_width, | |
| 297 icon_height, filter, paint); | |
| 298 } | |
| 299 | |
| 300 chrome::HostDesktopType GetHostDesktopType(views::View* view) { | 285 chrome::HostDesktopType GetHostDesktopType(views::View* view) { |
| 301 // Widget is NULL when tabs are detached. | 286 // Widget is NULL when tabs are detached. |
| 302 views::Widget* widget = view->GetWidget(); | 287 views::Widget* widget = view->GetWidget(); |
| 303 return chrome::GetHostDesktopTypeForNativeView( | 288 return chrome::GetHostDesktopTypeForNativeView( |
| 304 widget ? widget->GetNativeView() : NULL); | 289 widget ? widget->GetNativeView() : NULL); |
| 305 } | 290 } |
| 306 | 291 |
| 307 } // namespace | 292 } // namespace |
| 308 | 293 |
| 309 //////////////////////////////////////////////////////////////////////////////// | 294 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1787 const gfx::ImageSkia& image) { | 1772 const gfx::ImageSkia& image) { |
| 1788 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 1773 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |
| 1789 ImageCacheEntry entry; | 1774 ImageCacheEntry entry; |
| 1790 entry.resource_id = resource_id; | 1775 entry.resource_id = resource_id; |
| 1791 entry.scale_factor = scale_factor; | 1776 entry.scale_factor = scale_factor; |
| 1792 entry.image = image; | 1777 entry.image = image; |
| 1793 image_cache_->push_front(entry); | 1778 image_cache_->push_front(entry); |
| 1794 if (image_cache_->size() > kMaxImageCacheSize) | 1779 if (image_cache_->size() > kMaxImageCacheSize) |
| 1795 image_cache_->pop_back(); | 1780 image_cache_->pop_back(); |
| 1796 } | 1781 } |
| OLD | NEW |