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

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

Issue 6735042: Move favicon from TabContents to TabContentsWrapper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 9 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
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
index 62d1702044be6319b2af20bced105f6243e641f2..be5cb9b3d58f794e64d2bb7db2174033e420c654 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
@@ -18,6 +18,7 @@
#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"
@@ -154,7 +155,7 @@ private:
- (void)addSubviewToPermanentList:(NSView*)aView;
- (void)regenerateSubviewList;
- (NSInteger)indexForContentsView:(NSView*)view;
-- (void)updateFaviconForContents:(TabContents*)contents
+- (void)updateFaviconForContents:(TabContentsWrapper*)contents
atIndex:(NSInteger)modelIndex;
- (void)layoutTabsWithAnimation:(BOOL)animate
regenerateSubviews:(BOOL)doUpdate;
@@ -1131,7 +1132,7 @@ class NotificationBridge : public NotificationObserver {
// 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->tab_contents() atIndex:modelIndex];
+ [self updateFaviconForContents:contents atIndex:modelIndex];
[self updateCommonTitlePrefix];
@@ -1327,21 +1328,19 @@ class NotificationBridge : public NotificationObserver {
// A helper routine for creating an NSImageView to hold the favicon or app icon
// for |contents|.
-- (NSImageView*)iconImageViewForContents:(TabContents*)contents {
- TabContentsWrapper* wrapper =
- TabContentsWrapper::GetCurrentWrapperForContents(contents);
- BOOL isApp = wrapper->extension_tab_helper()->is_app();
+- (NSImageView*)iconImageViewForContents:(TabContentsWrapper*)contents {
+ BOOL isApp = contents->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 = wrapper->extension_tab_helper()->GetExtensionAppIcon();
+ SkBitmap* icon = contents->extension_tab_helper()->GetExtensionAppIcon();
if (icon)
image = gfx::SkBitmapToNSImageWithColorSpace(*icon, colorSpace);
} else {
- image = gfx::SkBitmapToNSImageWithColorSpace(contents->GetFavicon(),
- colorSpace);
+ image = gfx::SkBitmapToNSImageWithColorSpace(
+ contents->favicon_tab_helper()->GetFavicon(), colorSpace);
}
// Either we don't have a valid favicon or there was some issue converting it
@@ -1356,7 +1355,7 @@ class NotificationBridge : public NotificationObserver {
// Updates the current loading state, replacing the icon view with a favicon,
// a throbber, the default icon, or nothing at all.
-- (void)updateFaviconForContents:(TabContents*)contents
+- (void)updateFaviconForContents:(TabContentsWrapper*)contents
atIndex:(NSInteger)modelIndex {
if (!contents)
return;
@@ -1376,19 +1375,19 @@ class NotificationBridge : public NotificationObserver {
TabController* tabController = [tabArray_ objectAtIndex:index];
bool oldHasIcon = [tabController iconView] != nil;
- bool newHasIcon = contents->ShouldDisplayFavicon() ||
+ bool newHasIcon = contents->favicon_tab_helper()->ShouldDisplayFavicon() ||
tabStripModel_->IsMiniTab(modelIndex); // Always show icon if mini.
TabLoadingState oldState = [tabController loadingState];
TabLoadingState newState = kTabDone;
NSImage* throbberImage = nil;
- if (contents->is_crashed()) {
+ if (contents->tab_contents()->is_crashed()) {
newState = kTabCrashed;
newHasIcon = true;
- } else if (contents->waiting_for_response()) {
+ } else if (contents->tab_contents()->waiting_for_response()) {
newState = kTabWaiting;
throbberImage = throbberWaitingImage;
- } else if (contents->is_loading()) {
+ } else if (contents->tab_contents()->is_loading()) {
newState = kTabLoading;
throbberImage = throbberLoadingImage;
}
@@ -1448,7 +1447,7 @@ class NotificationBridge : public NotificationObserver {
if (change != TabStripModelObserver::LOADING_ONLY)
[self setTabTitle:tabController withContents:contents->tab_contents()];
- [self updateFaviconForContents:contents->tab_contents() atIndex:modelIndex];
+ [self updateFaviconForContents:contents atIndex:modelIndex];
TabContentsController* updatedController =
[tabContentsArray_ objectAtIndex:index];
@@ -1501,7 +1500,7 @@ class NotificationBridge : public NotificationObserver {
[tabController setMini:tabStripModel_->IsMiniTab(modelIndex)];
[tabController setPinned:tabStripModel_->IsTabPinned(modelIndex)];
[tabController setApp:tabStripModel_->IsAppTab(modelIndex)];
- [self updateFaviconForContents:contents->tab_contents() atIndex:modelIndex];
+ [self updateFaviconForContents: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