diff options
Diffstat (limited to 'chrome/browser')
29 files changed, 39 insertions, 42 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm index 482c676..4030342 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm @@ -24,6 +24,7 @@ #import "third_party/mozilla/NSPasteboard+Utils.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" #include "ui/gfx/rect.h" // Focus-handling between |field_| and |model_| is a bit subtle. diff --git a/chrome/browser/autofill/autofill_dialog_controller_mac.mm b/chrome/browser/autofill/autofill_dialog_controller_mac.mm index b046704..74f4249 100644 --- a/chrome/browser/autofill/autofill_dialog_controller_mac.mm +++ b/chrome/browser/autofill/autofill_dialog_controller_mac.mm @@ -26,6 +26,7 @@ #include "grit/theme_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" namespace { diff --git a/chrome/browser/page_info_model.cc b/chrome/browser/page_info_model.cc index c8d327d..b8ce79a 100644 --- a/chrome/browser/page_info_model.cc +++ b/chrome/browser/page_info_model.cc @@ -23,10 +23,6 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" -#if defined(OS_MACOSX) -#include "base/mac/mac_util.h" -#endif - PageInfoModel::PageInfoModel(Profile* profile, const GURL& url, const NavigationEntry::SSLStatus& ssl, @@ -280,16 +276,6 @@ PageInfoModel::PageInfoModel(Profile* profile, } } -PageInfoModel::~PageInfoModel() { -#if defined(OS_MACOSX) - // Release the NSImages. - for (std::vector<gfx::NativeImage>::iterator it = icons_.begin(); - it != icons_.end(); ++it) { - base::mac::NSObjectRelease(*it); - } -#endif -} - int PageInfoModel::GetSectionCount() { return sections_.size(); } @@ -299,7 +285,7 @@ PageInfoModel::SectionInfo PageInfoModel::GetSectionInfo(int index) { return sections_[index]; } -gfx::NativeImage PageInfoModel::GetIconImage(SectionStateIcon icon_id) { +gfx::Image* PageInfoModel::GetIconImage(SectionStateIcon icon_id) { if (icon_id == ICON_NONE) return NULL; // The bubble uses new, various icons. @@ -350,20 +336,10 @@ PageInfoModel::PageInfoModel() : observer_(NULL) { void PageInfoModel::Init() { // Loads the icons into the vector. The order must match the SectionStateIcon // enum. - icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_GOOD)); - icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_WARNING_MINOR)); - icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_WARNING_MAJOR)); - icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_BAD)); - icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_INFO)); -} - -gfx::NativeImage PageInfoModel::GetBitmapNamed(int resource_id) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - gfx::NativeImage image = rb.GetNativeImageNamed(resource_id); -#if defined(OS_MACOSX) - // Unlike other platforms, the Mac ResourceBundle does not keep a shared image - // cache. These are released in the dtor. - base::mac::NSObjectRetain(image); -#endif - return image; + icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_GOOD)); + icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_WARNING_MINOR)); + icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_WARNING_MAJOR)); + icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_BAD)); + icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_INFO)); } diff --git a/chrome/browser/page_info_model.h b/chrome/browser/page_info_model.h index df7d986..9490385 100644 --- a/chrome/browser/page_info_model.h +++ b/chrome/browser/page_info_model.h @@ -13,7 +13,7 @@ #include "chrome/browser/history/history.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "googleurl/src/gurl.h" -#include "ui/gfx/native_widget_types.h" +#include "ui/gfx/image.h" class PrefService; class Profile; @@ -82,13 +82,12 @@ class PageInfoModel { const NavigationEntry::SSLStatus& ssl, bool show_history, PageInfoModelObserver* observer); - ~PageInfoModel(); int GetSectionCount(); SectionInfo GetSectionInfo(int index); // Returns the native image type for an icon with the given id. - gfx::NativeImage GetIconImage(SectionStateIcon icon_id); + gfx::Image* GetIconImage(SectionStateIcon icon_id); // Callback from history service with number of visits to url. void OnGotVisitCountToHost(HistoryService::Handle handle, @@ -103,16 +102,12 @@ class PageInfoModel { // Shared initialization for default and testing constructor. void Init(); - // Wrapper for ResourceBundle::GetNativeImage() so that Mac can retain its - // icons. - gfx::NativeImage GetBitmapNamed(int resource_id); - PageInfoModelObserver* observer_; std::vector<SectionInfo> sections_; // All possible icons that go next to the text descriptions to indicate state. - std::vector<gfx::NativeImage> icons_; + std::vector<gfx::Image*> icons_; // Used to request number of visits. CancelableRequestConsumer request_consumer_; diff --git a/chrome/browser/ui/cocoa/about_window_controller.mm b/chrome/browser/ui/cocoa/about_window_controller.mm index af08577..788e26c 100644 --- a/chrome/browser/ui/cocoa/about_window_controller.mm +++ b/chrome/browser/ui/cocoa/about_window_controller.mm @@ -25,6 +25,7 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util_mac.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" namespace { diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm index dc6f91e..2a5dc83 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm @@ -49,6 +49,7 @@ #include "skia/ext/skia_utils_mac.h" #include "ui/base/l10n/l10n_util_mac.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" // Bookmark bar state changing and animations // diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell_unittest.mm index f3663b4..6460ebf 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell_unittest.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell_unittest.mm @@ -13,6 +13,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" // Simple class to remember how many mouseEntered: and mouseExited: // calls it gets. Only used by BookmarkMouseForwarding but placed diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.mm index 142bad0..41d2359 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.mm @@ -19,6 +19,7 @@ #include "skia/ext/skia_utils_mac.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" BookmarkMenuBridge::BookmarkMenuBridge(Profile* profile) : menuIsValid_(false), diff --git a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm index 3c94801..302d4c7 100644 --- a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm +++ b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm @@ -22,6 +22,7 @@ #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" #include "ui/base/l10n/l10n_util_mac.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" namespace { // Colors for the infobar. diff --git a/chrome/browser/ui/cocoa/download/download_item_controller.mm b/chrome/browser/ui/cocoa/download/download_item_controller.mm index d8ab8ad..1bc1e1e 100644 --- a/chrome/browser/ui/cocoa/download/download_item_controller.mm +++ b/chrome/browser/ui/cocoa/download/download_item_controller.mm @@ -27,6 +27,7 @@ #include "ui/base/l10n/l10n_util_mac.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/text/text_elider.h" +#include "ui/gfx/image.h" namespace { diff --git a/chrome/browser/ui/cocoa/download/download_shelf_controller.mm b/chrome/browser/ui/cocoa/download/download_shelf_controller.mm index fea1940..26d00fc 100644 --- a/chrome/browser/ui/cocoa/download/download_shelf_controller.mm +++ b/chrome/browser/ui/cocoa/download/download_shelf_controller.mm @@ -23,6 +23,7 @@ #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" // Download shelf autoclose behavior: // diff --git a/chrome/browser/ui/cocoa/download/download_started_animation_mac.mm b/chrome/browser/ui/cocoa/download/download_started_animation_mac.mm index beff0a6c..ae84cbf 100644 --- a/chrome/browser/ui/cocoa/download/download_started_animation_mac.mm +++ b/chrome/browser/ui/cocoa/download/download_started_animation_mac.mm @@ -21,6 +21,7 @@ #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" #include "third_party/skia/include/utils/mac/SkCGUtils.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" class DownloadAnimationTabObserver; diff --git a/chrome/browser/ui/cocoa/history_menu_bridge.mm b/chrome/browser/ui/cocoa/history_menu_bridge.mm index ea5a8b5..14fa62c 100644 --- a/chrome/browser/ui/cocoa/history_menu_bridge.mm +++ b/chrome/browser/ui/cocoa/history_menu_bridge.mm @@ -26,6 +26,7 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/codec/png_codec.h" +#include "ui/gfx/image.h" namespace { diff --git a/chrome/browser/ui/cocoa/hover_image_button_unittest.mm b/chrome/browser/ui/cocoa/hover_image_button_unittest.mm index 6d68d0f..b34bf98b 100644 --- a/chrome/browser/ui/cocoa/hover_image_button_unittest.mm +++ b/chrome/browser/ui/cocoa/hover_image_button_unittest.mm @@ -11,6 +11,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" namespace { diff --git a/chrome/browser/ui/cocoa/hung_renderer_controller.mm b/chrome/browser/ui/cocoa/hung_renderer_controller.mm index 652fc08..0f1681d 100644 --- a/chrome/browser/ui/cocoa/hung_renderer_controller.mm +++ b/chrome/browser/ui/cocoa/hung_renderer_controller.mm @@ -26,6 +26,7 @@ #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" #include "ui/base/l10n/l10n_util_mac.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" namespace { // We only support showing one of these at a time per app. The diff --git a/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm b/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm index da3475d..61d4d38 100644 --- a/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm +++ b/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm @@ -22,6 +22,7 @@ #include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" namespace { diff --git a/chrome/browser/ui/cocoa/options/cookies_window_controller.mm b/chrome/browser/ui/cocoa/options/cookies_window_controller.mm index b6a1a92..9cadaa9 100644 --- a/chrome/browser/ui/cocoa/options/cookies_window_controller.mm +++ b/chrome/browser/ui/cocoa/options/cookies_window_controller.mm @@ -20,6 +20,7 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/l10n/l10n_util_mac.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" // Key path used for notifying KVO. static NSString* const kCocoaTreeModel = @"cocoaTreeModel"; diff --git a/chrome/browser/ui/cocoa/options/edit_search_engine_cocoa_controller.mm b/chrome/browser/ui/cocoa/options/edit_search_engine_cocoa_controller.mm index a77d2ae..a4890a1 100644 --- a/chrome/browser/ui/cocoa/options/edit_search_engine_cocoa_controller.mm +++ b/chrome/browser/ui/cocoa/options/edit_search_engine_cocoa_controller.mm @@ -15,6 +15,7 @@ #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" #include "ui/base/l10n/l10n_util_mac.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" namespace { diff --git a/chrome/browser/ui/cocoa/options/preferences_window_controller.mm b/chrome/browser/ui/cocoa/options/preferences_window_controller.mm index 9c18e64..56efde9 100644 --- a/chrome/browser/ui/cocoa/options/preferences_window_controller.mm +++ b/chrome/browser/ui/cocoa/options/preferences_window_controller.mm @@ -65,6 +65,7 @@ #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" #include "ui/base/l10n/l10n_util_mac.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" namespace { diff --git a/chrome/browser/ui/cocoa/page_info_bubble_controller.mm b/chrome/browser/ui/cocoa/page_info_bubble_controller.mm index d79ef5c..1108a98 100644 --- a/chrome/browser/ui/cocoa/page_info_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/page_info_bubble_controller.mm @@ -25,6 +25,7 @@ #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util_mac.h" +#include "ui/gfx/image.h" @interface PageInfoBubbleController (Private) - (PageInfoModel*)model; @@ -402,7 +403,7 @@ void ShowPageInfoBubble(gfx::NativeWindow parent, scoped_nsobject<NSImageView> imageView( [[NSImageView alloc] initWithFrame:frame]); [imageView setImageFrameStyle:NSImageFrameNone]; - [imageView setImage:model_->GetIconImage(info.icon_id)]; + [imageView setImage:*model_->GetIconImage(info.icon_id)]; [subviews addObject:imageView.get()]; } diff --git a/chrome/browser/ui/cocoa/search_engine_dialog_controller.mm b/chrome/browser/ui/cocoa/search_engine_dialog_controller.mm index 6c5757e..51b1684 100644 --- a/chrome/browser/ui/cocoa/search_engine_dialog_controller.mm +++ b/chrome/browser/ui/cocoa/search_engine_dialog_controller.mm @@ -18,6 +18,7 @@ #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" #include "ui/base/l10n/l10n_util_mac.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" // Horizontal spacing between search engine choices. const int kSearchEngineSpacing = 20; diff --git a/chrome/browser/ui/cocoa/speech_input_window_controller.mm b/chrome/browser/ui/cocoa/speech_input_window_controller.mm index 000424d..a36577a 100644 --- a/chrome/browser/ui/cocoa/speech_input_window_controller.mm +++ b/chrome/browser/ui/cocoa/speech_input_window_controller.mm @@ -13,6 +13,7 @@ #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" #include "ui/base/l10n/l10n_util_mac.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" const int kBubbleControlVerticalSpacing = 10; // Space between controls. const int kBubbleHorizontalMargin = 5; // Space on either sides of controls. diff --git a/chrome/browser/ui/cocoa/tab_contents/sad_tab_view.mm b/chrome/browser/ui/cocoa/tab_contents/sad_tab_view.mm index 666ebff..e76ab40 100644 --- a/chrome/browser/ui/cocoa/tab_contents/sad_tab_view.mm +++ b/chrome/browser/ui/cocoa/tab_contents/sad_tab_view.mm @@ -9,6 +9,7 @@ #include "grit/theme_resources.h" #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" // Offset above vertical middle of page where contents of page start. static const CGFloat kSadTabOffset = -64; diff --git a/chrome/browser/ui/cocoa/tabpose_window.mm b/chrome/browser/ui/cocoa/tabpose_window.mm index 65556aa..294f6f1 100644 --- a/chrome/browser/ui/cocoa/tabpose_window.mm +++ b/chrome/browser/ui/cocoa/tabpose_window.mm @@ -34,6 +34,7 @@ #include "skia/ext/skia_utils_mac.h" #include "third_party/skia/include/utils/mac/SkCGUtils.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" #include "ui/gfx/scoped_cg_context_state_mac.h" const int kTopGradientHeight = 15; diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm index c7468e3..4311bda6 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm @@ -49,6 +49,7 @@ #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" NSString* const kTabStripNumberOfTabsChanged = @"kTabStripNumberOfTabsChanged"; diff --git a/chrome/browser/ui/cocoa/tabs/throbber_view_unittest.mm b/chrome/browser/ui/cocoa/tabs/throbber_view_unittest.mm index e09ef42..35c3511 100644 --- a/chrome/browser/ui/cocoa/tabs/throbber_view_unittest.mm +++ b/chrome/browser/ui/cocoa/tabs/throbber_view_unittest.mm @@ -11,6 +11,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image.h" namespace { diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm index bc0de9a..b5c677e 100644 --- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm +++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm @@ -57,6 +57,7 @@ #include "ui/base/models/menu_model.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/rect.h" +#include "ui/gfx/image.h" namespace { diff --git a/chrome/browser/ui/gtk/page_info_bubble_gtk.cc b/chrome/browser/ui/gtk/page_info_bubble_gtk.cc index ffac6d6..f28202f 100644 --- a/chrome/browser/ui/gtk/page_info_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/page_info_bubble_gtk.cc @@ -214,7 +214,7 @@ GtkWidget* PageInfoBubbleGtk::CreateSection( const PageInfoModel::SectionInfo& section) { GtkWidget* section_box = gtk_hbox_new(FALSE, gtk_util::kControlSpacing); - GdkPixbuf* pixbuf = model_.GetIconImage(section.icon_id); + GdkPixbuf* pixbuf = *model_.GetIconImage(section.icon_id); if (pixbuf) { GtkWidget* image = gtk_image_new_from_pixbuf(pixbuf); gtk_box_pack_start(GTK_BOX(section_box), image, FALSE, FALSE, 0); diff --git a/chrome/browser/ui/views/page_info_bubble_view.cc b/chrome/browser/ui/views/page_info_bubble_view.cc index a062d15..dce2d6b 100644 --- a/chrome/browser/ui/views/page_info_bubble_view.cc +++ b/chrome/browser/ui/views/page_info_bubble_view.cc @@ -16,6 +16,7 @@ #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/gfx/image.h" #include "views/controls/image_view.h" #include "views/controls/label.h" #include "views/controls/separator.h" @@ -142,7 +143,7 @@ void PageInfoBubbleView::LayoutSections() { for (int i = 0; i < count; ++i) { PageInfoModel::SectionInfo info = model_.GetSectionInfo(i); layout->StartRow(0, 0); - const SkBitmap* icon = model_.GetIconImage(info.icon_id); + const SkBitmap* icon = *model_.GetIconImage(info.icon_id); layout->AddView(new Section(this, info, icon, cert_id_ > 0)); // Add separator after all sections. @@ -168,7 +169,7 @@ gfx::Size PageInfoBubbleView::GetPreferredSize() { int count = model_.GetSectionCount(); for (int i = 0; i < count; ++i) { PageInfoModel::SectionInfo info = model_.GetSectionInfo(i); - const SkBitmap* icon = model_.GetIconImage(info.icon_id); + const SkBitmap* icon = *model_.GetIconImage(info.icon_id); Section section(this, info, icon, cert_id_ > 0); size.Enlarge(0, section.GetHeightForWidth(size.width())); } |