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 /ui | |
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
Diffstat (limited to 'ui')
-rw-r--r-- | ui/message_center/message_center.cc | 6 | ||||
-rw-r--r-- | ui/message_center/message_center.h | 6 | ||||
-rw-r--r-- | ui/message_center/notification.cc | 2 | ||||
-rw-r--r-- | ui/message_center/notification.h | 18 | ||||
-rw-r--r-- | ui/message_center/notification_list.cc | 6 | ||||
-rw-r--r-- | ui/message_center/notification_list.h | 8 | ||||
-rw-r--r-- | ui/message_center/notifier_settings_view_delegate.h | 4 | ||||
-rw-r--r-- | ui/message_center/views/message_simple_view.cc | 2 | ||||
-rw-r--r-- | ui/message_center/views/notification_view.cc | 10 | ||||
-rw-r--r-- | ui/message_center/views/notifier_settings_view.cc | 11 | ||||
-rw-r--r-- | ui/message_center/views/notifier_settings_view.h | 3 |
11 files changed, 39 insertions, 37 deletions
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; |