| 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 #import "chrome/browser/ui/cocoa/tabpose_window.h" | 5 #import "chrome/browser/ui/cocoa/tabpose_window.h" |
| 6 | 6 |
| 7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 NSRect thumb_start = GetStartRectRelativeTo(tile); | 450 NSRect thumb_start = GetStartRectRelativeTo(tile); |
| 451 CGFloat scale_to_start = NSWidth(thumb_start) / NSWidth(thumb_rect_); | 451 CGFloat scale_to_start = NSWidth(thumb_start) / NSWidth(thumb_rect_); |
| 452 NSRect rect = | 452 NSRect rect = |
| 453 ScaleRectWithOrigin(favicon_rect_, thumb_rect_.origin, scale_to_start); | 453 ScaleRectWithOrigin(favicon_rect_, thumb_rect_.origin, scale_to_start); |
| 454 rect.origin.x += NSMinX(thumb_start) - NSMinX(thumb_rect_); | 454 rect.origin.x += NSMinX(thumb_start) - NSMinX(thumb_rect_); |
| 455 rect.origin.y += NSMinY(thumb_start) - NSMinY(thumb_rect_); | 455 rect.origin.y += NSMinY(thumb_start) - NSMinY(thumb_rect_); |
| 456 return rect; | 456 return rect; |
| 457 } | 457 } |
| 458 | 458 |
| 459 NSImage* Tile::favicon() const { | 459 NSImage* Tile::favicon() const { |
| 460 if (contents_->extension_tab_helper()->is_app()) { | 460 extensions::TabHelper* extensions_tab_helper = |
| 461 SkBitmap* bitmap = contents_->extension_tab_helper()->GetExtensionAppIcon(); | 461 extensions::TabHelper::FromWebContents(contents_->web_contents()); |
| 462 if (extensions_tab_helper->is_app()) { |
| 463 SkBitmap* bitmap = extensions_tab_helper->GetExtensionAppIcon(); |
| 462 if (bitmap) | 464 if (bitmap) |
| 463 return gfx::SkBitmapToNSImage(*bitmap); | 465 return gfx::SkBitmapToNSImage(*bitmap); |
| 464 } | 466 } |
| 465 return mac::FaviconForTabContents(contents_); | 467 return mac::FaviconForTabContents(contents_); |
| 466 } | 468 } |
| 467 | 469 |
| 468 NSRect Tile::GetTitleStartRectRelativeTo(const Tile& tile) const { | 470 NSRect Tile::GetTitleStartRectRelativeTo(const Tile& tile) const { |
| 469 NSRect thumb_start = GetStartRectRelativeTo(tile); | 471 NSRect thumb_start = GetStartRectRelativeTo(tile); |
| 470 CGFloat scale_to_start = NSWidth(thumb_start) / NSWidth(thumb_rect_); | 472 CGFloat scale_to_start = NSWidth(thumb_start) / NSWidth(thumb_rect_); |
| 471 NSRect rect = | 473 NSRect rect = |
| (...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1665 tile.set_tab_contents(contents); | 1667 tile.set_tab_contents(contents); |
| 1666 ThumbnailLayer* thumbLayer = [allThumbnailLayers_ objectAtIndex:index]; | 1668 ThumbnailLayer* thumbLayer = [allThumbnailLayers_ objectAtIndex:index]; |
| 1667 [thumbLayer setTabContents:contents]; | 1669 [thumbLayer setTabContents:contents]; |
| 1668 } | 1670 } |
| 1669 | 1671 |
| 1670 - (void)tabStripModelDeleted { | 1672 - (void)tabStripModelDeleted { |
| 1671 [self close]; | 1673 [self close]; |
| 1672 } | 1674 } |
| 1673 | 1675 |
| 1674 @end | 1676 @end |
| OLD | NEW |