| 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/tabs/tab_strip_controller.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 6 | 6 |
| 7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1411 } else { | 1411 } else { |
| 1412 [self removeTab:tab]; | 1412 [self removeTab:tab]; |
| 1413 } | 1413 } |
| 1414 | 1414 |
| 1415 [delegate_ onTabDetachedWithContents:contents->web_contents()]; | 1415 [delegate_ onTabDetachedWithContents:contents->web_contents()]; |
| 1416 } | 1416 } |
| 1417 | 1417 |
| 1418 // A helper routine for creating an NSImageView to hold the favicon or app icon | 1418 // A helper routine for creating an NSImageView to hold the favicon or app icon |
| 1419 // for |contents|. | 1419 // for |contents|. |
| 1420 - (NSImageView*)iconImageViewForContents:(TabContents*)contents { | 1420 - (NSImageView*)iconImageViewForContents:(TabContents*)contents { |
| 1421 BOOL isApp = contents->extension_tab_helper()->is_app(); | 1421 extensions::TabHelper* extensions_tab_helper = |
| 1422 extensions::TabHelper::FromWebContents(contents->web_contents()); |
| 1423 BOOL isApp = extensions_tab_helper->is_app(); |
| 1422 NSImage* image = nil; | 1424 NSImage* image = nil; |
| 1423 // Favicons come from the renderer, and the renderer draws everything in the | 1425 // Favicons come from the renderer, and the renderer draws everything in the |
| 1424 // system color space. | 1426 // system color space. |
| 1425 CGColorSpaceRef colorSpace = base::mac::GetSystemColorSpace(); | 1427 CGColorSpaceRef colorSpace = base::mac::GetSystemColorSpace(); |
| 1426 if (isApp) { | 1428 if (isApp) { |
| 1427 SkBitmap* icon = contents->extension_tab_helper()->GetExtensionAppIcon(); | 1429 SkBitmap* icon = extensions_tab_helper->GetExtensionAppIcon(); |
| 1428 if (icon) | 1430 if (icon) |
| 1429 image = gfx::SkBitmapToNSImageWithColorSpace(*icon, colorSpace); | 1431 image = gfx::SkBitmapToNSImageWithColorSpace(*icon, colorSpace); |
| 1430 } else { | 1432 } else { |
| 1431 image = mac::FaviconForTabContents(contents); | 1433 image = mac::FaviconForTabContents(contents); |
| 1432 } | 1434 } |
| 1433 | 1435 |
| 1434 // Either we don't have a valid favicon or there was some issue converting it | 1436 // Either we don't have a valid favicon or there was some issue converting it |
| 1435 // from an SkBitmap. Either way, just show the default. | 1437 // from an SkBitmap. Either way, just show the default. |
| 1436 if (!image) | 1438 if (!image) |
| 1437 image = defaultFavicon_.get(); | 1439 image = defaultFavicon_.get(); |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2100 NSView* GetSheetParentViewForTabContents(TabContents* tab_contents) { | 2102 NSView* GetSheetParentViewForTabContents(TabContents* tab_contents) { |
| 2101 // View hierarchy of the contents view: | 2103 // View hierarchy of the contents view: |
| 2102 // NSView -- switchView, same for all tabs | 2104 // NSView -- switchView, same for all tabs |
| 2103 // +- NSView -- TabContentsController's view | 2105 // +- NSView -- TabContentsController's view |
| 2104 // +- TabContentsViewCocoa | 2106 // +- TabContentsViewCocoa |
| 2105 // | 2107 // |
| 2106 // Changing it? Do not forget to modify | 2108 // Changing it? Do not forget to modify |
| 2107 // -[TabStripController swapInTabAtIndex:] too. | 2109 // -[TabStripController swapInTabAtIndex:] too. |
| 2108 return [tab_contents->web_contents()->GetNativeView() superview]; | 2110 return [tab_contents->web_contents()->GetNativeView() superview]; |
| 2109 } | 2111 } |
| OLD | NEW |