diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-07 01:04:11 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-07 01:04:11 +0000 |
commit | a87200d7c6a240a623a79d7d987ff50b32fc42ed (patch) | |
tree | 9592da1528653683dab55eb2201c20894abd1f15 | |
parent | b41d6b5a9976f7586e4c83b5b2af3979339cc002 (diff) | |
download | chromium_src-a87200d7c6a240a623a79d7d987ff50b32fc42ed.zip chromium_src-a87200d7c6a240a623a79d7d987ff50b32fc42ed.tar.gz chromium_src-a87200d7c6a240a623a79d7d987ff50b32fc42ed.tar.bz2 |
Switch to using gfx::Image instead of ImageSkia for cross-platform message_center code.
BUG=179916
Review URL: https://chromiumcodereview.appspot.com/12499002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186560 0039d316-1c4b-4281-b951-d872f2087c98
23 files changed, 72 insertions, 68 deletions
diff --git a/chrome/browser/chromeos/extensions/file_browser_notifications.cc b/chrome/browser/chromeos/extensions/file_browser_notifications.cc index e9ac63f..9759edb 100644 --- a/chrome/browser/chromeos/extensions/file_browser_notifications.cc +++ b/chrome/browser/chromeos/extensions/file_browser_notifications.cc @@ -175,8 +175,8 @@ class FileBrowserNotifications::NotificationMessage { const std::string& notification_id, const string16& message) : message_(message) { - const gfx::ImageSkia& icon = - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + const gfx::Image& icon = + ResourceBundle::GetSharedInstance().GetNativeImageNamed( GetIconId(type)); // TODO(mukai): refactor here to invoke NotificationUIManager directly. const string16 replace_id = UTF8ToUTF16(notification_id); diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc index ccfe8b5..d170b68 100644 --- a/chrome/browser/notifications/desktop_notification_service.cc +++ b/chrome/browser/notifications/desktop_notification_service.cc @@ -283,7 +283,7 @@ std::string DesktopNotificationService::AddIconNotification( const GURL& origin_url, const string16& title, const string16& message, - const gfx::ImageSkia& icon, + const gfx::Image& icon, const string16& replace_id, NotificationDelegate* delegate, Profile* profile) { @@ -296,8 +296,8 @@ std::string DesktopNotificationService::AddIconNotification( return notification.notification_id(); #else GURL icon_url; - if (!icon.isNull()) - icon_url = GURL(webui::GetBitmapDataUrl(*icon.bitmap())); + if (!icon.IsEmpty()) + icon_url = GURL(webui::GetBitmapDataUrl(*icon.ToSkBitmap())); return AddNotification( origin_url, title, message, icon_url, replace_id, delegate, profile); #endif diff --git a/chrome/browser/notifications/desktop_notification_service.h b/chrome/browser/notifications/desktop_notification_service.h index 1fed507..16739b1 100644 --- a/chrome/browser/notifications/desktop_notification_service.h +++ b/chrome/browser/notifications/desktop_notification_service.h @@ -35,7 +35,7 @@ struct ShowDesktopNotificationHostMsgParams; } namespace gfx { -class ImageSkia; +class Image; } // The DesktopNotificationService is an object, owned by the Profile, @@ -115,11 +115,11 @@ class DesktopNotificationService : public content::NotificationObserver, NotificationDelegate* delegate, Profile* profile); - // Same as above, but takes a gfx::ImageSkia for the icon instead. + // Same as above, but takes a gfx::Image for the icon instead. static std::string AddIconNotification(const GURL& origin_url, const string16& title, const string16& message, - const gfx::ImageSkia& icon, + const gfx::Image& icon, const string16& replace_id, NotificationDelegate* delegate, Profile* profile); diff --git a/chrome/browser/notifications/message_center_notification_manager.cc b/chrome/browser/notifications/message_center_notification_manager.cc index bed0554..347f26b 100644 --- a/chrome/browser/notifications/message_center_notification_manager.cc +++ b/chrome/browser/notifications/message_center_notification_manager.cc @@ -279,12 +279,12 @@ void MessageCenterNotificationManager::ImageDownloads::StartDownloads( void MessageCenterNotificationManager::ImageDownloads::StartDownloadWithImage( const Notification& notification, - const gfx::ImageSkia* image, + const gfx::Image* image, const GURL& url, int size, const SetImageCallback& callback) { // Set the image directly if we have it. - if (image && !image->isNull()) { + if (image && !image->IsEmpty()) { callback.Run(*image); return; } @@ -336,7 +336,7 @@ void MessageCenterNotificationManager::ImageDownloads::DownloadComplete( const std::vector<SkBitmap>& bitmaps) { if (bitmaps.empty()) return; - gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmaps[0]); + gfx::Image image = gfx::Image::CreateFrom1xBitmap(bitmaps[0]); callback.Run(image); } diff --git a/chrome/browser/notifications/message_center_notification_manager.h b/chrome/browser/notifications/message_center_notification_manager.h index fd0e80b..e25377f 100644 --- a/chrome/browser/notifications/message_center_notification_manager.h +++ b/chrome/browser/notifications/message_center_notification_manager.h @@ -55,7 +55,7 @@ class MessageCenterNotificationManager int button_index) OVERRIDE; private: - typedef base::Callback<void(const gfx::ImageSkia&)> SetImageCallback; + typedef base::Callback<void(const gfx::Image&)> SetImageCallback; class ImageDownloads : public base::SupportsWeakPtr<ImageDownloads> { public: @@ -64,7 +64,7 @@ class MessageCenterNotificationManager void StartDownloads(const Notification& notification); void StartDownloadWithImage(const Notification& notification, - const gfx::ImageSkia* image, + const gfx::Image* image, const GURL& url, int size, const SetImageCallback& callback); diff --git a/chrome/browser/notifications/message_center_settings_controller.cc b/chrome/browser/notifications/message_center_settings_controller.cc index b198d89..261e076 100644 --- a/chrome/browser/notifications/message_center_settings_controller.cc +++ b/chrome/browser/notifications/message_center_settings_controller.cc @@ -154,7 +154,7 @@ void MessageCenterSettingsController::OnFaviconLoaded( const history::FaviconImageResult& favicon_result) { if (!settings_view_) return; - settings_view_->UpdateFavicon(url, favicon_result.image.AsImageSkia()); + settings_view_->UpdateFavicon(url, favicon_result.image); } diff --git a/chrome/browser/notifications/message_center_settings_controller.h b/chrome/browser/notifications/message_center_settings_controller.h index 69d7fcc..54e4806 100644 --- a/chrome/browser/notifications/message_center_settings_controller.h +++ b/chrome/browser/notifications/message_center_settings_controller.h @@ -8,6 +8,7 @@ #include <vector> #include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" #include "chrome/browser/extensions/app_icon_loader.h" #include "chrome/browser/history/history_types.h" #include "ui/message_center/notifier_settings_view_delegate.h" diff --git a/chrome/browser/notifications/notification.cc b/chrome/browser/notifications/notification.cc index ffb2871..de9d158 100644 --- a/chrome/browser/notifications/notification.cc +++ b/chrome/browser/notifications/notification.cc @@ -71,7 +71,7 @@ Notification::Notification(message_center::NotificationType type, } Notification::Notification(const GURL& origin_url, - const gfx::ImageSkia& icon, + const gfx::Image& icon, const string16& title, const string16& body, WebKit::WebTextDirection dir, diff --git a/chrome/browser/notifications/notification.h b/chrome/browser/notifications/notification.h index c5658a7..0811f58 100644 --- a/chrome/browser/notifications/notification.h +++ b/chrome/browser/notifications/notification.h @@ -14,7 +14,7 @@ #include "chrome/browser/notifications/notification_delegate.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" -#include "ui/gfx/image/image_skia.h" +#include "ui/gfx/image/image.h" #include "ui/message_center/notification_types.h" // Representation of a notification to be shown to the user. @@ -57,7 +57,7 @@ class Notification { // Initializes a notification with text content and an icon image. Currently // only used on Ash. Does not generate content_url_. Notification(const GURL& origin_url, - const gfx::ImageSkia& icon, + const gfx::Image& icon, const string16& title, const string16& body, WebKit::WebTextDirection dir, @@ -90,7 +90,7 @@ class Notification { const GURL& icon_url() const { return icon_url_; } // An image for the icon to be shown (optional). - const gfx::ImageSkia& icon() const { return icon_; } + const gfx::Image& icon() const { return icon_; } // A display string for the source of the notification. const string16& display_source() const { return display_source_; } @@ -124,7 +124,7 @@ class Notification { GURL origin_url_; // Image data for the associated icon, used by Ash when available. - gfx::ImageSkia icon_; + gfx::Image icon_; // URL for the icon associated with the notification. Requires delegate_ // to have a non NULL RenderViewHost. diff --git a/chrome/browser/status_icons/desktop_notification_balloon.cc b/chrome/browser/status_icons/desktop_notification_balloon.cc index 09b3124..e5c8caa 100644 --- a/chrome/browser/status_icons/desktop_notification_balloon.cc +++ b/chrome/browser/status_icons/desktop_notification_balloon.cc @@ -82,6 +82,6 @@ void DesktopNotificationBalloon::DisplayBalloon(const gfx::ImageSkia& icon, profile = ProfileManager::GetLastUsedProfile(); } notification_id_ = DesktopNotificationService::AddIconNotification( - GURL(), title, contents, icon, string16(), + GURL(), title, contents, gfx::Image(icon), string16(), new DummyNotificationDelegate(base::IntToString(id_count_++)), profile); } diff --git a/chrome/browser/ui/views/ash/balloon_view_ash.cc b/chrome/browser/ui/views/ash/balloon_view_ash.cc index b7d31fe..a9cb9d7 100644 --- a/chrome/browser/ui/views/ash/balloon_view_ash.cc +++ b/chrome/browser/ui/views/ash/balloon_view_ash.cc @@ -20,7 +20,8 @@ #include "content/public/browser/web_contents_observer.h" #include "ipc/ipc_message.h" #include "ipc/ipc_message_macros.h" -#include "ui/gfx/image/image_skia.h" +#include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/image/image.h" #include "ui/message_center/message_center.h" #include "ui/message_center/message_center_constants.h" #include "ui/message_center/notification_types.h" @@ -28,7 +29,7 @@ namespace { -typedef base::Callback<void(const gfx::ImageSkia&)> SetImageCallback; +typedef base::Callback<void(const gfx::Image&)> SetImageCallback; const int kPrimaryIconImageSize = 64; const int kSecondaryIconImageSize = 15; @@ -103,7 +104,7 @@ void BalloonViewAsh::ImageDownload::Downloaded( const std::vector<SkBitmap>& bitmaps) { if (bitmaps.empty()) return; - gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmaps[0]); + gfx::Image image = gfx::Image::CreateFrom1xBitmap(bitmaps[0]); callback_.Run(image); } @@ -161,19 +162,19 @@ BalloonHost* BalloonViewAsh::GetHost() const { } void BalloonViewAsh::SetNotificationIcon(const std::string& notification_id, - const gfx::ImageSkia& image) { + const gfx::Image& image) { GetMessageCenter()->SetNotificationIcon(notification_id, image); } void BalloonViewAsh::SetNotificationImage(const std::string& notification_id, - const gfx::ImageSkia& image) { + const gfx::Image& image) { GetMessageCenter()->SetNotificationImage(notification_id, image); } void BalloonViewAsh::SetNotificationButtonIcon( const std::string& notification_id, int button_index, - const gfx::ImageSkia& image) { + const gfx::Image& image) { GetMessageCenter()->SetNotificationButtonIcon(notification_id, button_index, image); } @@ -183,7 +184,7 @@ void BalloonViewAsh::DownloadImages(const Notification& notification) { downloads_.clear(); // Set the notification's primary icon, or start a download for it. - if (!notification.icon().isNull()) { + if (!notification.icon().IsEmpty()) { SetNotificationIcon(notification_id_, notification.icon()); } else if (!notification.icon_url().is_empty()) { downloads_.push_back(linked_ptr<ImageDownload>(new ImageDownload( diff --git a/chrome/browser/ui/views/ash/balloon_view_ash.h b/chrome/browser/ui/views/ash/balloon_view_ash.h index ea4fde7..032bc52 100644 --- a/chrome/browser/ui/views/ash/balloon_view_ash.h +++ b/chrome/browser/ui/views/ash/balloon_view_ash.h @@ -11,7 +11,7 @@ #include "chrome/browser/notifications/balloon.h" namespace gfx { -class ImageSkia; +class Image; } // On Ash, a "BalloonView" is just a wrapper for ash notification entries. @@ -29,12 +29,12 @@ class BalloonViewAsh : public BalloonView { virtual BalloonHost* GetHost() const OVERRIDE; void SetNotificationIcon(const std::string& notification_id, - const gfx::ImageSkia& image); + const gfx::Image& image); void SetNotificationImage(const std::string& notification_id, - const gfx::ImageSkia& image); + const gfx::Image& image); void SetNotificationButtonIcon(const std::string& notification_id, int button_index, - const gfx::ImageSkia& image); + const gfx::Image& image); private: class ImageDownload; diff --git a/ui/message_center/message_center.cc b/ui/message_center/message_center.cc index 97f05ce..29492a8 100644 --- a/ui/message_center/message_center.cc +++ b/ui/message_center/message_center.cc @@ -106,20 +106,20 @@ void MessageCenter::RemoveNotification(const std::string& id) { } void MessageCenter::SetNotificationIcon(const std::string& notification_id, - const gfx::ImageSkia& image) { + const gfx::Image& image) { if (notification_list_->SetNotificationIcon(notification_id, image)) NotifyMessageCenterChanged(true); } void MessageCenter::SetNotificationImage(const std::string& notification_id, - const gfx::ImageSkia& image) { + const gfx::Image& image) { if (notification_list_->SetNotificationImage(notification_id, image)) NotifyMessageCenterChanged(true); } void MessageCenter::SetNotificationButtonIcon( const std::string& notification_id, int button_index, - const gfx::ImageSkia& image) { + const gfx::Image& image) { if (notification_list_->SetNotificationButtonIcon(notification_id, button_index, image)) NotifyMessageCenterChanged(true); diff --git a/ui/message_center/message_center.h b/ui/message_center/message_center.h index a78c151..a0c6e94 100644 --- a/ui/message_center/message_center.h +++ b/ui/message_center/message_center.h @@ -133,14 +133,14 @@ class MESSAGE_CENTER_EXPORT MessageCenter : public NotificationList::Delegate { void RemoveNotification(const std::string& id); void SetNotificationIcon(const std::string& notification_id, - const gfx::ImageSkia& image); + const gfx::Image& image); void SetNotificationImage(const std::string& notification_id, - const gfx::ImageSkia& image); + const gfx::Image& image); void SetNotificationButtonIcon(const std::string& notification_id, int button_index, - const gfx::ImageSkia& image); + const gfx::Image& image); NotificationList* notification_list() { return notification_list_.get(); } bool quiet_mode() const { return notification_list_->quiet_mode(); } diff --git a/ui/message_center/notification.cc b/ui/message_center/notification.cc index 5a92c09..4bd1911 100644 --- a/ui/message_center/notification.cc +++ b/ui/message_center/notification.cc @@ -48,7 +48,7 @@ Notification::Notification(NotificationType type, Notification::~Notification() { } -bool Notification::SetButtonIcon(size_t index, const gfx::ImageSkia& icon) { +bool Notification::SetButtonIcon(size_t index, const gfx::Image& icon) { if (index >= buttons_.size()) return false; buttons_[index].icon = icon; diff --git a/ui/message_center/notification.h b/ui/message_center/notification.h index 36e4504..2aed7d5 100644 --- a/ui/message_center/notification.h +++ b/ui/message_center/notification.h @@ -11,7 +11,7 @@ #include "base/string16.h" #include "base/time.h" #include "base/values.h" -#include "ui/gfx/image/image_skia.h" +#include "ui/gfx/image/image.h" #include "ui/message_center/message_center_export.h" #include "ui/message_center/notification_types.h" @@ -26,7 +26,7 @@ struct MESSAGE_CENTER_EXPORT NotificationItem { struct MESSAGE_CENTER_EXPORT ButtonInfo { string16 title; - gfx::ImageSkia icon; + gfx::Image icon; ButtonInfo(const string16& title); }; @@ -57,15 +57,15 @@ class MESSAGE_CENTER_EXPORT Notification { // End unpacked values. // Images fetched asynchronously. - const gfx::ImageSkia& primary_icon() const { return primary_icon_; } - void set_primary_icon(const gfx::ImageSkia& icon) { primary_icon_ = icon; } + const gfx::Image& primary_icon() const { return primary_icon_; } + void set_primary_icon(const gfx::Image& icon) { primary_icon_ = icon; } - const gfx::ImageSkia& image() const { return image_; } - void set_image(const gfx::ImageSkia& image) { image_ = image; } + const gfx::Image& image() const { return image_; } + void set_image(const gfx::Image& image) { image_ = image; } // Buttons, with icons fetched asynchronously. const std::vector<ButtonInfo>& buttons() const { return buttons_; } - bool SetButtonIcon(size_t index, const gfx::ImageSkia& icon); + bool SetButtonIcon(size_t index, const gfx::Image& icon); // Status in MessageCenter. bool is_read() const { return is_read_; } @@ -96,8 +96,8 @@ class MESSAGE_CENTER_EXPORT Notification { unsigned serial_number_; string16 expanded_message_; std::vector<NotificationItem> items_; - gfx::ImageSkia primary_icon_; - gfx::ImageSkia image_; + gfx::Image primary_icon_; + gfx::Image image_; std::vector<ButtonInfo> buttons_; bool is_read_; // True if this has been seen in the message center. bool shown_as_popup_; // True if this has been shown as a popup notification. diff --git a/ui/message_center/notification_list.cc b/ui/message_center/notification_list.cc index ce2712e..4f0c69a 100644 --- a/ui/message_center/notification_list.cc +++ b/ui/message_center/notification_list.cc @@ -153,7 +153,7 @@ void NotificationList::SendRemoveNotificationsByExtension( } bool NotificationList::SetNotificationIcon(const std::string& notification_id, - const gfx::ImageSkia& image) { + const gfx::Image& image) { Notifications::iterator iter = GetNotification(notification_id); if (iter == notifications_.end()) return false; @@ -162,7 +162,7 @@ bool NotificationList::SetNotificationIcon(const std::string& notification_id, } bool NotificationList::SetNotificationImage(const std::string& notification_id, - const gfx::ImageSkia& image) { + const gfx::Image& image) { Notifications::iterator iter = GetNotification(notification_id); if (iter == notifications_.end()) return false; @@ -172,7 +172,7 @@ bool NotificationList::SetNotificationImage(const std::string& notification_id, bool NotificationList::SetNotificationButtonIcon( const std::string& notification_id, int button_index, - const gfx::ImageSkia& image) { + const gfx::Image& image) { Notifications::iterator iter = GetNotification(notification_id); if (iter == notifications_.end()) return false; diff --git a/ui/message_center/notification_list.h b/ui/message_center/notification_list.h index 77da649..be8718c 100644 --- a/ui/message_center/notification_list.h +++ b/ui/message_center/notification_list.h @@ -11,7 +11,7 @@ #include "base/string16.h" #include "base/time.h" #include "base/timer.h" -#include "ui/gfx/image/image_skia.h" +#include "ui/gfx/image/image.h" #include "ui/gfx/native_widget_types.h" #include "ui/message_center/message_center_export.h" #include "ui/message_center/notification.h" @@ -108,16 +108,16 @@ class MESSAGE_CENTER_EXPORT NotificationList { // Returns true if the notification exists and was updated. bool SetNotificationIcon(const std::string& notification_id, - const gfx::ImageSkia& image); + const gfx::Image& image); // Returns true if the notification exists and was updated. bool SetNotificationImage(const std::string& notification_id, - const gfx::ImageSkia& image); + const gfx::Image& image); // Returns true if the notification and button exist and were updated. bool SetNotificationButtonIcon(const std::string& notification_id, int button_index, - const gfx::ImageSkia& image); + const gfx::Image& image); bool HasNotification(const std::string& id); diff --git a/ui/message_center/notifier_settings_view_delegate.h b/ui/message_center/notifier_settings_view_delegate.h index aff13f2..9ea850c 100644 --- a/ui/message_center/notifier_settings_view_delegate.h +++ b/ui/message_center/notifier_settings_view_delegate.h @@ -9,7 +9,7 @@ #include "base/string16.h" #include "googleurl/src/gurl.h" -#include "ui/gfx/image/image_skia.h" +#include "ui/gfx/image/image.h" #include "ui/message_center/message_center_export.h" namespace message_center { @@ -47,7 +47,7 @@ struct MESSAGE_CENTER_EXPORT Notifier { NotifierType type; // The icon image of the notifier. The extension icon or favicon. - gfx::ImageSkia icon; + gfx::Image icon; private: DISALLOW_COPY_AND_ASSIGN(Notifier); diff --git a/ui/message_center/views/message_simple_view.cc b/ui/message_center/views/message_simple_view.cc index e18b256..3fe905a 100644 --- a/ui/message_center/views/message_simple_view.cc +++ b/ui/message_center/views/message_simple_view.cc @@ -64,7 +64,7 @@ void MessageSimpleView::SetUpView(const Notification& notification) { views::ImageView* icon = new views::ImageView; icon->SetImageSize( gfx::Size(kWebNotificationIconSize, kWebNotificationIconSize)); - icon->SetImage(notification.primary_icon()); + icon->SetImage(notification.primary_icon().AsImageSkia()); views::Label* title = new views::Label(notification.title()); title->SetHorizontalAlignment(gfx::ALIGN_LEFT); diff --git a/ui/message_center/views/notification_view.cc b/ui/message_center/views/notification_view.cc index dbedb23..c27e74a 100644 --- a/ui/message_center/views/notification_view.cc +++ b/ui/message_center/views/notification_view.cc @@ -348,7 +348,7 @@ views::View* NotificationView::MakeContentView( views::ImageView* icon = new views::ImageView(); icon->SetImageSize(gfx::Size(message_center::kNotificationIconSize, message_center::kNotificationIconSize)); - icon->SetImage(notification.primary_icon()); + icon->SetImage(notification.primary_icon().AsImageSkia()); icon->SetHorizontalAlignment(views::ImageView::LEADING); icon->SetVerticalAlignment(views::ImageView::LEADING); icon->set_border(MakePadding(0, 0, 0, kIconToTextPadding)); @@ -377,11 +377,11 @@ views::View* NotificationView::MakeContentView( } // Add an image row if appropriate. - if (!notification.image().isNull()) { + if (!notification.image().IsEmpty()) { layout->StartRow(0, 0); views::ImageView* image = new ProportionalImageView(); - image->SetImageSize(notification.image().size()); - image->SetImage(notification.image()); + image->SetImageSize(notification.image().ToImageSkia()->size()); + image->SetImage(notification.image().ToImageSkia()); image->SetHorizontalAlignment(views::ImageView::CENTER); image->SetVerticalAlignment(views::ImageView::LEADING); layout->AddView(image, 2, 1); @@ -397,7 +397,7 @@ views::View* NotificationView::MakeContentView( NotificationButton* button = new NotificationButton(this); ButtonInfo button_info = notification.buttons()[i]; button->SetTitle(button_info.title); - button->SetIcon(button_info.icon); + button->SetIcon(button_info.icon.AsImageSkia()); action_buttons_.push_back(button); layout->StartRow(0, 0); layout->AddView(button, 2, 1, diff --git a/ui/message_center/views/notifier_settings_view.cc b/ui/message_center/views/notifier_settings_view.cc index 4dd31e8..3de1f0b 100644 --- a/ui/message_center/views/notifier_settings_view.cc +++ b/ui/message_center/views/notifier_settings_view.cc @@ -7,6 +7,7 @@ #include "grit/ui_strings.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/gfx/image/image.h" #include "ui/gfx/size.h" #include "ui/message_center/message_center_constants.h" #include "ui/message_center/notifier_settings_view_delegate.h" @@ -51,9 +52,9 @@ class NotifierSettingsView::NotifierButton : public views::CustomButton, AddChildView(new views::Label(notifier_->name)); } - void UpdateIconImage(const gfx::ImageSkia& icon) { + void UpdateIconImage(const gfx::Image& icon) { notifier_->icon = icon; - if (icon.isNull()) { + if (icon.IsEmpty()) { delete icon_view_; icon_view_ = NULL; } else { @@ -61,7 +62,7 @@ class NotifierSettingsView::NotifierButton : public views::CustomButton, icon_view_ = new views::ImageView(); AddChildViewAt(icon_view_, 1); } - icon_view_->SetImage(icon); + icon_view_->SetImage(icon.ToImageSkia()); icon_view_->SetImageSize(gfx::Size(kSettingsIconSize, kSettingsIconSize)); } Layout(); @@ -120,14 +121,14 @@ void NotifierSettingsView::UpdateIconImage(const std::string& id, for (std::set<NotifierButton*>::iterator iter = buttons_.begin(); iter != buttons_.end(); ++iter) { if ((*iter)->notifier().id == id) { - (*iter)->UpdateIconImage(icon); + (*iter)->UpdateIconImage(gfx::Image(icon)); return; } } } void NotifierSettingsView::UpdateFavicon(const GURL& url, - const gfx::ImageSkia& icon) { + const gfx::Image& icon) { for (std::set<NotifierButton*>::iterator iter = buttons_.begin(); iter != buttons_.end(); ++iter) { if ((*iter)->notifier().url == url) { diff --git a/ui/message_center/views/notifier_settings_view.h b/ui/message_center/views/notifier_settings_view.h index 5b1e346..a296dd5 100644 --- a/ui/message_center/views/notifier_settings_view.h +++ b/ui/message_center/views/notifier_settings_view.h @@ -9,6 +9,7 @@ #include <string> #include "base/string16.h" +#include "ui/gfx/image/image.h" #include "ui/gfx/image/image_skia.h" #include "ui/gfx/native_widget_types.h" #include "ui/message_center/message_center_export.h" @@ -32,7 +33,7 @@ class MESSAGE_CENTER_EXPORT NotifierSettingsView gfx::NativeView context); void UpdateIconImage(const std::string& id, const gfx::ImageSkia& icon); - void UpdateFavicon(const GURL& url, const gfx::ImageSkia& icon); + void UpdateFavicon(const GURL& url, const gfx::Image& icon); void set_delegate(NotifierSettingsViewDelegate* new_delegate) { delegate_ = new_delegate; |