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

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

Issue 194101: Update the sadtab and throbbers to use the helpers for fetching strings/image... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/cocoa/sad_tab_view.mm ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/cocoa/tab_strip_controller.h" 5 #import "chrome/browser/cocoa/tab_strip_controller.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h"
8 #include "base/mac_util.h" 9 #include "base/mac_util.h"
9 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
10 #include "chrome/app/chrome_dll_resource.h" 11 #include "chrome/app/chrome_dll_resource.h"
11 #include "chrome/browser/browser.h" 12 #include "chrome/browser/browser.h"
12 #include "chrome/browser/cocoa/nsimage_cache.h" 13 #include "chrome/browser/cocoa/nsimage_cache.h"
13 #include "chrome/browser/find_bar.h" 14 #include "chrome/browser/find_bar.h"
14 #include "chrome/browser/find_bar_controller.h" 15 #include "chrome/browser/find_bar_controller.h"
15 #include "chrome/browser/metrics/user_metrics.h" 16 #include "chrome/browser/metrics/user_metrics.h"
16 #include "chrome/browser/profile.h" 17 #include "chrome/browser/profile.h"
17 #import "chrome/browser/cocoa/browser_window_controller.h" 18 #import "chrome/browser/cocoa/browser_window_controller.h"
18 #import "chrome/browser/cocoa/constrained_window_mac.h" 19 #import "chrome/browser/cocoa/constrained_window_mac.h"
19 #import "chrome/browser/cocoa/tab_strip_view.h" 20 #import "chrome/browser/cocoa/tab_strip_view.h"
20 #import "chrome/browser/cocoa/tab_cell.h" 21 #import "chrome/browser/cocoa/tab_cell.h"
21 #import "chrome/browser/cocoa/tab_contents_controller.h" 22 #import "chrome/browser/cocoa/tab_contents_controller.h"
22 #import "chrome/browser/cocoa/tab_controller.h" 23 #import "chrome/browser/cocoa/tab_controller.h"
23 #import "chrome/browser/cocoa/tab_strip_model_observer_bridge.h" 24 #import "chrome/browser/cocoa/tab_strip_model_observer_bridge.h"
24 #import "chrome/browser/cocoa/tab_view.h" 25 #import "chrome/browser/cocoa/tab_view.h"
25 #import "chrome/browser/cocoa/throbber_view.h" 26 #import "chrome/browser/cocoa/throbber_view.h"
26 #include "chrome/browser/tab_contents/navigation_controller.h" 27 #include "chrome/browser/tab_contents/navigation_controller.h"
27 #include "chrome/browser/tab_contents/navigation_entry.h" 28 #include "chrome/browser/tab_contents/navigation_entry.h"
28 #include "chrome/browser/tab_contents/tab_contents.h" 29 #include "chrome/browser/tab_contents/tab_contents.h"
29 #include "chrome/browser/tab_contents/tab_contents_view.h" 30 #include "chrome/browser/tab_contents/tab_contents_view.h"
30 #include "chrome/browser/tabs/tab_strip_model.h" 31 #include "chrome/browser/tabs/tab_strip_model.h"
32 #include "grit/app_resources.h"
31 #include "grit/generated_resources.h" 33 #include "grit/generated_resources.h"
32 #include "skia/ext/skia_utils_mac.h" 34 #include "skia/ext/skia_utils_mac.h"
33 35
34 NSString* const kTabStripNumberOfTabsChanged = @"kTabStripNumberOfTabsChanged"; 36 NSString* const kTabStripNumberOfTabsChanged = @"kTabStripNumberOfTabsChanged";
35 37
36 // A value to indicate tab layout should use the full available width of the 38 // A value to indicate tab layout should use the full available width of the
37 // view. 39 // view.
38 static const float kUseFullAvailableWidth = -1.0; 40 static const float kUseFullAvailableWidth = -1.0;
39 41
40 // Left-side indent for tab layout so tabs don't overlap with the window 42 // Left-side indent for tab layout so tabs don't overlap with the window
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 } 667 }
666 668
667 // Updates the current loading state, replacing the icon view with a favicon, 669 // Updates the current loading state, replacing the icon view with a favicon,
668 // a throbber, the default icon, or nothing at all. 670 // a throbber, the default icon, or nothing at all.
669 - (void)updateFavIconForContents:(TabContents*)contents 671 - (void)updateFavIconForContents:(TabContents*)contents
670 atIndex:(NSInteger)index { 672 atIndex:(NSInteger)index {
671 if (!contents) 673 if (!contents)
672 return; 674 return;
673 675
674 static NSImage* throbberWaitingImage = 676 static NSImage* throbberWaitingImage =
675 [nsimage_cache::ImageNamed(@"throbber_waiting.png") retain]; 677 [ResourceBundle::GetSharedInstance().GetNSImageNamed(IDR_THROBBER_WAITING)
678 retain];
676 static NSImage* throbberLoadingImage = 679 static NSImage* throbberLoadingImage =
677 [nsimage_cache::ImageNamed(@"throbber.png") retain]; 680 [ResourceBundle::GetSharedInstance().GetNSImageNamed(IDR_THROBBER)
681 retain];
678 static NSImage* sadFaviconImage = 682 static NSImage* sadFaviconImage =
679 [nsimage_cache::ImageNamed(@"sadfavicon.png") retain]; 683 [ResourceBundle::GetSharedInstance().GetNSImageNamed(IDR_SAD_FAVICON)
684 retain];
680 685
681 TabController* tabController = [tabArray_ objectAtIndex:index]; 686 TabController* tabController = [tabArray_ objectAtIndex:index];
682 687
683 bool oldHasIcon = [tabController iconView] != nil; 688 bool oldHasIcon = [tabController iconView] != nil;
684 bool newHasIcon = contents->ShouldDisplayFavIcon(); 689 bool newHasIcon = contents->ShouldDisplayFavIcon();
685 690
686 TabLoadingState oldState = [tabController loadingState]; 691 TabLoadingState oldState = [tabController loadingState];
687 TabLoadingState newState = kTabDone; 692 TabLoadingState newState = kTabDone;
688 NSImage* throbberImage = nil; 693 NSImage* throbberImage = nil;
689 if (contents->is_crashed()) { 694 if (contents->is_crashed()) {
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 BrowserWindowController* controller = 969 BrowserWindowController* controller =
965 (BrowserWindowController*)[[switchView_ window] windowController]; 970 (BrowserWindowController*)[[switchView_ window] windowController];
966 DCHECK(index >= 0); 971 DCHECK(index >= 0);
967 if (index >= 0) { 972 if (index >= 0) {
968 [controller setTab:[self viewAtIndex:index] isDraggable:YES]; 973 [controller setTab:[self viewAtIndex:index] isDraggable:YES];
969 } 974 }
970 } 975 }
971 976
972 977
973 @end 978 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/sad_tab_view.mm ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698