diff options
Diffstat (limited to 'chrome/browser/ui')
17 files changed, 62 insertions, 57 deletions
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) |