| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <limits> | 9 #include <limits> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "app/mac/nsimage_cache.h" | 12 #include "app/mac/nsimage_cache.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/mac/mac_util.h" | 14 #include "base/mac/mac_util.h" |
| 15 #include "base/sys_string_conversions.h" | 15 #include "base/sys_string_conversions.h" |
| 16 #include "chrome/app/chrome_command_ids.h" | 16 #include "chrome/app/chrome_command_ids.h" |
| 17 #include "chrome/browser/autocomplete/autocomplete.h" | 17 #include "chrome/browser/autocomplete/autocomplete.h" |
| 18 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 18 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 19 #include "chrome/browser/autocomplete/autocomplete_match.h" | 19 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 20 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 20 #include "chrome/browser/metrics/user_metrics.h" | 21 #include "chrome/browser/metrics/user_metrics.h" |
| 21 #include "chrome/browser/prefs/pref_service.h" | 22 #include "chrome/browser/prefs/pref_service.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/debugger/devtools_window.h" | 24 #include "chrome/browser/debugger/devtools_window.h" |
| 24 #include "chrome/browser/net/url_fixer_upper.h" | 25 #include "chrome/browser/net/url_fixer_upper.h" |
| 25 #include "chrome/browser/sidebar/sidebar_container.h" | 26 #include "chrome/browser/sidebar/sidebar_container.h" |
| 26 #include "chrome/browser/sidebar/sidebar_manager.h" | 27 #include "chrome/browser/sidebar/sidebar_manager.h" |
| 27 #include "chrome/browser/tabs/tab_strip_model.h" | 28 #include "chrome/browser/tabs/tab_strip_model.h" |
| 28 #include "chrome/browser/ui/browser.h" | 29 #include "chrome/browser/ui/browser.h" |
| 29 #include "chrome/browser/ui/browser_navigator.h" | 30 #include "chrome/browser/ui/browser_navigator.h" |
| (...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 [[NSNotificationCenter defaultCenter] | 1321 [[NSNotificationCenter defaultCenter] |
| 1321 postNotificationName:kTabStripNumberOfTabsChanged | 1322 postNotificationName:kTabStripNumberOfTabsChanged |
| 1322 object:self]; | 1323 object:self]; |
| 1323 | 1324 |
| 1324 [delegate_ onTabDetachedWithContents:contents->tab_contents()]; | 1325 [delegate_ onTabDetachedWithContents:contents->tab_contents()]; |
| 1325 } | 1326 } |
| 1326 | 1327 |
| 1327 // A helper routine for creating an NSImageView to hold the favicon or app icon | 1328 // A helper routine for creating an NSImageView to hold the favicon or app icon |
| 1328 // for |contents|. | 1329 // for |contents|. |
| 1329 - (NSImageView*)iconImageViewForContents:(TabContents*)contents { | 1330 - (NSImageView*)iconImageViewForContents:(TabContents*)contents { |
| 1330 BOOL isApp = contents->is_app(); | 1331 TabContentsWrapper* wrapper = |
| 1332 TabContentsWrapper::GetCurrentWrapperForContents(contents); |
| 1333 BOOL isApp = wrapper->extension_tab_helper()->is_app(); |
| 1331 NSImage* image = nil; | 1334 NSImage* image = nil; |
| 1332 // Favicons come from the renderer, and the renderer draws everything in the | 1335 // Favicons come from the renderer, and the renderer draws everything in the |
| 1333 // system color space. | 1336 // system color space. |
| 1334 CGColorSpaceRef colorSpace = base::mac::GetSystemColorSpace(); | 1337 CGColorSpaceRef colorSpace = base::mac::GetSystemColorSpace(); |
| 1335 if (isApp) { | 1338 if (isApp) { |
| 1336 SkBitmap* icon = contents->GetExtensionAppIcon(); | 1339 SkBitmap* icon = wrapper->extension_tab_helper()->GetExtensionAppIcon(); |
| 1337 if (icon) | 1340 if (icon) |
| 1338 image = gfx::SkBitmapToNSImageWithColorSpace(*icon, colorSpace); | 1341 image = gfx::SkBitmapToNSImageWithColorSpace(*icon, colorSpace); |
| 1339 } else { | 1342 } else { |
| 1340 image = gfx::SkBitmapToNSImageWithColorSpace(contents->GetFavicon(), | 1343 image = gfx::SkBitmapToNSImageWithColorSpace(contents->GetFavicon(), |
| 1341 colorSpace); | 1344 colorSpace); |
| 1342 } | 1345 } |
| 1343 | 1346 |
| 1344 // Either we don't have a valid favicon or there was some issue converting it | 1347 // Either we don't have a valid favicon or there was some issue converting it |
| 1345 // from an SkBitmap. Either way, just show the default. | 1348 // from an SkBitmap. Either way, just show the default. |
| 1346 if (!image) | 1349 if (!image) |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2084 } | 2087 } |
| 2085 | 2088 |
| 2086 NSString* menuTitle = | 2089 NSString* menuTitle = |
| 2087 l10n_util::GetNSStringWithFixup(IDS_PROFILES_CREATE_NEW_PROFILE_OPTION); | 2090 l10n_util::GetNSStringWithFixup(IDS_PROFILES_CREATE_NEW_PROFILE_OPTION); |
| 2088 [menu addItemWithTitle:menuTitle | 2091 [menu addItemWithTitle:menuTitle |
| 2089 action:NULL | 2092 action:NULL |
| 2090 keyEquivalent:@""]; | 2093 keyEquivalent:@""]; |
| 2091 } | 2094 } |
| 2092 | 2095 |
| 2093 @end | 2096 @end |
| OLD | NEW |