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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm

Issue 1064823002: Componentize FaviconTabHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@favicon-notification
Patch Set: Fix BUILD.gn Created 5 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 unified diff | Download patch
OLDNEW
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 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 ResourceBundle::GetSharedInstance().GetNativeImageNamed( 1547 ResourceBundle::GetSharedInstance().GetNativeImageNamed(
1548 IDR_THROBBER).CopyNSImage(); 1548 IDR_THROBBER).CopyNSImage();
1549 static NSImage* sadFaviconImage = 1549 static NSImage* sadFaviconImage =
1550 ResourceBundle::GetSharedInstance().GetNativeImageNamed( 1550 ResourceBundle::GetSharedInstance().GetNativeImageNamed(
1551 IDR_SAD_FAVICON).CopyNSImage(); 1551 IDR_SAD_FAVICON).CopyNSImage();
1552 1552
1553 // Take closing tabs into account. 1553 // Take closing tabs into account.
1554 NSInteger index = [self indexFromModelIndex:modelIndex]; 1554 NSInteger index = [self indexFromModelIndex:modelIndex];
1555 TabController* tabController = [tabArray_ objectAtIndex:index]; 1555 TabController* tabController = [tabArray_ objectAtIndex:index];
1556 1556
1557 FaviconTabHelper* favicon_tab_helper =
1558 FaviconTabHelper::FromWebContents(contents);
1559 bool oldHasIcon = [tabController iconView] != nil; 1557 bool oldHasIcon = [tabController iconView] != nil;
1560 bool newHasIcon = favicon_tab_helper->ShouldDisplayFavicon() || 1558 bool newHasIcon = FaviconTabHelper::ShouldDisplayFavicon(contents) ||
1561 tabStripModel_->IsMiniTab(modelIndex); // Always show icon if mini. 1559 tabStripModel_->IsMiniTab(modelIndex); // Always show icon if mini.
1562 1560
1563 TabLoadingState oldState = [tabController loadingState]; 1561 TabLoadingState oldState = [tabController loadingState];
1564 TabLoadingState newState = kTabDone; 1562 TabLoadingState newState = kTabDone;
1565 NSImage* throbberImage = nil; 1563 NSImage* throbberImage = nil;
1566 if (contents->IsCrashed()) { 1564 if (contents->IsCrashed()) {
1567 newState = kTabCrashed; 1565 newState = kTabCrashed;
1568 newHasIcon = true; 1566 newHasIcon = true;
1569 } else if (contents->IsWaitingForResponse()) { 1567 } else if (contents->IsWaitingForResponse()) {
1570 newState = kTabWaiting; 1568 newState = kTabWaiting;
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
2282 forButtonState:image_button_cell::kHoverStateBackground]; 2280 forButtonState:image_button_cell::kHoverStateBackground];
2283 } else { 2281 } else {
2284 [[newTabButton_ cell] setImage:nil 2282 [[newTabButton_ cell] setImage:nil
2285 forButtonState:image_button_cell::kDefaultStateBackground]; 2283 forButtonState:image_button_cell::kDefaultStateBackground];
2286 [[newTabButton_ cell] setImage:nil 2284 [[newTabButton_ cell] setImage:nil
2287 forButtonState:image_button_cell::kHoverStateBackground]; 2285 forButtonState:image_button_cell::kHoverStateBackground];
2288 } 2286 }
2289 } 2287 }
2290 2288
2291 @end 2289 @end
OLDNEW
« no previous file with comments | « chrome/browser/favicon/favicon_tab_helper_browsertest.cc ('k') | chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698