Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Unified Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm

Issue 6814029: Revert 80519 - Move favicon from TabContents to TabContentsWrapper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/tabpose_window.mm ('k') | chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
===================================================================
--- chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm (revision 80859)
+++ chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm (working copy)
@@ -18,7 +18,6 @@
#include "chrome/browser/autocomplete/autocomplete_classifier.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/extensions/extension_tab_helper.h"
-#include "chrome/browser/favicon_tab_helper.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
@@ -155,7 +154,7 @@
- (void)addSubviewToPermanentList:(NSView*)aView;
- (void)regenerateSubviewList;
- (NSInteger)indexForContentsView:(NSView*)view;
-- (void)updateFaviconForContents:(TabContentsWrapper*)contents
+- (void)updateFaviconForContents:(TabContents*)contents
atIndex:(NSInteger)modelIndex;
- (void)layoutTabsWithAnimation:(BOOL)animate
regenerateSubviews:(BOOL)doUpdate;
@@ -1147,7 +1146,7 @@
// dragging a tab out into a new window, we have to put the tab's favicon
// into the right state up front as we won't be told to do it from anywhere
// else.
- [self updateFaviconForContents:contents atIndex:modelIndex];
+ [self updateFaviconForContents:contents->tab_contents() atIndex:modelIndex];
[self updateCommonTitlePrefix];
@@ -1343,19 +1342,21 @@
// A helper routine for creating an NSImageView to hold the favicon or app icon
// for |contents|.
-- (NSImageView*)iconImageViewForContents:(TabContentsWrapper*)contents {
- BOOL isApp = contents->extension_tab_helper()->is_app();
+- (NSImageView*)iconImageViewForContents:(TabContents*)contents {
+ TabContentsWrapper* wrapper =
+ TabContentsWrapper::GetCurrentWrapperForContents(contents);
+ BOOL isApp = wrapper->extension_tab_helper()->is_app();
NSImage* image = nil;
// Favicons come from the renderer, and the renderer draws everything in the
// system color space.
CGColorSpaceRef colorSpace = base::mac::GetSystemColorSpace();
if (isApp) {
- SkBitmap* icon = contents->extension_tab_helper()->GetExtensionAppIcon();
+ SkBitmap* icon = wrapper->extension_tab_helper()->GetExtensionAppIcon();
if (icon)
image = gfx::SkBitmapToNSImageWithColorSpace(*icon, colorSpace);
} else {
- image = gfx::SkBitmapToNSImageWithColorSpace(
- contents->favicon_tab_helper()->GetFavicon(), colorSpace);
+ image = gfx::SkBitmapToNSImageWithColorSpace(contents->GetFavicon(),
+ colorSpace);
}
// Either we don't have a valid favicon or there was some issue converting it
@@ -1370,7 +1371,7 @@
// Updates the current loading state, replacing the icon view with a favicon,
// a throbber, the default icon, or nothing at all.
-- (void)updateFaviconForContents:(TabContentsWrapper*)contents
+- (void)updateFaviconForContents:(TabContents*)contents
atIndex:(NSInteger)modelIndex {
if (!contents)
return;
@@ -1390,19 +1391,19 @@
TabController* tabController = [tabArray_ objectAtIndex:index];
bool oldHasIcon = [tabController iconView] != nil;
- bool newHasIcon = contents->favicon_tab_helper()->ShouldDisplayFavicon() ||
+ bool newHasIcon = contents->ShouldDisplayFavicon() ||
tabStripModel_->IsMiniTab(modelIndex); // Always show icon if mini.
TabLoadingState oldState = [tabController loadingState];
TabLoadingState newState = kTabDone;
NSImage* throbberImage = nil;
- if (contents->tab_contents()->is_crashed()) {
+ if (contents->is_crashed()) {
newState = kTabCrashed;
newHasIcon = true;
- } else if (contents->tab_contents()->waiting_for_response()) {
+ } else if (contents->waiting_for_response()) {
newState = kTabWaiting;
throbberImage = throbberWaitingImage;
- } else if (contents->tab_contents()->is_loading()) {
+ } else if (contents->is_loading()) {
newState = kTabLoading;
throbberImage = throbberLoadingImage;
}
@@ -1462,7 +1463,7 @@
if (change != TabStripModelObserver::LOADING_ONLY)
[self setTabTitle:tabController withContents:contents->tab_contents()];
- [self updateFaviconForContents:contents atIndex:modelIndex];
+ [self updateFaviconForContents:contents->tab_contents() atIndex:modelIndex];
TabContentsController* updatedController =
[tabContentsArray_ objectAtIndex:index];
@@ -1516,7 +1517,7 @@
[tabController setPinned:tabStripModel_->IsTabPinned(modelIndex)];
[tabController setApp:tabStripModel_->IsAppTab(modelIndex)];
[tabController setUrl:contents->tab_contents()->GetURL()];
- [self updateFaviconForContents:contents atIndex:modelIndex];
+ [self updateFaviconForContents:contents->tab_contents() atIndex:modelIndex];
// If the tab is being restored and it's pinned, the mini state is set after
// the tab has already been rendered, so re-layout the tabstrip. In all other
// cases, the state is set before the tab is rendered so this isn't needed.
« no previous file with comments | « chrome/browser/ui/cocoa/tabpose_window.mm ('k') | chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698