diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-22 20:29:58 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-22 20:29:58 +0000 |
commit | ca2b1cbcace07670d6631bfe226ffc906c009453 (patch) | |
tree | 8c6aa3f26331f06eb353fcf7a6d32860c42e736a | |
parent | 1ce107fc44a5c1d3d92ad01bead09be8e8b2acad (diff) | |
download | chromium_src-ca2b1cbcace07670d6631bfe226ffc906c009453.zip chromium_src-ca2b1cbcace07670d6631bfe226ffc906c009453.tar.gz chromium_src-ca2b1cbcace07670d6631bfe226ffc906c009453.tar.bz2 |
Move nsimage_cache from base to app/mac. Use the app::mac namespace. Update calling code.
Remove unnecessary refs to NullableString from render_thread.*
TEST=it compiles
BUG=none
Review URL: http://codereview.chromium.org/5961007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69973 0039d316-1c4b-4281-b951-d872f2087c98
27 files changed, 93 insertions, 117 deletions
diff --git a/app/app_base.gypi b/app/app_base.gypi index 3715498..cc2c0e6 100644 --- a/app/app_base.gypi +++ b/app/app_base.gypi @@ -168,6 +168,8 @@ 'l10n_util_win.h', 'linear_animation.cc', 'linear_animation.h', + 'mac/nsimage_cache.h', + 'mac/nsimage_cache.mm', 'mac/scoped_nsdisable_screen_updates.h', 'menus/accelerator.h', 'menus/accelerator_gtk.h', diff --git a/base/nsimage_cache_mac.h b/app/mac/nsimage_cache.h index b13eac9..ed1de06 100644 --- a/base/nsimage_cache_mac.h +++ b/app/mac/nsimage_cache.h @@ -1,9 +1,9 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef BASE_NSIMAGE_CACHE_MAC_H_ -#define BASE_NSIMAGE_CACHE_MAC_H_ +#ifndef APP_MAC_NSIMAGE_CACHE_H_ +#define APP_MAC_NSIMAGE_CACHE_H_ #pragma once #ifdef __OBJC__ @@ -14,7 +14,8 @@ class NSImage; class NSString; #endif -namespace nsimage_cache { +namespace app { +namespace mac { // Returns an autoreleased image from the main app bundle // (mac_util::MainAppBundle()) with the given name, and keeps it in memory so @@ -23,11 +24,12 @@ namespace nsimage_cache { // - This should only be called on the main thread. // - The caller should retain the image if they want to keep it around, as // the cache could have limit on size/lifetime, etc. -NSImage* ImageNamed(NSString* name); +NSImage* GetCachedImageWithName(NSString* name); -// Clears the cache. -void Clear(void); +// Clears the image cache. +void ClearCachedImages(void); -} // namespace nsimage_cache +} // namespace mac +} // namespace app -#endif // BASE_NSIMAGE_CACHE_MAC_H_ +#endif // APP_MAC_NSIMAGE_CACHE_H_ diff --git a/base/nsimage_cache_mac.mm b/app/mac/nsimage_cache.mm index e693ed4..a5d645e 100644 --- a/base/nsimage_cache_mac.mm +++ b/app/mac/nsimage_cache.mm @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/nsimage_cache_mac.h" +#include "app/mac/nsimage_cache.h" #import <AppKit/AppKit.h> @@ -18,11 +18,12 @@ #undef try #undef catch -namespace nsimage_cache { +namespace app { +namespace mac { static NSMutableDictionary* image_cache = nil; -NSImage* ImageNamed(NSString* name) { +NSImage* GetCachedImageWithName(NSString* name) { DCHECK(name); // NOTE: to make this thread safe, we'd have to sync on the cache and @@ -65,9 +66,10 @@ NSImage* ImageNamed(NSString* name) { return result; } -void Clear(void) { +void ClearCachedImages(void) { // NOTE: to make this thread safe, we'd have to sync on the cache. [image_cache removeAllObjects]; } -} // namespace nsimage_cache +} // namespace mac +} // namespace app diff --git a/app/mac/nsimage_cache_unittest.cc.README b/app/mac/nsimage_cache_unittest.cc.README new file mode 100644 index 0000000..558426f --- /dev/null +++ b/app/mac/nsimage_cache_unittest.cc.README @@ -0,0 +1,3 @@ +The unit test for this file is in +chrome/browser/ui/cocoa/nsimage_cache_unittest.mm since it uses certain Chrome +resources for the test. diff --git a/base/base.gypi b/base/base.gypi index edb6b78..5d785f2 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -631,8 +631,6 @@ 'message_pump_mac.mm', 'metrics/field_trial.cc', 'metrics/field_trial.h', - 'nsimage_cache_mac.h', - 'nsimage_cache_mac.mm', 'nss_util.cc', 'nss_util.h', 'openssl_util.cc', diff --git a/base/compat_execinfo.h b/base/compat_execinfo.h deleted file mode 100644 index 3d4cc43..0000000 --- a/base/compat_execinfo.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// A file you can include instead of <execinfo.h> if your project might need -// to run on Mac OS X 10.4. - -#ifndef BASE_COMPAT_EXECINFO_H_ -#define BASE_COMPAT_EXECINFO_H_ -#pragma once - -#include "build/build_config.h" - -#if defined(OS_MACOSX) -#include <AvailabilityMacros.h> -#endif - -#if defined(OS_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 -// Manually define these here as weak imports, rather than including execinfo.h. -// This lets us launch on 10.4 which does not have these calls. -extern "C" { - -extern int backtrace(void**, int) __attribute__((weak_import)); -extern char** backtrace_symbols(void* const*, int) - __attribute__((weak_import)); -extern void backtrace_symbols_fd(void* const*, int, int) - __attribute__((weak_import)); - -} // extern "C" -#else -#include <execinfo.h> -#endif - -#endif // BASE_COMPAT_EXECINFO_H_ diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm index 4bc4a5e..ce2c0f1 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm @@ -8,8 +8,8 @@ #include "app/clipboard/clipboard.h" #include "app/clipboard/scoped_clipboard_writer.h" +#include "app/mac/nsimage_cache.h" #include "app/resource_bundle.h" -#include "base/nsimage_cache_mac.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" #include "base/utf_string_conversions.h" @@ -149,7 +149,7 @@ NSImage* AutocompleteEditViewMac::ImageForResource(int resource_id) { } if (image_name) { - if (NSImage* image = nsimage_cache::ImageNamed(image_name)) { + if (NSImage* image = app::mac::GetCachedImageWithName(image_name)) { return image; } else { NOTREACHED() diff --git a/chrome/browser/ui/cocoa/animatable_image_unittest.mm b/chrome/browser/ui/cocoa/animatable_image_unittest.mm index acdec8c..112e8dd 100644 --- a/chrome/browser/ui/cocoa/animatable_image_unittest.mm +++ b/chrome/browser/ui/cocoa/animatable_image_unittest.mm @@ -4,7 +4,7 @@ #import <Cocoa/Cocoa.h> -#import "base/nsimage_cache_mac.h" +#import "app/mac/nsimage_cache.h" #import "chrome/browser/ui/cocoa/animatable_image.h" #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" #include "testing/gtest/include/gtest/gtest.h" @@ -16,7 +16,7 @@ class AnimatableImageTest : public CocoaTest { public: AnimatableImageTest() { NSRect frame = NSMakeRect(0, 0, 500, 500); - NSImage* image = nsimage_cache::ImageNamed(@"forward_Template.pdf"); + NSImage* image = app::mac::GetCachedImageWithName(@"forward_Template.pdf"); animation_ = [[AnimatableImage alloc] initWithImage:image animationFrame:frame]; } diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm index 7720c90..b86aab9 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm @@ -4,8 +4,8 @@ #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" +#include "app/mac/nsimage_cache.h" #include "base/mac_util.h" -#include "base/nsimage_cache_mac.h" #include "base/sys_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" @@ -131,7 +131,7 @@ const CGFloat kScrollWindowVerticalMargin = 0.0; barController_ = barController; // WEAK buttons_.reset([[NSMutableArray alloc] init]); folderTarget_.reset([[BookmarkFolderTarget alloc] initWithController:self]); - NSImage* image = nsimage_cache::ImageNamed(@"menu_overflow_up.pdf"); + NSImage* image = app::mac::GetCachedImageWithName(@"menu_overflow_up.pdf"); DCHECK(image); verticalScrollArrowHeight_ = [image size].height; [self configureWindow]; diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.mm index 0915188..65cb664 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.mm @@ -5,7 +5,7 @@ #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.h" #import "base/logging.h" -#include "base/nsimage_cache_mac.h" +#include "app/mac/nsimage_cache.h" #import "base/scoped_nsobject.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" #import "chrome/browser/ui/cocoa/image_utils.h" @@ -41,10 +41,10 @@ const CGFloat kViewCornerRadius = 4.0; @implementation BookmarkBarFolderWindowContentView - (void)awakeFromNib { - arrowUpImage_.reset([nsimage_cache::ImageNamed(@"menu_overflow_up.pdf") - retain]); - arrowDownImage_.reset([nsimage_cache::ImageNamed(@"menu_overflow_down.pdf") - retain]); + arrowUpImage_.reset( + [app::mac::GetCachedImageWithName(@"menu_overflow_up.pdf") retain]); + arrowDownImage_.reset( + [app::mac::GetCachedImageWithName(@"menu_overflow_down.pdf") retain]); } // Draw the arrows at the top and bottom of the folder window as a diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm index 969a829..a78d627 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm @@ -5,8 +5,8 @@ #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" #include "app/l10n_util_mac.h" +#include "app/mac/nsimage_cache.h" #include "base/logging.h" -#include "base/nsimage_cache_mac.h" #include "base/sys_string_conversions.h" #import "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/metrics/user_metrics.h" @@ -203,8 +203,8 @@ - (void)setDrawFolderArrow:(BOOL)draw { drawFolderArrow_ = draw; if (draw && !arrowImage_) { - arrowImage_.reset([nsimage_cache::ImageNamed(@"menu_hierarchy_arrow.pdf") - retain]); + arrowImage_.reset( + [app::mac::GetCachedImageWithName(@"menu_hierarchy_arrow.pdf") retain]); } } diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.mm index 2918b5f..3792fe3 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.mm @@ -6,7 +6,7 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "base/nsimage_cache_mac.h" +#include "app/mac/nsimage_cache.h" #include "base/sys_string_conversions.h" #import "chrome/browser/app_controller_mac.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -238,7 +238,7 @@ void BookmarkMenuBridge::ConfigureMenuItem(const BookmarkNode* node, // Either we do not have a loaded favicon or the conversion from SkBitmap // failed. Use the default site image instead. if (!favicon) - favicon = nsimage_cache::ImageNamed(@"nav.pdf"); + favicon = app::mac::GetCachedImageWithName(@"nav.pdf"); [item setImage:favicon]; } diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm index bbd72bc3..589ed91 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm @@ -8,9 +8,9 @@ #include "app/l10n_util.h" #include "app/l10n_util_mac.h" -#include "base/mac_util.h" #include "app/mac/scoped_nsdisable_screen_updates.h" -#include "base/nsimage_cache_mac.h" +#include "app/mac/nsimage_cache.h" +#include "base/mac_util.h" #import "base/scoped_nsobject.h" #include "base/sys_string_conversions.h" #include "chrome/app/chrome_command_ids.h" // IDC_* @@ -1583,7 +1583,7 @@ // Install the image into the badge view and size the view appropriately. // Hide it for now; positioning and showing will be done by the layout code. - NSImage* image = nsimage_cache::ImageNamed(@"otr_icon.pdf"); + NSImage* image = app::mac::GetCachedImageWithName(@"otr_icon.pdf"); incognitoBadge_.reset([[IncognitoImageView alloc] init]); [incognitoBadge_ setImage:image]; [incognitoBadge_ setFrameSize:[image size]]; diff --git a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm index 97e51f5..0e68252 100644 --- a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm @@ -7,7 +7,7 @@ #include <cmath> #include <string> -#include "base/nsimage_cache_mac.h" +#include "app/mac/nsimage_cache.h" #include "base/sys_string_conversions.h" #include "chrome/browser/extensions/extension_browser_event_router.h" #include "chrome/browser/extensions/extension_host.h" @@ -777,7 +777,8 @@ class ExtensionServiceObserverBridge : public NotificationObserver, chevronMenuButton_.reset([[ChevronMenuButton alloc] init]); [chevronMenuButton_ setBordered:NO]; [chevronMenuButton_ setShowsBorderOnlyWhileMouseInside:YES]; - NSImage* chevronImage = nsimage_cache::ImageNamed(kOverflowChevronsName); + NSImage* chevronImage = + app::mac::GetCachedImageWithName(kOverflowChevronsName); [chevronMenuButton_ setImage:chevronImage]; [containerView_ addSubview:chevronMenuButton_]; } diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm index dc85639..d433822 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm @@ -6,7 +6,6 @@ #include "app/l10n_util_mac.h" #include "app/resource_bundle.h" -#include "base/nsimage_cache_mac.h" #include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" diff --git a/chrome/browser/ui/cocoa/notifications/balloon_controller.mm b/chrome/browser/ui/cocoa/notifications/balloon_controller.mm index 98bb473..8719387 100644 --- a/chrome/browser/ui/cocoa/notifications/balloon_controller.mm +++ b/chrome/browser/ui/cocoa/notifications/balloon_controller.mm @@ -5,10 +5,10 @@ #include "chrome/browser/ui/cocoa/notifications/balloon_controller.h" #include "app/l10n_util.h" +#include "app/mac/nsimage_cache.h" #include "app/resource_bundle.h" #import "base/cocoa_protocols_mac.h" #include "base/mac_util.h" -#include "base/nsimage_cache_mac.h" #import "base/scoped_nsobject.h" #include "base/utf_string_conversions.h" #include "chrome/browser/notifications/balloon.h" @@ -59,7 +59,7 @@ const int kRightMargin = 2; DCHECK([self window]); DCHECK_EQ(self, [[self window] delegate]); - NSImage* image = nsimage_cache::ImageNamed(@"balloon_wrench.pdf"); + NSImage* image = app::mac::GetCachedImageWithName(@"balloon_wrench.pdf"); [optionsButton_ setDefaultImage:image]; [optionsButton_ setDefaultOpacity:0.6]; [optionsButton_ setHoverImage:image]; diff --git a/chrome/browser/ui/cocoa/nsimage_cache_unittest.mm b/chrome/browser/ui/cocoa/nsimage_cache_unittest.mm index 7f2e2fb..b00fb5b 100644 --- a/chrome/browser/ui/cocoa/nsimage_cache_unittest.mm +++ b/chrome/browser/ui/cocoa/nsimage_cache_unittest.mm @@ -1,12 +1,12 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #import <Cocoa/Cocoa.h> +#include "app/mac/nsimage_cache.h" #include "base/file_path.h" #include "base/mac_util.h" -#include "base/nsimage_cache_mac.h" #include "base/path_service.h" #include "chrome/common/chrome_constants.h" #include "testing/gtest/include/gtest/gtest.h" @@ -32,30 +32,30 @@ class NSImageCacheTest : public PlatformTest { }; TEST_F(NSImageCacheTest, LookupFound) { - EXPECT_TRUE(nsimage_cache::ImageNamed(@"back_Template.pdf") != nil) + EXPECT_TRUE(app::mac::GetCachedImageWithName(@"back_Template.pdf") != nil) << "Failed to find the toolbar image?"; } TEST_F(NSImageCacheTest, LookupCached) { - EXPECT_EQ(nsimage_cache::ImageNamed(@"back_Template.pdf"), - nsimage_cache::ImageNamed(@"back_Template.pdf")) + EXPECT_EQ(app::mac::GetCachedImageWithName(@"back_Template.pdf"), + app::mac::GetCachedImageWithName(@"back_Template.pdf")) << "Didn't get the same NSImage back?"; } TEST_F(NSImageCacheTest, LookupMiss) { - EXPECT_TRUE(nsimage_cache::ImageNamed(@"should_not.exist") == nil) + EXPECT_TRUE(app::mac::GetCachedImageWithName(@"should_not.exist") == nil) << "There shouldn't be an image with this name?"; } TEST_F(NSImageCacheTest, LookupFoundAndClear) { - NSImage *first = nsimage_cache::ImageNamed(@"back_Template.pdf"); + NSImage *first = app::mac::GetCachedImageWithName(@"back_Template.pdf"); // Hang on to the first image so that the second one doesn't get allocated // in the same location by (bad) luck. [[first retain] autorelease]; EXPECT_TRUE(first != nil) << "Failed to find the toolbar image?"; - nsimage_cache::Clear(); - NSImage *second = nsimage_cache::ImageNamed(@"back_Template.pdf"); + app::mac::ClearCachedImages(); + NSImage *second = app::mac::GetCachedImageWithName(@"back_Template.pdf"); EXPECT_TRUE(second != nil) << "Failed to find the toolbar image...again?"; EXPECT_NE(second, first) @@ -63,10 +63,12 @@ TEST_F(NSImageCacheTest, LookupFoundAndClear) { } TEST_F(NSImageCacheTest, AutoTemplating) { - NSImage *templateImage = nsimage_cache::ImageNamed(@"back_Template.pdf"); + NSImage *templateImage = + app::mac::GetCachedImageWithName(@"back_Template.pdf"); EXPECT_TRUE([templateImage isTemplate] == YES) << "Image ending in 'Template' should be marked as being a template"; - NSImage *nonTemplateImage = nsimage_cache::ImageNamed(@"aliasCursor.png"); + NSImage *nonTemplateImage = + app::mac::GetCachedImageWithName(@"aliasCursor.png"); EXPECT_FALSE([nonTemplateImage isTemplate] == YES) << "Image not ending in 'Template' should not be marked as being a " "template"; diff --git a/chrome/browser/ui/cocoa/reload_button.mm b/chrome/browser/ui/cocoa/reload_button.mm index 84e7091..a2a60af 100644 --- a/chrome/browser/ui/cocoa/reload_button.mm +++ b/chrome/browser/ui/cocoa/reload_button.mm @@ -6,7 +6,7 @@ #include "app/l10n_util.h" #include "app/l10n_util_mac.h" -#include "base/nsimage_cache_mac.h" +#include "app/mac/nsimage_cache.h" #include "chrome/app/chrome_command_ids.h" #import "chrome/browser/ui/cocoa/gradient_button_cell.h" #import "chrome/browser/ui/cocoa/view_id_util.h" @@ -69,10 +69,10 @@ NSTimeInterval kPendingReloadTimeout = 1.35; [self setTag:anInt]; if (anInt == IDC_RELOAD) { - [self setImage:nsimage_cache::ImageNamed(kReloadImageName)]; + [self setImage:app::mac::GetCachedImageWithName(kReloadImageName)]; [self setToolTip:l10n_util::GetNSStringWithFixup(IDS_TOOLTIP_RELOAD)]; } else if (anInt == IDC_STOP) { - [self setImage:nsimage_cache::ImageNamed(kStopImageName)]; + [self setImage:app::mac::GetCachedImageWithName(kStopImageName)]; [self setToolTip:l10n_util::GetNSStringWithFixup(IDS_TOOLTIP_STOP)]; } else { NOTREACHED(); diff --git a/chrome/browser/ui/cocoa/search_engine_dialog_controller.mm b/chrome/browser/ui/cocoa/search_engine_dialog_controller.mm index 9ee6ae8..2a79e09 100644 --- a/chrome/browser/ui/cocoa/search_engine_dialog_controller.mm +++ b/chrome/browser/ui/cocoa/search_engine_dialog_controller.mm @@ -9,7 +9,6 @@ #include "app/l10n_util_mac.h" #include "app/resource_bundle.h" #include "base/mac_util.h" -#include "base/nsimage_cache_mac.h" #include "base/sys_string_conversions.h" #include "base/time.h" #include "chrome/browser/profiles/profile.h" diff --git a/chrome/browser/ui/cocoa/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tab_strip_controller.mm index f939300..876067c 100644 --- a/chrome/browser/ui/cocoa/tab_strip_controller.mm +++ b/chrome/browser/ui/cocoa/tab_strip_controller.mm @@ -10,9 +10,9 @@ #include <string> #include "app/l10n_util.h" +#include "app/mac/nsimage_cache.h" #include "app/resource_bundle.h" #include "base/mac_util.h" -#include "base/nsimage_cache_mac.h" #include "base/sys_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/autocomplete/autocomplete.h" @@ -316,9 +316,9 @@ private: [newTabButton_ setTag:IDC_NEW_TAB]; // Set the images from code because Cocoa fails to find them in our sub // bundle during tests. - [newTabButton_ setImage:nsimage_cache::ImageNamed(kNewTabImage)]; - [newTabButton_ - setAlternateImage:nsimage_cache::ImageNamed(kNewTabPressedImage)]; + [newTabButton_ setImage:app::mac::GetCachedImageWithName(kNewTabImage)]; + [newTabButton_ setAlternateImage: + app::mac::GetCachedImageWithName(kNewTabPressedImage)]; newTabButtonShowingHoverImage_ = NO; newTabTrackingArea_.reset( [[NSTrackingArea alloc] initWithRect:[newTabButton_ bounds] @@ -1590,10 +1590,11 @@ private: - (void)setNewTabButtonHoverState:(BOOL)shouldShowHover { if (shouldShowHover && !newTabButtonShowingHoverImage_) { newTabButtonShowingHoverImage_ = YES; - [newTabButton_ setImage:nsimage_cache::ImageNamed(kNewTabHoverImage)]; + [newTabButton_ setImage: + app::mac::GetCachedImageWithName(kNewTabHoverImage)]; } else if (!shouldShowHover && newTabButtonShowingHoverImage_) { newTabButtonShowingHoverImage_ = NO; - [newTabButton_ setImage:nsimage_cache::ImageNamed(kNewTabImage)]; + [newTabButton_ setImage:app::mac::GetCachedImageWithName(kNewTabImage)]; } } diff --git a/chrome/browser/ui/cocoa/tab_view.mm b/chrome/browser/ui/cocoa/tab_view.mm index aa043db..128b83f 100644 --- a/chrome/browser/ui/cocoa/tab_view.mm +++ b/chrome/browser/ui/cocoa/tab_view.mm @@ -7,7 +7,6 @@ #include "base/logging.h" #import "base/mac_util.h" #include "base/mac/scoped_cftyperef.h" -#include "base/nsimage_cache_mac.h" #include "chrome/browser/accessibility/browser_accessibility_state.h" #include "chrome/browser/themes/browser_theme_provider.h" #import "chrome/browser/ui/cocoa/tab_controller.h" diff --git a/chrome/browser/ui/cocoa/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar_controller.mm index 63f11cd..1b953fd 100644 --- a/chrome/browser/ui/cocoa/toolbar_controller.mm +++ b/chrome/browser/ui/cocoa/toolbar_controller.mm @@ -8,11 +8,11 @@ #include "app/l10n_util.h" #include "app/l10n_util_mac.h" +#include "app/mac/nsimage_cache.h" #include "app/menus/accelerator_cocoa.h" #include "app/menus/menu_model.h" #include "app/resource_bundle.h" #include "base/mac_util.h" -#include "base/nsimage_cache_mac.h" #include "base/singleton.h" #include "base/sys_string_conversions.h" #include "chrome/app/chrome_command_ids.h" @@ -235,12 +235,15 @@ class NotificationBridge : public NotificationObserver { // images loaded directly from nibs in a framework to not get their "template" // flags set properly. Thus, despite the images being set on the buttons in // the xib, we must set them in code. - [backButton_ setImage:nsimage_cache::ImageNamed(kBackButtonImageName)]; - [forwardButton_ setImage:nsimage_cache::ImageNamed(kForwardButtonImageName)]; - [reloadButton_ - setImage:nsimage_cache::ImageNamed(kReloadButtonReloadImageName)]; - [homeButton_ setImage:nsimage_cache::ImageNamed(kHomeButtonImageName)]; - [wrenchButton_ setImage:nsimage_cache::ImageNamed(kWrenchButtonImageName)]; + [backButton_ setImage:app::mac::GetCachedImageWithName(kBackButtonImageName)]; + [forwardButton_ setImage: + app::mac::GetCachedImageWithName(kForwardButtonImageName)]; + [reloadButton_ setImage: + app::mac::GetCachedImageWithName(kReloadButtonReloadImageName)]; + [homeButton_ setImage: + app::mac::GetCachedImageWithName(kHomeButtonImageName)]; + [wrenchButton_ setImage: + app::mac::GetCachedImageWithName(kWrenchButtonImageName)]; [self badgeWrenchMenuIfNeeded]; [backButton_ setShowsBorderOnlyWhileMouseInside:YES]; @@ -553,7 +556,8 @@ class NotificationBridge : public NotificationObserver { NSImage* badge = ResourceBundle::GetSharedInstance().GetNativeImageNamed(badgeResource); - NSImage* wrenchImage = nsimage_cache::ImageNamed(kWrenchButtonImageName); + NSImage* wrenchImage = + app::mac::GetCachedImageWithName(kWrenchButtonImageName); NSSize wrenchImageSize = [wrenchImage size]; NSSize badgeSize = [badge size]; diff --git a/chrome/browser/ui/cocoa/web_contents_drag_source.mm b/chrome/browser/ui/cocoa/web_contents_drag_source.mm index 072909a..68cfcfd 100644 --- a/chrome/browser/ui/cocoa/web_contents_drag_source.mm +++ b/chrome/browser/ui/cocoa/web_contents_drag_source.mm @@ -4,7 +4,7 @@ #import "chrome/browser/ui/cocoa/web_contents_drag_source.h" -#include "base/nsimage_cache_mac.h" +#include "app/mac/nsimage_cache.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" #include "chrome/browser/renderer_host/render_view_host.h" @@ -20,7 +20,7 @@ NSImage* MakeDragImage() { // WebKit/WebKit/mac/Misc/WebNSViewExtras.m: |-_web_DragImageForElement:...|). // Default to returning a generic image. - return nsimage_cache::ImageNamed(@"nav.pdf"); + return app::mac::GetCachedImageWithName(@"nav.pdf"); } // Flips screen and point coordinates over the y axis to work with webkit diff --git a/chrome/browser/ui/cocoa/web_drag_source.mm b/chrome/browser/ui/cocoa/web_drag_source.mm index cad5014..1fb4c7f 100644 --- a/chrome/browser/ui/cocoa/web_drag_source.mm +++ b/chrome/browser/ui/cocoa/web_drag_source.mm @@ -1,11 +1,11 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #import "chrome/browser/ui/cocoa/web_drag_source.h" +#include "app/mac/nsimage_cache.h" #include "base/file_path.h" -#include "base/nsimage_cache_mac.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" #include "base/task.h" @@ -406,7 +406,7 @@ void PromiseWriterTask::Run() { return dragImage_; // Default to returning a generic image. - return nsimage_cache::ImageNamed(@"nav.pdf"); + return app::mac::GetCachedImageWithName(@"nav.pdf"); } @end // @implementation WebDragSource (Private) diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index 901445a..5fc265e 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -15,7 +15,6 @@ #include "base/logging.h" #include "base/metrics/field_trial.h" #include "base/metrics/stats_table.h" -#include "base/nullable_string16.h" #include "base/process_util.h" #include "base/scoped_callback_factory.h" #include "base/shared_memory.h" diff --git a/chrome/renderer/render_thread.h b/chrome/renderer/render_thread.h index 2bd59db..6946a47 100644 --- a/chrome/renderer/render_thread.h +++ b/chrome/renderer/render_thread.h @@ -30,7 +30,6 @@ class FilePath; class GpuChannelHost; class IndexedDBDispatcher; class ListValue; -class NullableString16; class RendererHistogram; class RendererHistogramSnapshots; class RendererNetPredictor; diff --git a/webkit/glue/webcursor_mac.mm b/webkit/glue/webcursor_mac.mm index 1aeb1e0..4c3d69a 100644 --- a/webkit/glue/webcursor_mac.mm +++ b/webkit/glue/webcursor_mac.mm @@ -1,14 +1,14 @@ -// Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this -// source code is governed by a BSD-style license that can be found in the -// LICENSE file. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "webkit/glue/webcursor.h" #import <AppKit/AppKit.h> #include <Carbon/Carbon.h> +#include "app/mac/nsimage_cache.h" #include "base/logging.h" -#include "base/nsimage_cache_mac.h" #include "base/mac/scoped_cftyperef.h" #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" #include "third_party/WebKit/WebKit/chromium/public/WebImage.h" @@ -21,11 +21,11 @@ using WebKit::WebSize; namespace { // TODO: This image fetch can (and probably should) be serviced by the resource -// resource bundle instead of going through nsimage_cache. +// resource bundle instead of going through the image cache. NSCursor* LoadCursor(const char* name, int x, int y) { NSString* file_name = [NSString stringWithUTF8String:name]; DCHECK(file_name); - NSImage* cursor_image = nsimage_cache::ImageNamed(file_name); + NSImage* cursor_image = app::mac::GetCachedImageWithName(file_name); DCHECK(cursor_image); return [[[NSCursor alloc] initWithImage:cursor_image hotSpot:NSMakePoint(x, y)] autorelease]; |