diff options
-rw-r--r-- | base/base.gyp | 2 | ||||
-rw-r--r-- | base/nsimage_cache_mac.h (renamed from chrome/browser/cocoa/nsimage_cache.h) | 16 | ||||
-rw-r--r-- | base/nsimage_cache_mac.mm (renamed from chrome/browser/cocoa/nsimage_cache.mm) | 12 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_popup_view_mac.mm | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/blocked_popup_container_controller.mm | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_controller.mm | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_menu_bridge.mm | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/nsimage_cache_unittest.mm | 5 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_controller.mm | 1 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_strip_controller.mm | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_view.mm | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/toolbar_controller.mm | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/web_drag_source.mm | 2 | ||||
-rwxr-xr-x | chrome/chrome.gyp | 2 |
14 files changed, 32 insertions, 22 deletions
diff --git a/base/base.gyp b/base/base.gyp index 47818f5..bedc304 100644 --- a/base/base.gyp +++ b/base/base.gyp @@ -196,6 +196,8 @@ 'native_library_win.cc', 'non_thread_safe.cc', 'non_thread_safe.h', + 'nsimage_cache_mac.h', + 'nsimage_cache_mac.mm', 'nss_init.cc', 'nss_init.h', 'nullable_string16.h', diff --git a/chrome/browser/cocoa/nsimage_cache.h b/base/nsimage_cache_mac.h index 7085eef..ffa8dbb 100644 --- a/chrome/browser/cocoa/nsimage_cache.h +++ b/base/nsimage_cache_mac.h @@ -2,10 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_COCOA_NSIMAGE_CACHE_H_ -#define CHROME_BROWSER_COCOA_NSIMAGE_CACHE_H_ +#ifndef BASE_NSIMAGE_CACHE_MAC_H_ +#define BASE_NSIMAGE_CACHE_MAC_H_ -#import <Cocoa/Cocoa.h> +#ifdef __OBJC__ +@class NSImage; +@class NSString; +#else +class NSImage; +class NSString; +#endif namespace nsimage_cache { @@ -16,11 +22,11 @@ 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* ImageNamed(NSString* name); // Clears the cache. void Clear(void); } // namespace nsimage_cache -#endif // CHROME_BROWSER_COCOA_NSIMAGE_CACHE_H_ +#endif // BASE_NSIMAGE_CACHE_MAC_H_ diff --git a/chrome/browser/cocoa/nsimage_cache.mm b/base/nsimage_cache_mac.mm index feb0376..7ca05be 100644 --- a/chrome/browser/cocoa/nsimage_cache.mm +++ b/base/nsimage_cache_mac.mm @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/cocoa/nsimage_cache.h" +#include "base/nsimage_cache_mac.h" + +#import <AppKit/AppKit.h> #include "base/logging.h" #include "base/mac_util.h" @@ -18,9 +20,9 @@ namespace nsimage_cache { -static NSMutableDictionary *image_cache = nil; +static NSMutableDictionary* image_cache = nil; -NSImage *ImageNamed(NSString *name) { +NSImage* ImageNamed(NSString* name) { DCHECK(name); // NOTE: to make this thread safe, we'd have to sync on the cache and @@ -31,12 +33,12 @@ NSImage *ImageNamed(NSString *name) { DCHECK(image_cache); } - NSImage *result = [image_cache objectForKey:name]; + NSImage* result = [image_cache objectForKey:name]; if (!result) { DLOG_IF(INFO, [[name pathExtension] length] == 0) << "Suggest including the extension in the image name"; - NSString *path = [mac_util::MainAppBundle() pathForImageResource:name]; + NSString* path = [mac_util::MainAppBundle() pathForImageResource:name]; if (path) { @try { result = [[[NSImage alloc] initWithContentsOfFile:path] autorelease]; diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm index 6e468af..79c0b33 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm +++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm @@ -5,6 +5,7 @@ #include "chrome/browser/autocomplete/autocomplete_popup_view_mac.h" #include "app/gfx/text_elider.h" +#include "base/nsimage_cache_mac.h" #include "base/sys_string_conversions.h" #include "base/gfx/rect.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" @@ -12,7 +13,6 @@ #include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/bubble_positioner.h" #include "chrome/browser/cocoa/event_utils.h" -#include "chrome/browser/cocoa/nsimage_cache.h" namespace { diff --git a/chrome/browser/cocoa/blocked_popup_container_controller.mm b/chrome/browser/cocoa/blocked_popup_container_controller.mm index f84bb3a..9151750 100644 --- a/chrome/browser/cocoa/blocked_popup_container_controller.mm +++ b/chrome/browser/cocoa/blocked_popup_container_controller.mm @@ -5,9 +5,9 @@ #import "chrome/browser/cocoa/blocked_popup_container_controller.h" #include "app/l10n_util_mac.h" +#include "base/nsimage_cache_mac.h" #include "base/sys_string_conversions.h" #import "chrome/browser/cocoa/bubble_view.h" -#include "chrome/browser/cocoa/nsimage_cache.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/cocoa/bookmark_bar_controller.mm b/chrome/browser/cocoa/bookmark_bar_controller.mm index da36bc1..87b2925 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller.mm @@ -4,6 +4,7 @@ #include "app/l10n_util_mac.h" #include "base/mac_util.h" +#include "base/nsimage_cache_mac.h" #include "base/sys_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_editor.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -19,7 +20,6 @@ #import "chrome/browser/cocoa/event_utils.h" #import "chrome/browser/cocoa/menu_button.h" #import "chrome/browser/cocoa/view_resizer.h" -#include "chrome/browser/cocoa/nsimage_cache.h" #include "chrome/browser/profile.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" diff --git a/chrome/browser/cocoa/bookmark_menu_bridge.mm b/chrome/browser/cocoa/bookmark_menu_bridge.mm index 70a0983..dd06da6 100644 --- a/chrome/browser/cocoa/bookmark_menu_bridge.mm +++ b/chrome/browser/cocoa/bookmark_menu_bridge.mm @@ -5,6 +5,7 @@ #import <AppKit/AppKit.h> #include "app/l10n_util.h" +#include "base/nsimage_cache_mac.h" #include "base/sys_string_conversions.h" #include "chrome/app/chrome_dll_resource.h" // IDC_BOOKMARK_MENU #import "chrome/browser/app_controller_mac.h" @@ -13,7 +14,6 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/cocoa/bookmark_menu_bridge.h" #import "chrome/browser/cocoa/bookmark_menu_cocoa_controller.h" -#import "chrome/browser/cocoa/nsimage_cache.h" #include "chrome/browser/profile.h" #include "chrome/browser/profile_manager.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/cocoa/nsimage_cache_unittest.mm b/chrome/browser/cocoa/nsimage_cache_unittest.mm index 4c348d8..9ecf747 100644 --- a/chrome/browser/cocoa/nsimage_cache_unittest.mm +++ b/chrome/browser/cocoa/nsimage_cache_unittest.mm @@ -6,12 +6,15 @@ #include "base/file_path.h" #include "base/mac_util.h" +#include "base/nsimage_cache_mac.h" #include "base/path_service.h" -#include "chrome/browser/cocoa/nsimage_cache.h" #include "chrome/common/mac_app_names.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" +// This tests nsimage_cache, which lives in base/. The unit test is in +// chrome/ because it depends on having a built-up Chrome present. + namespace { class NSImageCacheTest : public PlatformTest { diff --git a/chrome/browser/cocoa/tab_controller.mm b/chrome/browser/cocoa/tab_controller.mm index 231164a..64207f9 100644 --- a/chrome/browser/cocoa/tab_controller.mm +++ b/chrome/browser/cocoa/tab_controller.mm @@ -3,7 +3,6 @@ // found in the LICENSE file. #include "base/mac_util.h" -#include "chrome/browser/cocoa/nsimage_cache.h" #import "chrome/browser/cocoa/tab_controller.h" #import "chrome/browser/cocoa/tab_controller_target.h" #import "chrome/browser/cocoa/tab_view.h" diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm index f431c93..411c04a 100644 --- a/chrome/browser/cocoa/tab_strip_controller.mm +++ b/chrome/browser/cocoa/tab_strip_controller.mm @@ -7,10 +7,10 @@ #include "app/l10n_util.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_dll_resource.h" #include "chrome/browser/browser.h" -#include "chrome/browser/cocoa/nsimage_cache.h" #include "chrome/browser/find_bar.h" #include "chrome/browser/find_bar_controller.h" #include "chrome/browser/metrics/user_metrics.h" diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm index 4d9bf82..596bfe9 100644 --- a/chrome/browser/cocoa/tab_view.mm +++ b/chrome/browser/cocoa/tab_view.mm @@ -5,7 +5,7 @@ #import "chrome/browser/cocoa/tab_view.h" #include "base/logging.h" -#include "chrome/browser/cocoa/nsimage_cache.h" +#include "base/nsimage_cache_mac.h" #import "chrome/browser/cocoa/tab_controller.h" #import "chrome/browser/cocoa/tab_window_controller.h" diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm index 579c5da..c36d9e1 100644 --- a/chrome/browser/cocoa/toolbar_controller.mm +++ b/chrome/browser/cocoa/toolbar_controller.mm @@ -6,6 +6,7 @@ #include "app/l10n_util_mac.h" #include "base/mac_util.h" +#include "base/nsimage_cache_mac.h" #include "base/sys_string_conversions.h" #include "base/gfx/rect.h" #include "chrome/app/chrome_dll_resource.h" @@ -18,7 +19,6 @@ #import "chrome/browser/cocoa/gradient_button_cell.h" #import "chrome/browser/cocoa/location_bar_view_mac.h" #import "chrome/browser/cocoa/menu_button.h" -#include "chrome/browser/cocoa/nsimage_cache.h" #include "chrome/browser/profile.h" #include "chrome/browser/search_engines/template_url_model.h" #include "chrome/browser/toolbar_model.h" diff --git a/chrome/browser/cocoa/web_drag_source.mm b/chrome/browser/cocoa/web_drag_source.mm index f4461d4..1d82218 100644 --- a/chrome/browser/cocoa/web_drag_source.mm +++ b/chrome/browser/cocoa/web_drag_source.mm @@ -5,12 +5,12 @@ #import "chrome/browser/cocoa/web_drag_source.h" #include "base/file_util.h" +#include "base/nsimage_cache_mac.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" #include "base/task.h" #include "base/thread.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/cocoa/nsimage_cache.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view_mac.h" diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 6e5ee7c..b5a2dd2 100755 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -1074,8 +1074,6 @@ 'browser/cocoa/location_bar_view_mac.mm', 'browser/cocoa/menu_button.h', 'browser/cocoa/menu_button.mm', - 'browser/cocoa/nsimage_cache.h', - 'browser/cocoa/nsimage_cache.mm', 'browser/cocoa/nswindow_local_state.h', 'browser/cocoa/nswindow_local_state.mm', 'browser/cocoa/page_info_window_controller.h', |