diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-14 20:22:01 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-14 20:22:01 +0000 |
commit | 6c158192e64a230aa18f2ba4dd647d5b1a5a8b1d (patch) | |
tree | 34957fa50c8682e7e2bec16321ff34a2c6aa16aa | |
parent | fe7d500a0d9a42d358f5f1ca24d4770d9bb3b6cd (diff) | |
download | chromium_src-6c158192e64a230aa18f2ba4dd647d5b1a5a8b1d.zip chromium_src-6c158192e64a230aa18f2ba4dd647d5b1a5a8b1d.tar.gz chromium_src-6c158192e64a230aa18f2ba4dd647d5b1a5a8b1d.tar.bz2 |
Change SetImage, SetBackground, and SetToggledImage to take in a gfx::ImageSkia
The files were changed using the following sed script
1 :top
2 /SetImage/ {
3 s|ToSkBitmap|ToImageSkia|g
4 s|GetBitmapNamed|GetImageSkiaNamed|g
5 n
6 N
7 s|ToSkBitmap|ToImageSkia|g
8 s|GetBitmapNamed|GetImageSkiaNamed|g
9 b top
10 }
11 /SetBackground/ {
12 s|ToSkBitmap|ToImageSkia|g
13 s|GetBitmapNamed|GetImageSkiaNamed|g
14 n
15 N
16 s|ToSkBitmap|ToImageSkia|g
17 s|GetBitmapNamed|GetImageSkiaNamed|g
18 b top
19 }
20 /SetToggledImage/ {
21 s|ToSkBitmap|ToImageSkia|g
22 s|GetBitmapNamed|GetImageSkiaNamed|g
23 n
24 N
25 s|ToSkBitmap|ToImageSkia|g
26 s|GetBitmapNamed|GetImageSkiaNamed|g
27 b top
28 }
The following files were modified by hand afterwards:
1 ash/launcher/launcher_button.cc
2 ash/system/audio/tray_volume.cc
3 ash/system/drive/tray_drive.cc
4 ash/system/tray/system_tray_delegate.h
5 ash/system/tray/tray_item_more.cc
6 ash/system/tray/tray_item_more.h
7 chrome/browser/chromeos/login/take_photo_view.cc
8 chrome/browser/chromeos/login/take_photo_view.h
9 chrome/browser/chromeos/options/network_config_view.cc
10 chrome/browser/chromeos/options/network_config_view.h
11 chrome/browser/ui/panels/panel_browser_frame_view.cc
12 chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc
13 chrome/browser/ui/views/autocomplete/autocomplete_result_view.h
14 chrome/browser/ui/views/avatar_menu_bubble_view.cc
15 chrome/browser/ui/views/chrome_to_mobile_bubble_view.cc
16 chrome/browser/ui/views/confirm_bubble_view.cc
17 chrome/browser/ui/views/download/download_shelf_view.cc
18 chrome/browser/ui/views/download/download_started_animation_views.cc
19 chrome/browser/ui/views/dropdown_bar_view.cc
20 chrome/browser/ui/views/dropdown_bar_view.h
21 chrome/browser/ui/views/find_bar_view.cc
22 chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
23 chrome/browser/ui/views/hung_renderer_view.cc
24 chrome/browser/ui/views/location_bar/page_action_image_view.cc
25 chrome/browser/ui/views/tabs/tab_strip.cc
26 chrome/browser/ui/views/tabs/tab_strip.h
27 ui/views/controls/button/image_button.h
28 ui/views/controls/button/image_button_unittest.cc
29 ui/views/controls/scrollbar/bitmap_scroll_bar.cc
30 ui/views/controls/scrollbar/bitmap_scroll_bar.h
Whitespace changes were made in the following files manually
1 ash/launcher/launcher_view.cc
2 chrome/browser/chromeos/login/simple_web_view_dialog.cc
3 chrome/browser/ui/views/location_bar/chrome_to_mobile_view.cc
4 chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc
5 chrome/browser/ui/views/toolbar_view.cc
Bug=124566
Test=Compiles, try bots pass
Review URL: https://chromiumcodereview.appspot.com/10382144
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136964 0039d316-1c4b-4281-b951-d872f2087c98
76 files changed, 294 insertions, 270 deletions
diff --git a/ash/launcher/launcher_button.cc b/ash/launcher/launcher_button.cc index 8701f30..acc6a31 100644 --- a/ash/launcher/launcher_button.cc +++ b/ash/launcher/launcher_button.cc @@ -109,7 +109,7 @@ void LauncherButton::SetShadowedImage(const SkBitmap& bitmap) { void LauncherButton::SetImage(const SkBitmap& image) { if (image.empty()) { // TODO: need an empty image. - icon_view_->SetImage(&image); + icon_view_->SetImage(image); return; } @@ -264,7 +264,7 @@ void LauncherButton::UpdateState() { else bar_id = IDR_AURA_LAUNCHER_UNDERLINE_RUNNING; - bar_->SetImage(rb.GetImageNamed(bar_id).ToSkBitmap()); + bar_->SetImage(rb.GetImageNamed(bar_id).ToImageSkia()); } Layout(); diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc index 90d9be9..16bd424 100644 --- a/ash/launcher/launcher_view.cc +++ b/ash/launcher/launcher_view.cc @@ -276,13 +276,13 @@ void LauncherView::Init() { overflow_button_->set_accessibility_focusable(true); overflow_button_->SetImage( views::CustomButton::BS_NORMAL, - rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW).ToSkBitmap()); + rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW).ToImageSkia()); overflow_button_->SetImage( views::CustomButton::BS_HOT, - rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_HOT).ToSkBitmap()); + rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_HOT).ToImageSkia()); overflow_button_->SetImage( views::CustomButton::BS_PUSHED, - rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_PUSHED).ToSkBitmap()); + rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_PUSHED).ToImageSkia()); overflow_button_->SetAccessibleName( l10n_util::GetStringUTF16(IDS_AURA_LAUNCHER_OVERFLOW_NAME)); overflow_button_->set_context_menu_controller(this); @@ -466,13 +466,15 @@ views::View* LauncherView::CreateViewForItem(const LauncherItem& item) { views::ImageButton* button = new views::ImageButton(this); button->SetImage( views::CustomButton::BS_NORMAL, - rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST).ToSkBitmap()); + rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST).ToImageSkia()); button->SetImage( views::CustomButton::BS_HOT, - rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_HOT).ToSkBitmap()); + rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_HOT). + ToImageSkia()); button->SetImage( views::CustomButton::BS_PUSHED, - rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_PUSHED).ToSkBitmap()); + rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_PUSHED). + ToImageSkia()); button->SetAccessibleName( l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE)); button->SetTooltipText( @@ -487,7 +489,7 @@ views::View* LauncherView::CreateViewForItem(const LauncherItem& item) { int image_id = delegate_ ? delegate_->GetBrowserShortcutResourceId() : IDR_AURA_LAUNCHER_BROWSER_SHORTCUT; - button->SetImage(*rb.GetImageNamed(image_id).ToSkBitmap()); + button->SetImage(*rb.GetImageNamed(image_id).ToImageSkia()); view = button; break; } diff --git a/ash/monitor/secondary_monitor_view.cc b/ash/monitor/secondary_monitor_view.cc index 46e9bf8..ad9b250 100644 --- a/ash/monitor/secondary_monitor_view.cc +++ b/ash/monitor/secondary_monitor_view.cc @@ -54,7 +54,7 @@ class SecondaryMonitorView : public views::WidgetDelegateView { AddChildView(shortcut_text_); shortcut_image_ = new views::ImageView(); - shortcut_image_->SetImage(rb.GetBitmapNamed(IDR_AURA_SWITCH_MONITOR)); + shortcut_image_->SetImage(rb.GetImageSkiaNamed(IDR_AURA_SWITCH_MONITOR)); AddChildView(shortcut_image_); } diff --git a/ash/system/audio/tray_volume.cc b/ash/system/audio/tray_volume.cc index b43f121..fba2fe8 100644 --- a/ash/system/audio/tray_volume.cc +++ b/ash/system/audio/tray_volume.cc @@ -69,9 +69,9 @@ class VolumeButton : public views::ToggleImageButton { if (image_index != image_index_) { SkIRect region = SkIRect::MakeXYWH(0, image_index * kVolumeImageHeight, kVolumeImageWidth, kVolumeImageHeight); - SkBitmap bitmap; - image_.ToSkBitmap()->extractSubset(&bitmap, region); - SetImage(views::CustomButton::BS_NORMAL, &bitmap); + gfx::ImageSkia image_skia; + image_.ToImageSkia()->extractSubset(&image_skia, region); + SetImage(views::CustomButton::BS_NORMAL, &image_skia); image_index_ = image_index; } SchedulePaint(); diff --git a/ash/system/bluetooth/tray_bluetooth.cc b/ash/system/bluetooth/tray_bluetooth.cc index 1f55bcd..84c7131 100644 --- a/ash/system/bluetooth/tray_bluetooth.cc +++ b/ash/system/bluetooth/tray_bluetooth.cc @@ -32,7 +32,7 @@ class BluetoothDefaultView : public TrayItemMore { explicit BluetoothDefaultView(SystemTrayItem* owner) : TrayItemMore(owner) { ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); - SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_BLUETOOTH).ToSkBitmap()); + SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_BLUETOOTH).ToImageSkia()); UpdateLabel(); } diff --git a/ash/system/brightness/tray_brightness.cc b/ash/system/brightness/tray_brightness.cc index b52e978..33ced23 100644 --- a/ash/system/brightness/tray_brightness.cc +++ b/ash/system/brightness/tray_brightness.cc @@ -52,7 +52,7 @@ class BrightnessView : public views::View, views::ImageView* icon = new FixedSizedImageView(0, kTrayPopupItemHeight); gfx::Image image = ui::ResourceBundle::GetSharedInstance().GetImageNamed( IDR_AURA_UBER_TRAY_BRIGHTNESS); - icon->SetImage(image.ToSkBitmap()); + icon->SetImage(image.ToImageSkia()); AddChildView(icon); slider_ = new views::Slider(this, views::Slider::HORIZONTAL); diff --git a/ash/system/drive/tray_drive.cc b/ash/system/drive/tray_drive.cc index 3bdbd30..8da3df4 100644 --- a/ash/system/drive/tray_drive.cc +++ b/ash/system/drive/tray_drive.cc @@ -69,7 +69,7 @@ class DriveDefaultView : public TrayItemMore { : TrayItemMore(owner) { ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); - SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_DRIVE).ToSkBitmap()); + SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_DRIVE).ToImageSkia()); Update(list); } @@ -101,11 +101,11 @@ class DriveDetailedView : public views::View, views::BoxLayout::kVertical, 0, 0, 0)); set_background(views::Background::CreateSolidBackground(kBackgroundColor)); - in_progress_img_ = ResourceBundle::GetSharedInstance().GetBitmapNamed( + in_progress_img_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_AURA_UBER_TRAY_DRIVE); - done_img_ = ResourceBundle::GetSharedInstance().GetBitmapNamed( + done_img_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_AURA_UBER_TRAY_DRIVE_DONE); - failed_img_ = ResourceBundle::GetSharedInstance().GetBitmapNamed( + failed_img_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_AURA_UBER_TRAY_DRIVE_FAILED); Update(list); @@ -178,10 +178,10 @@ class DriveDetailedView : public views::View, cancel_button_ = new views::ImageButton(this); cancel_button_->SetImage(views::ImageButton::BS_NORMAL, - ResourceBundle::GetSharedInstance().GetBitmapNamed( + ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_AURA_UBER_TRAY_DRIVE_CANCEL)); cancel_button_->SetImage(views::ImageButton::BS_HOT, - ResourceBundle::GetSharedInstance().GetBitmapNamed( + ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_AURA_UBER_TRAY_DRIVE_CANCEL_HOVER)); UpdateStatus(state, progress); @@ -273,7 +273,8 @@ class DriveDetailedView : public views::View, AddChildView(header_); } - SkBitmap* GetImageForState(ash::DriveOperationStatus::OperationState state) { + gfx::ImageSkia* GetImageForState( + ash::DriveOperationStatus::OperationState state) { switch (state) { case ash::DriveOperationStatus::OPERATION_NOT_STARTED: case ash::DriveOperationStatus::OPERATION_STARTED: @@ -375,9 +376,9 @@ class DriveDetailedView : public views::View, SpecialPopupRow* header_; views::View* operations_; views::View* settings_; - SkBitmap* in_progress_img_; - SkBitmap* done_img_; - SkBitmap* failed_img_; + gfx::ImageSkia* in_progress_img_; + gfx::ImageSkia* done_img_; + gfx::ImageSkia* failed_img_; DISALLOW_COPY_AND_ASSIGN(DriveDetailedView); }; diff --git a/ash/system/ime/tray_ime.cc b/ash/system/ime/tray_ime.cc index e859372..7f56072 100644 --- a/ash/system/ime/tray_ime.cc +++ b/ash/system/ime/tray_ime.cc @@ -36,7 +36,7 @@ class IMEDefaultView : public TrayItemMore { ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); SetImage(bundle.GetImageNamed( - IDR_AURA_UBER_TRAY_IME).ToSkBitmap()); + IDR_AURA_UBER_TRAY_IME).ToImageSkia()); IMEInfo info; Shell::GetInstance()->tray_delegate()->GetCurrentIME(&info); diff --git a/ash/system/settings/tray_settings.cc b/ash/system/settings/tray_settings.cc index 9089864..8b96ffe 100644 --- a/ash/system/settings/tray_settings.cc +++ b/ash/system/settings/tray_settings.cc @@ -34,7 +34,7 @@ class SettingsView : public ash::internal::ActionableView { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); views::ImageView* icon = new ash::internal::FixedSizedImageView(0, ash::kTrayPopupItemHeight); - icon->SetImage(rb.GetImageNamed(IDR_AURA_UBER_TRAY_SETTINGS).ToSkBitmap()); + icon->SetImage(rb.GetImageNamed(IDR_AURA_UBER_TRAY_SETTINGS).ToImageSkia()); AddChildView(icon); string16 text = rb.GetLocalizedString( diff --git a/ash/system/tray/system_tray_delegate.h b/ash/system/tray/system_tray_delegate.h index f1ace42..6e2c77c 100644 --- a/ash/system/tray/system_tray_delegate.h +++ b/ash/system/tray/system_tray_delegate.h @@ -16,8 +16,7 @@ #include "base/i18n/time_formatting.h" #include "base/string16.h" #include "third_party/skia/include/core/SkBitmap.h" - -class SkBitmap; +#include "ui/gfx/image/image_skia.h" namespace ash { @@ -27,7 +26,7 @@ struct ASH_EXPORT NetworkIconInfo { bool highlight; bool tray_icon_visible; - SkBitmap image; + gfx::ImageSkia image; string16 name; string16 description; std::string service_path; diff --git a/ash/system/tray/tray_image_item.cc b/ash/system/tray/tray_image_item.cc index a92f2ad..449cbd7 100644 --- a/ash/system/tray/tray_image_item.cc +++ b/ash/system/tray/tray_image_item.cc @@ -29,7 +29,7 @@ views::View* TrayImageItem::CreateTrayView(user::LoginStatus status) { tray_view_ = new TrayItemView; tray_view_->CreateImageView(); tray_view_->image_view()->SetImage(ui::ResourceBundle::GetSharedInstance(). - GetImageNamed(resource_id_).ToSkBitmap()); + GetImageNamed(resource_id_).ToImageSkia()); tray_view_->SetVisible(GetInitialVisibility()); return tray_view_; } diff --git a/ash/system/tray/tray_item_more.cc b/ash/system/tray/tray_item_more.cc index 9f07da8..27a143b 100644 --- a/ash/system/tray/tray_item_more.cc +++ b/ash/system/tray/tray_item_more.cc @@ -32,7 +32,7 @@ TrayItemMore::TrayItemMore(SystemTrayItem* owner) more_ = new views::ImageView; more_->EnableCanvasFlippingForRTLUI(true); more_->SetImage(ui::ResourceBundle::GetSharedInstance().GetImageNamed( - IDR_AURA_UBER_TRAY_MORE).ToSkBitmap()); + IDR_AURA_UBER_TRAY_MORE).ToImageSkia()); AddChildView(more_); } @@ -45,8 +45,8 @@ void TrayItemMore::SetLabel(const string16& label) { SchedulePaint(); } -void TrayItemMore::SetImage(const SkBitmap* bitmap) { - icon_->SetImage(bitmap); +void TrayItemMore::SetImage(const gfx::ImageSkia* image_skia) { + icon_->SetImage(image_skia); SchedulePaint(); } diff --git a/ash/system/tray/tray_item_more.h b/ash/system/tray/tray_item_more.h index 6c4a9f5..8731dde 100644 --- a/ash/system/tray/tray_item_more.h +++ b/ash/system/tray/tray_item_more.h @@ -29,7 +29,7 @@ class TrayItemMore : public ActionableView { virtual ~TrayItemMore(); void SetLabel(const string16& label); - void SetImage(const SkBitmap* bitmap); + void SetImage(const gfx::ImageSkia* image_skia); void SetAccessibleName(const string16& name); protected: diff --git a/ash/system/tray/tray_views.cc b/ash/system/tray/tray_views.cc index 50aa8aa..51f8e36 100644 --- a/ash/system/tray/tray_views.cc +++ b/ash/system/tray/tray_views.cc @@ -326,13 +326,13 @@ TrayPopupHeaderButton::TrayPopupHeaderButton(views::ButtonListener* listener, : views::ToggleImageButton(listener) { ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); SetImage(views::CustomButton::BS_NORMAL, - bundle.GetImageNamed(enabled_resource_id).ToSkBitmap()); + bundle.GetImageNamed(enabled_resource_id).ToImageSkia()); SetToggledImage(views::CustomButton::BS_NORMAL, - bundle.GetImageNamed(disabled_resource_id).ToSkBitmap()); + bundle.GetImageNamed(disabled_resource_id).ToImageSkia()); SetImage(views::CustomButton::BS_HOT, - bundle.GetImageNamed(enabled_resource_id_hover).ToSkBitmap()); + bundle.GetImageNamed(enabled_resource_id_hover).ToImageSkia()); SetToggledImage(views::CustomButton::BS_HOT, - bundle.GetImageNamed(disabled_resource_id_hover).ToSkBitmap()); + bundle.GetImageNamed(disabled_resource_id_hover).ToImageSkia()); SetImageAlignment(views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); set_focusable(true); @@ -468,7 +468,7 @@ void TrayNotificationView::InitView(views::View* contents) { views::ImageButton* close_button = new views::ImageButton(this); close_button->SetImage(views::CustomButton::BS_NORMAL, - ResourceBundle::GetSharedInstance().GetBitmapNamed( + ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_AURA_WINDOW_CLOSE)); AddChildView(close_button); diff --git a/ash/system/tray_accessibility.cc b/ash/system/tray_accessibility.cc index 7d76748..08e173e 100644 --- a/ash/system/tray_accessibility.cc +++ b/ash/system/tray_accessibility.cc @@ -32,7 +32,7 @@ class DefaultAccessibilityView : public ActionableView { FixedSizedImageView* image = new FixedSizedImageView(0, kTrayPopupItemHeight); image->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_ACCESSIBILITY). - ToSkBitmap()); + ToImageSkia()); AddChildView(image); string16 label = bundle.GetLocalizedString( @@ -92,7 +92,7 @@ views::View* TrayAccessibility::CreateDetailedView(user::LoginStatus status) { ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); views::ImageView* image = new views::ImageView; image->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_ACCESSIBILITY). - ToSkBitmap()); + ToImageSkia()); detailed_->AddChildView(image); detailed_->AddChildView(new views::Label( diff --git a/ash/system/tray_caps_lock.cc b/ash/system/tray_caps_lock.cc index 729fc88..466fa77 100644 --- a/ash/system/tray_caps_lock.cc +++ b/ash/system/tray_caps_lock.cc @@ -35,7 +35,7 @@ class CapsLockDefaultView : public ActionableView { FixedSizedImageView* image = new FixedSizedImageView(0, kTrayPopupItemHeight); image->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_CAPS_LOCK_DARK). - ToSkBitmap()); + ToImageSkia()); AddChildView(image); text_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); @@ -131,7 +131,7 @@ views::View* TrayCapsLock::CreateDetailedView(user::LoginStatus status) { ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); views::ImageView* image = new views::ImageView; image->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_CAPS_LOCK_DARK). - ToSkBitmap()); + ToImageSkia()); detailed_->AddChildView(image); diff --git a/ash/system/tray_update.cc b/ash/system/tray_update.cc index d6f03af..55318e1 100644 --- a/ash/system/tray_update.cc +++ b/ash/system/tray_update.cc @@ -45,7 +45,7 @@ class UpdateView : public ash::internal::ActionableView { views::ImageView* image = new ash::internal::FixedSizedImageView(0, ash::kTrayPopupItemHeight); image->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_UPDATE_DARK). - ToSkBitmap()); + ToImageSkia()); AddChildView(image); AddChildView(new views::Label( diff --git a/ash/wm/dialog_frame_view.cc b/ash/wm/dialog_frame_view.cc index f98ab00..31dd6d3 100644 --- a/ash/wm/dialog_frame_view.cc +++ b/ash/wm/dialog_frame_view.cc @@ -72,11 +72,11 @@ DialogFrameView::DialogFrameView() { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); close_button_ = new views::ImageButton(this); close_button_->SetImage(views::CustomButton::BS_NORMAL, - rb.GetImageNamed(IDR_CLOSE_BAR).ToSkBitmap()); + rb.GetImageNamed(IDR_CLOSE_BAR).ToImageSkia()); close_button_->SetImage(views::CustomButton::BS_HOT, - rb.GetImageNamed(IDR_CLOSE_BAR_H).ToSkBitmap()); + rb.GetImageNamed(IDR_CLOSE_BAR_H).ToImageSkia()); close_button_->SetImage(views::CustomButton::BS_PUSHED, - rb.GetImageNamed(IDR_CLOSE_BAR_P).ToSkBitmap()); + rb.GetImageNamed(IDR_CLOSE_BAR_P).ToImageSkia()); close_button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); AddChildView(close_button_); diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc index 6bdc426..1258927 100644 --- a/ash/wm/frame_painter.cc +++ b/ash/wm/frame_painter.cc @@ -558,11 +558,11 @@ void FramePainter::SetButtonImages(views::ImageButton* button, int pushed_bitmap_id) { ui::ThemeProvider* theme_provider = frame_->GetThemeProvider(); button->SetImage(views::CustomButton::BS_NORMAL, - theme_provider->GetBitmapNamed(normal_bitmap_id)); + theme_provider->GetImageSkiaNamed(normal_bitmap_id)); button->SetImage(views::CustomButton::BS_HOT, - theme_provider->GetBitmapNamed(hot_bitmap_id)); + theme_provider->GetImageSkiaNamed(hot_bitmap_id)); button->SetImage(views::CustomButton::BS_PUSHED, - theme_provider->GetBitmapNamed(pushed_bitmap_id)); + theme_provider->GetImageSkiaNamed(pushed_bitmap_id)); } int FramePainter::GetTitleOffsetX() const { diff --git a/chrome/browser/chromeos/login/message_bubble.cc b/chrome/browser/chromeos/login/message_bubble.cc index 3d98cab..15eaccb 100644 --- a/chrome/browser/chromeos/login/message_bubble.cc +++ b/chrome/browser/chromeos/login/message_bubble.cc @@ -81,11 +81,11 @@ void MessageBubble::Init() { close_button_ = new views::ImageButton(this); close_button_->SetImage(views::CustomButton::BS_NORMAL, - rb.GetBitmapNamed(IDR_CLOSE_BAR)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR)); close_button_->SetImage(views::CustomButton::BS_HOT, - rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR_H)); close_button_->SetImage(views::CustomButton::BS_PUSHED, - rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR_P)); layout->AddView(close_button_); for (size_t i = 0; i < help_links_.size(); ++i) { diff --git a/chrome/browser/chromeos/login/simple_web_view_dialog.cc b/chrome/browser/chromeos/login/simple_web_view_dialog.cc index 828b174..fc8f549 100644 --- a/chrome/browser/chromeos/login/simple_web_view_dialog.cc +++ b/chrome/browser/chromeos/login/simple_web_view_dialog.cc @@ -332,36 +332,38 @@ void SimpleWebViewDialog::ExecuteCommandWithDisposition( void SimpleWebViewDialog::LoadImages() { ui::ThemeProvider* tp = GetThemeProvider(); - back_->SetImage(views::CustomButton::BS_NORMAL, tp->GetBitmapNamed(IDR_BACK)); - back_->SetImage(views::CustomButton::BS_HOT, tp->GetBitmapNamed(IDR_BACK_H)); + back_->SetImage(views::CustomButton::BS_NORMAL, + tp->GetImageSkiaNamed(IDR_BACK)); + back_->SetImage(views::CustomButton::BS_HOT, + tp->GetImageSkiaNamed(IDR_BACK_H)); back_->SetImage(views::CustomButton::BS_PUSHED, - tp->GetBitmapNamed(IDR_BACK_P)); + tp->GetImageSkiaNamed(IDR_BACK_P)); back_->SetImage(views::CustomButton::BS_DISABLED, - tp->GetBitmapNamed(IDR_BACK_D)); + tp->GetImageSkiaNamed(IDR_BACK_D)); forward_->SetImage(views::CustomButton::BS_NORMAL, - tp->GetBitmapNamed(IDR_FORWARD)); + tp->GetImageSkiaNamed(IDR_FORWARD)); forward_->SetImage(views::CustomButton::BS_HOT, - tp->GetBitmapNamed(IDR_FORWARD_H)); + tp->GetImageSkiaNamed(IDR_FORWARD_H)); forward_->SetImage(views::CustomButton::BS_PUSHED, - tp->GetBitmapNamed(IDR_FORWARD_P)); + tp->GetImageSkiaNamed(IDR_FORWARD_P)); forward_->SetImage(views::CustomButton::BS_DISABLED, - tp->GetBitmapNamed(IDR_FORWARD_D)); + tp->GetImageSkiaNamed(IDR_FORWARD_D)); reload_->SetImage(views::CustomButton::BS_NORMAL, - tp->GetBitmapNamed(IDR_RELOAD)); + tp->GetImageSkiaNamed(IDR_RELOAD)); reload_->SetImage(views::CustomButton::BS_HOT, - tp->GetBitmapNamed(IDR_RELOAD_H)); + tp->GetImageSkiaNamed(IDR_RELOAD_H)); reload_->SetImage(views::CustomButton::BS_PUSHED, - tp->GetBitmapNamed(IDR_RELOAD_P)); + tp->GetImageSkiaNamed(IDR_RELOAD_P)); reload_->SetToggledImage(views::CustomButton::BS_NORMAL, - tp->GetBitmapNamed(IDR_STOP)); + tp->GetImageSkiaNamed(IDR_STOP)); reload_->SetToggledImage(views::CustomButton::BS_HOT, - tp->GetBitmapNamed(IDR_STOP_H)); + tp->GetImageSkiaNamed(IDR_STOP_H)); reload_->SetToggledImage(views::CustomButton::BS_PUSHED, - tp->GetBitmapNamed(IDR_STOP_P)); + tp->GetImageSkiaNamed(IDR_STOP_P)); reload_->SetToggledImage(views::CustomButton::BS_DISABLED, - tp->GetBitmapNamed(IDR_STOP_D)); + tp->GetImageSkiaNamed(IDR_STOP_D)); } void SimpleWebViewDialog::UpdateButtons() { diff --git a/chrome/browser/chromeos/login/take_photo_view.cc b/chrome/browser/chromeos/login/take_photo_view.cc index 8c16bcb..a9cb1c4 100644 --- a/chrome/browser/chromeos/login/take_photo_view.cc +++ b/chrome/browser/chromeos/login/take_photo_view.cc @@ -72,7 +72,7 @@ class CameraImageView : public views::ImageView { ShowThrobber(); SetMessage(string16()); SetImage( - ResourceBundle::GetSharedInstance().GetBitmapNamed( + ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_USER_IMAGE_INITIALIZING)); } @@ -85,7 +85,7 @@ class CameraImageView : public views::ImageView { HideThrobber(); SetMessage(l10n_util::GetStringUTF16(IDS_USER_IMAGE_NO_VIDEO)); SetImage( - ResourceBundle::GetSharedInstance().GetBitmapNamed( + ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_USER_IMAGE_NO_VIDEO)); } @@ -175,11 +175,11 @@ void TakePhotoView::Init() { snapshot_button_ = new views::ImageButton(this); snapshot_button_->set_focusable(true); snapshot_button_->SetImage(views::CustomButton::BS_NORMAL, - ResourceBundle::GetSharedInstance().GetBitmapNamed( - IDR_USER_IMAGE_CAPTURE)); + ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + IDR_USER_IMAGE_CAPTURE)); snapshot_button_->SetImage(views::CustomButton::BS_DISABLED, - ResourceBundle::GetSharedInstance().GetBitmapNamed( - IDR_USER_IMAGE_CAPTURE_DISABLED)); + ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + IDR_USER_IMAGE_CAPTURE_DISABLED)); snapshot_button_->SetAccessibleName(l10n_util::GetStringUTF16( IDS_CHROMEOS_ACC_ACCOUNT_PICTURE)); @@ -229,7 +229,7 @@ void TakePhotoView::UpdateVideoFrame(const SkBitmap& frame) { snapshot_button_->SetEnabled(true); snapshot_button_->RequestFocus(); } - SkBitmap user_image = + gfx::ImageSkia user_image = skia::ImageOperations::Resize( frame, skia::ImageOperations::RESIZE_BOX, @@ -242,8 +242,8 @@ void TakePhotoView::UpdateVideoFrame(const SkBitmap& frame) { void TakePhotoView::ShowCameraInitializing() { is_capturing_ = true; snapshot_button_->SetImage(views::CustomButton::BS_NORMAL, - ResourceBundle::GetSharedInstance().GetBitmapNamed( - IDR_USER_IMAGE_CAPTURE)); + ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + IDR_USER_IMAGE_CAPTURE)); snapshot_button_->SetVisible(true); snapshot_button_->SetEnabled(false); user_image_->SetInitializingState(); @@ -260,7 +260,7 @@ const SkBitmap& TakePhotoView::GetImage() const { return user_image_->GetImage(); } -void TakePhotoView::SetImage(SkBitmap* image) { +void TakePhotoView::SetImage(gfx::ImageSkia* image) { is_capturing_ = false; snapshot_button_->SetVisible(false); snapshot_button_->SetEnabled(false); @@ -275,7 +275,7 @@ void TakePhotoView::CaptureImage() { is_capturing_ = false; snapshot_button_->SetImage( views::CustomButton::BS_NORMAL, - ResourceBundle::GetSharedInstance().GetBitmapNamed( + ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_USER_IMAGE_RECYCLE)); delegate_->OnCapturingStopped(); snapshot_button_->SchedulePaint(); @@ -300,7 +300,7 @@ void TakePhotoView::FlipCapturingState() { is_capturing_ = true; snapshot_button_->SetImage( views::CustomButton::BS_NORMAL, - ResourceBundle::GetSharedInstance().GetBitmapNamed( + ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_USER_IMAGE_CAPTURE)); delegate_->OnCapturingStarted(); snapshot_button_->SchedulePaint(); diff --git a/chrome/browser/chromeos/login/take_photo_view.h b/chrome/browser/chromeos/login/take_photo_view.h index f773dc3..33e7d21 100644 --- a/chrome/browser/chromeos/login/take_photo_view.h +++ b/chrome/browser/chromeos/login/take_photo_view.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -13,6 +13,10 @@ class PhotoCaptureObserver; class SkBitmap; +namespace gfx { +class ImageSkia; +} // namespace gfx + namespace views { class ImageButton; class Label; @@ -59,7 +63,7 @@ class TakePhotoView : public views::View, const SkBitmap& GetImage() const; // Sets the image indicating that the view is used only for image preview. - void SetImage(SkBitmap* image); + void SetImage(gfx::ImageSkia* image); // Captures the image, as if the button was pressed. void CaptureImage(); diff --git a/chrome/browser/chromeos/options/network_config_view.cc b/chrome/browser/chromeos/options/network_config_view.cc index f7d5fde..3227bec 100644 --- a/chrome/browser/chromeos/options/network_config_view.cc +++ b/chrome/browser/chromeos/options/network_config_view.cc @@ -240,9 +240,9 @@ void ControlledSettingIndicatorView::OnMouseExited( void ControlledSettingIndicatorView::Init() { color_image_ = ResourceBundle::GetSharedInstance().GetImageNamed( - IDR_CONTROLLED_SETTING_MANDATORY).ToSkBitmap(); + IDR_CONTROLLED_SETTING_MANDATORY).ToImageSkia(); gray_image_ = ResourceBundle::GetSharedInstance().GetImageNamed( - IDR_CONTROLLED_SETTING_MANDATORY_GRAY).ToSkBitmap(); + IDR_CONTROLLED_SETTING_MANDATORY_GRAY).ToImageSkia(); image_view_ = new views::ImageView(); // Disable |image_view_| so mouse events propagate to the parent. image_view_->SetEnabled(false); diff --git a/chrome/browser/chromeos/options/network_config_view.h b/chrome/browser/chromeos/options/network_config_view.h index 438cd51..fbb229f 100644 --- a/chrome/browser/chromeos/options/network_config_view.h +++ b/chrome/browser/chromeos/options/network_config_view.h @@ -16,11 +16,15 @@ #include "ui/views/controls/button/button.h" // views::ButtonListener #include "ui/views/window/dialog_delegate.h" +namespace gfx { +class ImageSkia; +} // namespace gfx + namespace views { class ImageView; class NativeTextButton; class View; -} +} // namespace views namespace chromeos { @@ -169,8 +173,8 @@ class ControlledSettingIndicatorView : public views::View { bool managed_; views::ImageView* image_view_; - const SkBitmap* gray_image_; - const SkBitmap* color_image_; + const gfx::ImageSkia* gray_image_; + const gfx::ImageSkia* color_image_; DISALLOW_COPY_AND_ASSIGN(ControlledSettingIndicatorView); }; diff --git a/chrome/browser/chromeos/options/wifi_config_view.cc b/chrome/browser/chromeos/options/wifi_config_view.cc index e07d309..1c3ebd4 100644 --- a/chrome/browser/chromeos/options/wifi_config_view.cc +++ b/chrome/browser/chromeos/options/wifi_config_view.cc @@ -1047,15 +1047,15 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { passphrase_visible_button_->SetImage( views::ImageButton::BS_NORMAL, ResourceBundle::GetSharedInstance(). - GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_OFF)); + GetImageSkiaNamed(IDR_NETWORK_SHOW_PASSWORD_OFF)); passphrase_visible_button_->SetImage( views::ImageButton::BS_HOT, ResourceBundle::GetSharedInstance(). - GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_HOVER)); + GetImageSkiaNamed(IDR_NETWORK_SHOW_PASSWORD_HOVER)); passphrase_visible_button_->SetToggledImage( views::ImageButton::BS_NORMAL, ResourceBundle::GetSharedInstance(). - GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_ON)); + GetImageSkiaNamed(IDR_NETWORK_SHOW_PASSWORD_ON)); passphrase_visible_button_->SetImageAlignment( views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); layout->AddView(passphrase_visible_button_); diff --git a/chrome/browser/first_run/try_chrome_dialog_view.cc b/chrome/browser/first_run/try_chrome_dialog_view.cc index 1eda4a6..082d7d0 100644 --- a/chrome/browser/first_run/try_chrome_dialog_view.cc +++ b/chrome/browser/first_run/try_chrome_dialog_view.cc @@ -64,7 +64,7 @@ TryChromeDialogView::Result TryChromeDialogView::ShowModal( ResourceBundle& rb = ResourceBundle::GetSharedInstance(); views::ImageView* icon = new views::ImageView(); - icon->SetImage(rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_32).ToSkBitmap()); + icon->SetImage(rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_32).ToImageSkia()); gfx::Size icon_size = icon->GetPreferredSize(); // An approximate window size. After Layout() we'll get better bounds. @@ -159,11 +159,11 @@ TryChromeDialogView::Result TryChromeDialogView::ShowModal( // The close button is custom. views::ImageButton* close_button = new views::ImageButton(this); close_button->SetImage(views::CustomButton::BS_NORMAL, - rb.GetNativeImageNamed(IDR_CLOSE_BAR).ToSkBitmap()); + rb.GetNativeImageNamed(IDR_CLOSE_BAR).ToImageSkia()); close_button->SetImage(views::CustomButton::BS_HOT, - rb.GetNativeImageNamed(IDR_CLOSE_BAR_H).ToSkBitmap()); + rb.GetNativeImageNamed(IDR_CLOSE_BAR_H).ToImageSkia()); close_button->SetImage(views::CustomButton::BS_PUSHED, - rb.GetNativeImageNamed(IDR_CLOSE_BAR_P).ToSkBitmap()); + rb.GetNativeImageNamed(IDR_CLOSE_BAR_P).ToImageSkia()); close_button->set_tag(BT_CLOSE_BUTTON); layout->AddView(close_button); diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.cc b/chrome/browser/ui/panels/panel_browser_frame_view.cc index 61489a8..6f181f6 100644 --- a/chrome/browser/ui/panels/panel_browser_frame_view.cc +++ b/chrome/browser/ui/panels/panel_browser_frame_view.cc @@ -110,16 +110,16 @@ const SkColor kBorderColor = 0xc0000000; const SkColor kDividerColor = 0xffb5b5b5; struct ButtonResources { - SkBitmap* normal_image; - SkBitmap* hover_image; + gfx::ImageSkia* normal_image; + gfx::ImageSkia* hover_image; string16 tooltip_text; ButtonResources(int normal_image_id, int hover_image_id, int tooltip_id) : normal_image(NULL), hover_image(NULL) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - normal_image = rb.GetBitmapNamed(normal_image_id); - hover_image = rb.GetBitmapNamed(hover_image_id); + normal_image = rb.GetImageSkiaNamed(normal_image_id); + hover_image = rb.GetImageSkiaNamed(hover_image_id); tooltip_text = l10n_util::GetStringUTF16(tooltip_id); } }; diff --git a/chrome/browser/ui/tests/ui_gfx_image_unittest.cc b/chrome/browser/ui/tests/ui_gfx_image_unittest.cc index 6640a63..dedf6df 100644 --- a/chrome/browser/ui/tests/ui_gfx_image_unittest.cc +++ b/chrome/browser/ui/tests/ui_gfx_image_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -30,7 +30,7 @@ TEST(UiGfxImageTest, ViewsImageView) { container->SetVisible(true); scoped_ptr<views::ImageView> image_view(new views::ImageView()); - image_view->SetImage(*image.ToSkBitmap()); + image_view->SetImage(*image.ToImageSkia()); container->AddChildView(image_view.get()); } #endif diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc index 14a0c03..ead319f 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc +++ b/chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc @@ -298,10 +298,10 @@ const SkBitmap* AutocompleteResultView::GetIcon() const { return ui::ResourceBundle::GetSharedInstance().GetBitmapNamed(icon); } -const SkBitmap* AutocompleteResultView::GetKeywordIcon() const { +const gfx::ImageSkia* AutocompleteResultView::GetKeywordIcon() const { // NOTE: If we ever begin returning icons of varying size, then callers need // to ensure that |keyword_icon_| is resized each time its image is reset. - return ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( + return ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( (GetState() == SELECTED) ? IDR_OMNIBOX_TTS_SELECTED : IDR_OMNIBOX_TTS); } @@ -632,4 +632,3 @@ void AutocompleteResultView::AnimationProgressed( Layout(); SchedulePaint(); } - diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_result_view.h b/chrome/browser/ui/views/autocomplete/autocomplete_result_view.h index 7d79dfd..bdaf700 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_result_view.h +++ b/chrome/browser/ui/views/autocomplete/autocomplete_result_view.h @@ -94,7 +94,7 @@ class AutocompleteResultView : public views::View, ResultViewState GetState() const; const SkBitmap* GetIcon() const; - const SkBitmap* GetKeywordIcon() const; + const gfx::ImageSkia* GetKeywordIcon() const; // Elides |runs| to fit in |remaining_width|. The runs in |runs| should be in // logical order. diff --git a/chrome/browser/ui/views/avatar_menu_bubble_view.cc b/chrome/browser/ui/views/avatar_menu_bubble_view.cc index e23d3ee..fea4611 100644 --- a/chrome/browser/ui/views/avatar_menu_bubble_view.cc +++ b/chrome/browser/ui/views/avatar_menu_bubble_view.cc @@ -183,9 +183,9 @@ ProfileItemView::ProfileItemView(const AvatarMenuModel::Item& item, SkBitmap profile_icon = *item_.icon.ToSkBitmap(); if (item_.active) { SkBitmap badged_icon(GetBadgedIcon(profile_icon)); - image_view_->SetImage(&badged_icon); + image_view_->SetImage(badged_icon); } else { - image_view_->SetImage(&profile_icon); + image_view_->SetImage(profile_icon); } AddChildView(image_view_); diff --git a/chrome/browser/ui/views/chrome_to_mobile_bubble_view.cc b/chrome/browser/ui/views/chrome_to_mobile_bubble_view.cc index 918f7e6..a52d855 100644 --- a/chrome/browser/ui/views/chrome_to_mobile_bubble_view.cc +++ b/chrome/browser/ui/views/chrome_to_mobile_bubble_view.cc @@ -72,7 +72,8 @@ void CheckboxNativeThemeBorder::GetInsets(gfx::Insets* insets) const { void SetImageViewToId(views::View* image_view, int id) { views::ImageView* image = static_cast<views::ImageView*>(image_view); if (image) - image->SetImage(ui::ResourceBundle::GetSharedInstance().GetBitmapNamed(id)); + image->SetImage( + ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(id)); } } // namespace diff --git a/chrome/browser/ui/views/collected_cookies_views.cc b/chrome/browser/ui/views/collected_cookies_views.cc index 6b8722c..68dbdf5 100644 --- a/chrome/browser/ui/views/collected_cookies_views.cc +++ b/chrome/browser/ui/views/collected_cookies_views.cc @@ -85,7 +85,7 @@ class InfobarView : public views::View { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); info_image_ = new views::ImageView(); - info_image_->SetImage(rb.GetBitmapNamed(IDR_INFO)); + info_image_->SetImage(rb.GetImageSkiaNamed(IDR_INFO)); label_ = new views::Label(); } virtual ~InfobarView() {} diff --git a/chrome/browser/ui/views/confirm_bubble_view.cc b/chrome/browser/ui/views/confirm_bubble_view.cc index 59338b4..21655cb 100644 --- a/chrome/browser/ui/views/confirm_bubble_view.cc +++ b/chrome/browser/ui/views/confirm_bubble_view.cc @@ -80,7 +80,7 @@ void ConfirmBubbleView::Init() { gfx::Image* icon_image = model_->GetIcon(); DCHECK(icon_image); views::ImageView* icon_view = new views::ImageView; - icon_view->SetImage(icon_image->ToSkBitmap()); + icon_view->SetImage(icon_image->ToImageSkia()); layout->AddView(icon_view); const string16 title_text = model_->GetTitle(); @@ -90,8 +90,8 @@ void ConfirmBubbleView::Init() { layout->AddView(title_label); views::ImageButton* close_button = new views::ImageButton(this); - const SkBitmap* close_image = - bundle.GetImageNamed(IDR_INFO_BUBBLE_CLOSE).ToSkBitmap(); + const gfx::ImageSkia* close_image = + bundle.GetImageNamed(IDR_INFO_BUBBLE_CLOSE).ToImageSkia(); close_button->SetImage(views::CustomButton::BS_NORMAL, close_image); close_button->set_tag(ConfirmBubbleModel::BUTTON_NONE); layout->AddView(close_button); diff --git a/chrome/browser/ui/views/constrained_window_views.cc b/chrome/browser/ui/views/constrained_window_views.cc index d778383..53d479f 100644 --- a/chrome/browser/ui/views/constrained_window_views.cc +++ b/chrome/browser/ui/views/constrained_window_views.cc @@ -296,11 +296,11 @@ ConstrainedWindowFrameView::ConstrainedWindowFrameView( ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); close_button_->SetImage(views::CustomButton::BS_NORMAL, - rb.GetBitmapNamed(IDR_CLOSE_SA)); + rb.GetImageSkiaNamed(IDR_CLOSE_SA)); close_button_->SetImage(views::CustomButton::BS_HOT, - rb.GetBitmapNamed(IDR_CLOSE_SA_H)); + rb.GetImageSkiaNamed(IDR_CLOSE_SA_H)); close_button_->SetImage(views::CustomButton::BS_PUSHED, - rb.GetBitmapNamed(IDR_CLOSE_SA_P)); + rb.GetImageSkiaNamed(IDR_CLOSE_SA_P)); close_button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); AddChildView(close_button_); diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc index 14e16504..a627bc2 100644 --- a/chrome/browser/ui/views/create_application_shortcut_view.cc +++ b/chrome/browser/ui/views/create_application_shortcut_view.cc @@ -161,7 +161,7 @@ void AppInfoView::UpdateText(const string16& title, void AppInfoView::UpdateIcon(const gfx::Image& image) { if (!image.IsEmpty()) - icon_->SetImage(image.ToSkBitmap()); + icon_->SetImage(image.ToImageSkia()); } void AppInfoView::OnPaint(gfx::Canvas* canvas) { diff --git a/chrome/browser/ui/views/critical_notification_bubble_view.cc b/chrome/browser/ui/views/critical_notification_bubble_view.cc index ecf88f7..5020f6e 100644 --- a/chrome/browser/ui/views/critical_notification_bubble_view.cc +++ b/chrome/browser/ui/views/critical_notification_bubble_view.cc @@ -176,7 +176,7 @@ void CriticalNotificationBubbleView::Init() { layout->StartRow(0, top_column_set_id); views::ImageView* image = new views::ImageView(); - image->SetImage(rb.GetBitmapNamed(IDR_UPDATE_MENU3)); + image->SetImage(rb.GetImageSkiaNamed(IDR_UPDATE_MENU3)); layout->AddView(image); headline_ = new views::Label(); diff --git a/chrome/browser/ui/views/download/download_shelf_view.cc b/chrome/browser/ui/views/download/download_shelf_view.cc index 8660740..0d11adf9 100644 --- a/chrome/browser/ui/views/download/download_shelf_view.cc +++ b/chrome/browser/ui/views/download/download_shelf_view.cc @@ -307,7 +307,7 @@ void DownloadShelfView::ViewHierarchyChanged(bool is_add, ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); arrow_image_ = new views::ImageView(); - arrow_image_->SetImage(rb.GetBitmapNamed(IDR_DOWNLOADS_FAVICON)); + arrow_image_->SetImage(rb.GetImageSkiaNamed(IDR_DOWNLOADS_FAVICON)); AddChildView(arrow_image_); show_all_view_ = new views::Link( @@ -320,11 +320,11 @@ void DownloadShelfView::ViewHierarchyChanged(bool is_add, close_button_ = new views::ImageButton(this); close_button_->SetImage(views::CustomButton::BS_NORMAL, - rb.GetBitmapNamed(IDR_CLOSE_BAR)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR)); close_button_->SetImage(views::CustomButton::BS_HOT, - rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR_H)); close_button_->SetImage(views::CustomButton::BS_PUSHED, - rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR_P)); close_button_->SetAccessibleName( l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); UpdateButtonColors(); @@ -364,8 +364,8 @@ void DownloadShelfView::UpdateButtonColors() { if (GetThemeProvider()) { close_button_->SetBackground( GetThemeProvider()->GetColor(ThemeService::COLOR_TAB_TEXT), - rb.GetBitmapNamed(IDR_CLOSE_BAR), - rb.GetBitmapNamed(IDR_CLOSE_BAR_MASK)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR), + rb.GetImageSkiaNamed(IDR_CLOSE_BAR_MASK)); } } diff --git a/chrome/browser/ui/views/download/download_started_animation_views.cc b/chrome/browser/ui/views/download/download_started_animation_views.cc index fd4d9c3..f711ca1 100644 --- a/chrome/browser/ui/views/download/download_started_animation_views.cc +++ b/chrome/browser/ui/views/download/download_started_animation_views.cc @@ -82,9 +82,9 @@ DownloadStartedAnimationWin::DownloadStartedAnimationWin( : ui::LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL), popup_(NULL), web_contents_(web_contents) { - static SkBitmap* kDownloadImage = NULL; + static gfx::ImageSkia* kDownloadImage = NULL; if (!kDownloadImage) { - kDownloadImage = ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( + kDownloadImage = ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_DOWNLOAD_ANIMATION_BEGIN); } diff --git a/chrome/browser/ui/views/dropdown_bar_view.cc b/chrome/browser/ui/views/dropdown_bar_view.cc index dd91908..42e1f3b 100644 --- a/chrome/browser/ui/views/dropdown_bar_view.cc +++ b/chrome/browser/ui/views/dropdown_bar_view.cc @@ -13,6 +13,7 @@ #include "third_party/skia/include/core/SkRect.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" +#include "ui/gfx/image/image_skia.h" #include "ui/views/background.h" #include "ui/views/border.h" #include "ui/views/painter.h" @@ -29,8 +30,8 @@ const int kAnimatingEdgeHeight = 5; class DropdownBackground : public views::Background { public: explicit DropdownBackground(BrowserView* browser, - const SkBitmap* left_alpha_mask, - const SkBitmap* right_alpha_mask); + const gfx::ImageSkia* left_alpha_mask, + const gfx::ImageSkia* right_alpha_mask); virtual ~DropdownBackground() {} // Overridden from views::Background. @@ -38,15 +39,15 @@ class DropdownBackground : public views::Background { private: BrowserView* browser_view_; - const SkBitmap* left_alpha_mask_; - const SkBitmap* right_alpha_mask_; + const gfx::ImageSkia* left_alpha_mask_; + const gfx::ImageSkia* right_alpha_mask_; DISALLOW_COPY_AND_ASSIGN(DropdownBackground); }; DropdownBackground::DropdownBackground(BrowserView* browser_view, - const SkBitmap* left_alpha_mask, - const SkBitmap* right_alpha_mask) + const gfx::ImageSkia* left_alpha_mask, + const gfx::ImageSkia* right_alpha_mask) : browser_view_(browser_view), left_alpha_mask_(left_alpha_mask), right_alpha_mask_(right_alpha_mask) { @@ -122,8 +123,8 @@ void DropdownBarView::OnPaint(gfx::Canvas* canvas) { //////////////////////////////////////////////////////////////////////////////// // DropDownBarView, protected: -void DropdownBarView::SetBackground(const SkBitmap* left_alpha_mask, - const SkBitmap* right_alpha_mask) { +void DropdownBarView::SetBackground(const gfx::ImageSkia* left_alpha_mask, + const gfx::ImageSkia* right_alpha_mask) { set_background(new DropdownBackground(host()->browser_view(), left_alpha_mask, right_alpha_mask)); } diff --git a/chrome/browser/ui/views/dropdown_bar_view.h b/chrome/browser/ui/views/dropdown_bar_view.h index 635f0a6..a8b7c01 100644 --- a/chrome/browser/ui/views/dropdown_bar_view.h +++ b/chrome/browser/ui/views/dropdown_bar_view.h @@ -12,6 +12,7 @@ namespace gfx { class Canvas; +class ImageSkia; } // namespace gfx //////////////////////////////////////////////////////////////////////////////// @@ -40,8 +41,8 @@ class DropdownBarView : public views::AccessiblePaneView, // Returns the DropdownBarHost that manages this view. DropdownBarHost* host() const { return host_; } - void SetBackground(const SkBitmap* left_alpha_mask, - const SkBitmap* right_alpha_mask); + void SetBackground(const gfx::ImageSkia* left_alpha_mask, + const gfx::ImageSkia* right_alpha_mask); void SetBorder(int left_border_bitmap_id, int middle_border_bitmap_id, int right_border_bitmap_id); diff --git a/chrome/browser/ui/views/edit_search_engine_dialog.cc b/chrome/browser/ui/views/edit_search_engine_dialog.cc index d962008..6aeeeec 100644 --- a/chrome/browser/ui/views/edit_search_engine_dialog.cc +++ b/chrome/browser/ui/views/edit_search_engine_dialog.cc @@ -251,9 +251,9 @@ void EditSearchEngineDialog::UpdateImageView(ImageView* image_view, ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); if (is_valid) { image_view->SetTooltipText(string16()); - image_view->SetImage(rb.GetBitmapNamed(IDR_INPUT_GOOD)); + image_view->SetImage(rb.GetImageSkiaNamed(IDR_INPUT_GOOD)); } else { image_view->SetTooltipText(l10n_util::GetStringUTF16(invalid_message_id)); - image_view->SetImage(rb.GetBitmapNamed(IDR_INPUT_ALERT)); + image_view->SetImage(rb.GetImageSkiaNamed(IDR_INPUT_ALERT)); } } diff --git a/chrome/browser/ui/views/extensions/bundle_installed_bubble.cc b/chrome/browser/ui/views/extensions/bundle_installed_bubble.cc index 49f8bf4..6aa7d9e 100644 --- a/chrome/browser/ui/views/extensions/bundle_installed_bubble.cc +++ b/chrome/browser/ui/views/extensions/bundle_installed_bubble.cc @@ -130,11 +130,11 @@ class BundleInstalledBubble : public views::BubbleDelegateView, views::ImageButton* button = new views::ImageButton(listener); button->SetImage(views::CustomButton::BS_NORMAL, - rb.GetBitmapNamed(IDR_CLOSE_BAR)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR)); button->SetImage(views::CustomButton::BS_HOT, - rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR_H)); button->SetImage(views::CustomButton::BS_PUSHED, - rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR_P)); layout->AddView(button); } diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc index 8b767db..d20b36c 100644 --- a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc +++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc @@ -225,11 +225,11 @@ class InstalledBubbleContent : public views::View, close_button_ = new views::ImageButton(this); close_button_->SetImage(views::CustomButton::BS_NORMAL, - rb.GetBitmapNamed(IDR_CLOSE_BAR)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR)); close_button_->SetImage(views::CustomButton::BS_HOT, - rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR_H)); close_button_->SetImage(views::CustomButton::BS_PUSHED, - rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR_P)); AddChildView(close_button_); } diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc index 8b9b97a..34695e0 100644 --- a/chrome/browser/ui/views/find_bar_view.cc +++ b/chrome/browser/ui/views/find_bar_view.cc @@ -100,11 +100,11 @@ FindBarView::FindBarView(FindBarHost* host) find_previous_button_->set_tag(FIND_PREVIOUS_TAG); find_previous_button_->set_focusable(true); find_previous_button_->SetImage(views::CustomButton::BS_NORMAL, - rb.GetBitmapNamed(IDR_FINDINPAGE_PREV)); + rb.GetImageSkiaNamed(IDR_FINDINPAGE_PREV)); find_previous_button_->SetImage(views::CustomButton::BS_HOT, - rb.GetBitmapNamed(IDR_FINDINPAGE_PREV_H)); + rb.GetImageSkiaNamed(IDR_FINDINPAGE_PREV_H)); find_previous_button_->SetImage(views::CustomButton::BS_DISABLED, - rb.GetBitmapNamed(IDR_FINDINPAGE_PREV_P)); + rb.GetImageSkiaNamed(IDR_FINDINPAGE_PREV_P)); find_previous_button_->SetTooltipText( l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_PREVIOUS_TOOLTIP)); find_previous_button_->SetAccessibleName( @@ -115,11 +115,11 @@ FindBarView::FindBarView(FindBarHost* host) find_next_button_->set_tag(FIND_NEXT_TAG); find_next_button_->set_focusable(true); find_next_button_->SetImage(views::CustomButton::BS_NORMAL, - rb.GetBitmapNamed(IDR_FINDINPAGE_NEXT)); + rb.GetImageSkiaNamed(IDR_FINDINPAGE_NEXT)); find_next_button_->SetImage(views::CustomButton::BS_HOT, - rb.GetBitmapNamed(IDR_FINDINPAGE_NEXT_H)); + rb.GetImageSkiaNamed(IDR_FINDINPAGE_NEXT_H)); find_next_button_->SetImage(views::CustomButton::BS_DISABLED, - rb.GetBitmapNamed(IDR_FINDINPAGE_NEXT_P)); + rb.GetImageSkiaNamed(IDR_FINDINPAGE_NEXT_P)); find_next_button_->SetTooltipText( l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_NEXT_TOOLTIP)); find_next_button_->SetAccessibleName( @@ -130,19 +130,19 @@ FindBarView::FindBarView(FindBarHost* host) close_button_->set_tag(CLOSE_TAG); close_button_->set_focusable(true); close_button_->SetImage(views::CustomButton::BS_NORMAL, - rb.GetBitmapNamed(IDR_CLOSE_BAR)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR)); close_button_->SetImage(views::CustomButton::BS_HOT, - rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR_H)); close_button_->SetImage(views::CustomButton::BS_PUSHED, - rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR_P)); close_button_->SetTooltipText( l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_CLOSE_TOOLTIP)); close_button_->SetAccessibleName( l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); AddChildView(close_button_); - SetBackground(rb.GetBitmapNamed(IDR_FIND_DLG_LEFT_BACKGROUND), - rb.GetBitmapNamed(IDR_FIND_DLG_RIGHT_BACKGROUND)); + SetBackground(rb.GetImageSkiaNamed(IDR_FIND_DLG_LEFT_BACKGROUND), + rb.GetImageSkiaNamed(IDR_FIND_DLG_RIGHT_BACKGROUND)); SetBorder(IDR_FIND_DIALOG_LEFT, IDR_FIND_DIALOG_MIDDLE, IDR_FIND_DIALOG_RIGHT); @@ -489,7 +489,7 @@ void FindBarView::OnThemeChanged() { if (GetThemeProvider()) { close_button_->SetBackground( GetThemeProvider()->GetColor(ThemeService::COLOR_TAB_TEXT), - rb.GetBitmapNamed(IDR_CLOSE_BAR), - rb.GetBitmapNamed(IDR_CLOSE_BAR_MASK)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR), + rb.GetImageSkiaNamed(IDR_CLOSE_BAR_MASK)); } } diff --git a/chrome/browser/ui/views/frame/app_non_client_frame_view_aura.cc b/chrome/browser/ui/views/frame/app_non_client_frame_view_aura.cc index db807d5..c0be976 100644 --- a/chrome/browser/ui/views/frame/app_non_client_frame_view_aura.cc +++ b/chrome/browser/ui/views/frame/app_non_client_frame_view_aura.cc @@ -132,11 +132,11 @@ class AppNonClientFrameViewAura::ControlView int hot_bitmap_id, int pushed_bitmap_id) { ui::ThemeProvider* theme_provider = GetThemeProvider(); button->SetImage(views::CustomButton::BS_NORMAL, - theme_provider->GetBitmapNamed(normal_bitmap_id)); + theme_provider->GetImageSkiaNamed(normal_bitmap_id)); button->SetImage(views::CustomButton::BS_HOT, - theme_provider->GetBitmapNamed(hot_bitmap_id)); + theme_provider->GetImageSkiaNamed(hot_bitmap_id)); button->SetImage(views::CustomButton::BS_PUSHED, - theme_provider->GetBitmapNamed(pushed_bitmap_id)); + theme_provider->GetImageSkiaNamed(pushed_bitmap_id)); } AppNonClientFrameViewAura* owner_; diff --git a/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc index 75c42c1..e117d1b 100644 --- a/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc @@ -73,11 +73,11 @@ AppPanelBrowserFrameView::AppPanelBrowserFrameView(BrowserFrame* frame, ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); close_button_->SetImage(views::CustomButton::BS_NORMAL, - rb.GetBitmapNamed(IDR_CLOSE_BAR)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR)); close_button_->SetImage(views::CustomButton::BS_HOT, - rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR_H)); close_button_->SetImage(views::CustomButton::BS_PUSHED, - rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR_P)); close_button_->SetAccessibleName( l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); AddChildView(close_button_); diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc index f4d82c8..df884f0 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc @@ -463,16 +463,16 @@ views::ImageButton* OpaqueBrowserFrameView::InitWindowCaptionButton( views::ImageButton* button = new views::ImageButton(this); ui::ThemeProvider* tp = frame()->GetThemeProvider(); button->SetImage(views::CustomButton::BS_NORMAL, - tp->GetBitmapNamed(normal_bitmap_id)); + tp->GetImageSkiaNamed(normal_bitmap_id)); button->SetImage(views::CustomButton::BS_HOT, - tp->GetBitmapNamed(hot_bitmap_id)); + tp->GetImageSkiaNamed(hot_bitmap_id)); button->SetImage(views::CustomButton::BS_PUSHED, - tp->GetBitmapNamed(pushed_bitmap_id)); + tp->GetImageSkiaNamed(pushed_bitmap_id)); if (browser_view()->IsBrowserTypeNormal()) { button->SetBackground( tp->GetColor(ThemeService::COLOR_BUTTON_BACKGROUND), - tp->GetBitmapNamed(IDR_THEME_WINDOW_CONTROL_BACKGROUND), - tp->GetBitmapNamed(mask_bitmap_id)); + tp->GetImageSkiaNamed(IDR_THEME_WINDOW_CONTROL_BACKGROUND), + tp->GetImageSkiaNamed(mask_bitmap_id)); } button->SetAccessibleName( l10n_util::GetStringUTF16(accessibility_string_id)); diff --git a/chrome/browser/ui/views/global_error_bubble_view.cc b/chrome/browser/ui/views/global_error_bubble_view.cc index 4733035..4d3044e 100644 --- a/chrome/browser/ui/views/global_error_bubble_view.cc +++ b/chrome/browser/ui/views/global_error_bubble_view.cc @@ -69,7 +69,7 @@ GlobalErrorBubbleView::GlobalErrorBubbleView( ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); int resource_id = error_->GetBubbleViewIconResourceID(); scoped_ptr<views::ImageView> image_view(new views::ImageView()); - image_view->SetImage(rb.GetImageNamed(resource_id).ToSkBitmap()); + image_view->SetImage(rb.GetImageNamed(resource_id).ToImageSkia()); string16 title_string(error_->GetBubbleViewTitle()); scoped_ptr<views::Label> title_label(new views::Label(title_string)); diff --git a/chrome/browser/ui/views/hung_renderer_view.cc b/chrome/browser/ui/views/hung_renderer_view.cc index a3d6b4b..bcd3e91 100644 --- a/chrome/browser/ui/views/hung_renderer_view.cc +++ b/chrome/browser/ui/views/hung_renderer_view.cc @@ -300,13 +300,13 @@ class HungRendererDialogView : public views::DialogDelegateView, bool initialized_; // An amusing icon image. - static SkBitmap* frozen_icon_; + static gfx::ImageSkia* frozen_icon_; DISALLOW_COPY_AND_ASSIGN(HungRendererDialogView); }; // static -SkBitmap* HungRendererDialogView::frozen_icon_ = NULL; +gfx::ImageSkia* HungRendererDialogView::frozen_icon_ = NULL; // The distance in pixels from the top of the relevant contents to place the // warning window. @@ -556,7 +556,7 @@ void HungRendererDialogView::InitClass() { static bool initialized = false; if (!initialized) { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - frozen_icon_ = rb.GetBitmapNamed(IDR_FROZEN_TAB_ICON); + frozen_icon_ = rb.GetImageSkiaNamed(IDR_FROZEN_TAB_ICON); initialized = true; } } diff --git a/chrome/browser/ui/views/infobars/infobar_view.cc b/chrome/browser/ui/views/infobars/infobar_view.cc index c22de3b..9b7b9fe 100644 --- a/chrome/browser/ui/views/infobars/infobar_view.cc +++ b/chrome/browser/ui/views/infobars/infobar_view.cc @@ -218,18 +218,18 @@ void InfoBarView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { gfx::Image* image = delegate()->GetIcon(); if (image) { icon_ = new views::ImageView; - icon_->SetImage(image->ToSkBitmap()); + icon_->SetImage(image->ToImageSkia()); AddChildView(icon_); } close_button_ = new views::ImageButton(this); ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); close_button_->SetImage(views::CustomButton::BS_NORMAL, - rb.GetImageNamed(IDR_CLOSE_BAR).ToSkBitmap()); + rb.GetImageNamed(IDR_CLOSE_BAR).ToImageSkia()); close_button_->SetImage(views::CustomButton::BS_HOT, - rb.GetImageNamed(IDR_CLOSE_BAR_H).ToSkBitmap()); + rb.GetImageNamed(IDR_CLOSE_BAR_H).ToImageSkia()); close_button_->SetImage(views::CustomButton::BS_PUSHED, - rb.GetImageNamed(IDR_CLOSE_BAR_P).ToSkBitmap()); + rb.GetImageNamed(IDR_CLOSE_BAR_P).ToImageSkia()); close_button_->SetAccessibleName( l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); close_button_->set_focusable(true); diff --git a/chrome/browser/ui/views/location_bar/chrome_to_mobile_view.cc b/chrome/browser/ui/views/location_bar/chrome_to_mobile_view.cc index 5c6c0c7..0e8d991 100644 --- a/chrome/browser/ui/views/location_bar/chrome_to_mobile_view.cc +++ b/chrome/browser/ui/views/location_bar/chrome_to_mobile_view.cc @@ -22,7 +22,8 @@ ChromeToMobileView::ChromeToMobileView( command_updater_(command_updater) { set_id(VIEW_ID_CHROME_TO_MOBILE_BUTTON); set_accessibility_focusable(true); - SetImage(ui::ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_MOBILE)); + SetImage( + ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(IDR_MOBILE)); SetTooltipText( l10n_util::GetStringUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_TOOLTIP)); SetVisible(command_updater_->IsCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE)); diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc index c207f5f..c9d315e 100644 --- a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc +++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc @@ -73,7 +73,7 @@ void ContentSettingImageView::UpdateFromWebContents(WebContents* web_contents) { SetVisible(false); return; } - SetImage(ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( + SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( content_setting_image_model_->get_icon())); SetTooltipText(UTF8ToUTF16(content_setting_image_model_->get_tooltip())); SetVisible(true); diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc index 04fd098..19e405f 100644 --- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc +++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc @@ -26,7 +26,8 @@ IconLabelBubbleView::IconLabelBubbleView(const int background_images[], is_extension_icon_(false) { image_ = new views::ImageView(); image_->SetImage( - ui::ResourceBundle::GetSharedInstance().GetBitmapNamed(contained_image)); + ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + contained_image)); AddChildView(image_); label_ = new views::Label(); diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index 75760df..ca9c652 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -602,7 +602,7 @@ void LocationBarView::Layout() { } else { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); selected_keyword_view_->SetImage( - *rb.GetBitmapNamed(IDR_OMNIBOX_SEARCH)); + *rb.GetImageSkiaNamed(IDR_OMNIBOX_SEARCH)); selected_keyword_view_->set_is_extension_icon(false); } } @@ -873,7 +873,7 @@ void LocationBarView::OnAutocompleteAccept( void LocationBarView::OnChanged() { location_icon_view_->SetImage( - ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( + ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( location_entry_->GetIcon())); location_icon_view_->ShowTooltip(!GetLocationEntry()->IsEditingOrEmpty()); diff --git a/chrome/browser/ui/views/location_bar/page_action_image_view.cc b/chrome/browser/ui/views/location_bar/page_action_image_view.cc index 5877e02..a7bcf21a 100644 --- a/chrome/browser/ui/views/location_bar/page_action_image_view.cc +++ b/chrome/browser/ui/views/location_bar/page_action_image_view.cc @@ -256,7 +256,7 @@ void PageActionImageView::UpdateVisibility(WebContents* contents, } } if (!icon.isNull()) - SetImage(&icon); + SetImage(icon); SetVisible(true); } diff --git a/chrome/browser/ui/views/location_bar/star_view.cc b/chrome/browser/ui/views/location_bar/star_view.cc index 98a2d2c..42c09eb 100644 --- a/chrome/browser/ui/views/location_bar/star_view.cc +++ b/chrome/browser/ui/views/location_bar/star_view.cc @@ -29,7 +29,7 @@ StarView::~StarView() { void StarView::SetToggled(bool on) { SetTooltipText(l10n_util::GetStringUTF16( on ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR)); - SetImage(ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( + SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( on ? IDR_STAR_LIT : IDR_STAR)); } diff --git a/chrome/browser/ui/views/notifications/balloon_view.cc b/chrome/browser/ui/views/notifications/balloon_view.cc index 1b3e838..9644487 100644 --- a/chrome/browser/ui/views/notifications/balloon_view.cc +++ b/chrome/browser/ui/views/notifications/balloon_view.cc @@ -380,15 +380,15 @@ void BalloonViewImpl::Show(Balloon* balloon) { frame_container_->SetAlwaysOnTop(true); close_button_->SetImage(views::CustomButton::BS_NORMAL, - rb.GetBitmapNamed(IDR_TAB_CLOSE)); + rb.GetImageSkiaNamed(IDR_TAB_CLOSE)); close_button_->SetImage(views::CustomButton::BS_HOT, - rb.GetBitmapNamed(IDR_TAB_CLOSE_H)); + rb.GetImageSkiaNamed(IDR_TAB_CLOSE_H)); close_button_->SetImage(views::CustomButton::BS_PUSHED, - rb.GetBitmapNamed(IDR_TAB_CLOSE_P)); + rb.GetImageSkiaNamed(IDR_TAB_CLOSE_P)); close_button_->SetBoundsRect(GetCloseButtonBounds()); close_button_->SetBackground(SK_ColorBLACK, - rb.GetBitmapNamed(IDR_TAB_CLOSE), - rb.GetBitmapNamed(IDR_TAB_CLOSE_MASK)); + rb.GetImageSkiaNamed(IDR_TAB_CLOSE), + rb.GetImageSkiaNamed(IDR_TAB_CLOSE_MASK)); options_menu_button_->SetIcon(*rb.GetBitmapNamed(IDR_BALLOON_WRENCH)); options_menu_button_->SetHoverIcon(*rb.GetBitmapNamed(IDR_BALLOON_WRENCH_H)); diff --git a/chrome/browser/ui/views/sad_tab_view.cc b/chrome/browser/ui/views/sad_tab_view.cc index 566cf9b..3ba3f04 100644 --- a/chrome/browser/ui/views/sad_tab_view.cc +++ b/chrome/browser/ui/views/sad_tab_view.cc @@ -155,7 +155,7 @@ void SadTabView::ViewHierarchyChanged(bool is_add, columns->AddPaddingColumn(1, kPadding); views::ImageView* image = new views::ImageView(); - image->SetImage(ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( + image->SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( (kind_ == CRASHED) ? IDR_SAD_TAB : IDR_KILLED_TAB)); layout->StartRowWithPadding(0, column_set_id, 1, kPadding); layout->AddView(image); diff --git a/chrome/browser/ui/views/tabs/base_tab.cc b/chrome/browser/ui/views/tabs/base_tab.cc index ab79d0e..63d2965 100644 --- a/chrome/browser/ui/views/tabs/base_tab.cc +++ b/chrome/browser/ui/views/tabs/base_tab.cc @@ -160,11 +160,11 @@ BaseTab::BaseTab(TabController* controller) close_button_ = new TabCloseButton(this); ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); close_button_->SetImage(views::CustomButton::BS_NORMAL, - rb.GetBitmapNamed(IDR_TAB_CLOSE)); + rb.GetImageSkiaNamed(IDR_TAB_CLOSE)); close_button_->SetImage(views::CustomButton::BS_HOT, - rb.GetBitmapNamed(IDR_TAB_CLOSE_H)); + rb.GetImageSkiaNamed(IDR_TAB_CLOSE_H)); close_button_->SetImage(views::CustomButton::BS_PUSHED, - rb.GetBitmapNamed(IDR_TAB_CLOSE_P)); + rb.GetImageSkiaNamed(IDR_TAB_CLOSE_P)); close_button_->SetAccessibleName( l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); // Disable animation so that the red danger sign shows up immediately diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc index 06172b8..2a2184e 100644 --- a/chrome/browser/ui/views/tabs/tab.cc +++ b/chrome/browser/ui/views/tabs/tab.cc @@ -326,8 +326,8 @@ void Tab::OnPaint(gfx::Canvas* canvas) { close_button_color_ = title_color; ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); close_button()->SetBackground(close_button_color_, - rb.GetBitmapNamed(IDR_TAB_CLOSE), - rb.GetBitmapNamed(IDR_TAB_CLOSE_MASK)); + rb.GetImageSkiaNamed(IDR_TAB_CLOSE), + rb.GetImageSkiaNamed(IDR_TAB_CLOSE_MASK)); } } diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index 6b5e392..284c259 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc @@ -1226,7 +1226,7 @@ void TabStrip::Init() { AddChildView(newtab_button_); if (drop_indicator_width == 0) { // Direction doesn't matter, both images are the same size. - SkBitmap* drop_image = GetDropArrowImage(true); + gfx::ImageSkia* drop_image = GetDropArrowImage(true); drop_indicator_width = drop_image->width(); drop_indicator_height = drop_image->height(); } @@ -1804,8 +1804,8 @@ int TabStrip::GetDropEffect(const views::DropTargetEvent& event) { } // static -SkBitmap* TabStrip::GetDropArrowImage(bool is_down) { - return ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( +gfx::ImageSkia* TabStrip::GetDropArrowImage(bool is_down) { + return ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( is_down ? IDR_TAB_DROP_DOWN : IDR_TAB_DROP_UP); } diff --git a/chrome/browser/ui/views/tabs/tab_strip.h b/chrome/browser/ui/views/tabs/tab_strip.h index 6ebe33f..bd22a4e 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.h +++ b/chrome/browser/ui/views/tabs/tab_strip.h @@ -392,7 +392,7 @@ class TabStrip : public views::View, // Returns the image to use for indicating a drop on a tab. If is_down is // true, this returns an arrow pointing down. - static SkBitmap* GetDropArrowImage(bool is_down); + static gfx::ImageSkia* GetDropArrowImage(bool is_down); // -- Animations ------------------------------------------------------------ diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc index bdc2fe0..464db9f 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -748,41 +748,45 @@ int ToolbarView::PopupTopSpacing() const { void ToolbarView::LoadImages() { ui::ThemeProvider* tp = GetThemeProvider(); - back_->SetImage(views::CustomButton::BS_NORMAL, tp->GetBitmapNamed(IDR_BACK)); - back_->SetImage(views::CustomButton::BS_HOT, tp->GetBitmapNamed(IDR_BACK_H)); + back_->SetImage(views::CustomButton::BS_NORMAL, + tp->GetImageSkiaNamed(IDR_BACK)); + back_->SetImage(views::CustomButton::BS_HOT, + tp->GetImageSkiaNamed(IDR_BACK_H)); back_->SetImage(views::CustomButton::BS_PUSHED, - tp->GetBitmapNamed(IDR_BACK_P)); + tp->GetImageSkiaNamed(IDR_BACK_P)); back_->SetImage(views::CustomButton::BS_DISABLED, - tp->GetBitmapNamed(IDR_BACK_D)); + tp->GetImageSkiaNamed(IDR_BACK_D)); forward_->SetImage(views::CustomButton::BS_NORMAL, - tp->GetBitmapNamed(IDR_FORWARD)); + tp->GetImageSkiaNamed(IDR_FORWARD)); forward_->SetImage(views::CustomButton::BS_HOT, - tp->GetBitmapNamed(IDR_FORWARD_H)); + tp->GetImageSkiaNamed(IDR_FORWARD_H)); forward_->SetImage(views::CustomButton::BS_PUSHED, - tp->GetBitmapNamed(IDR_FORWARD_P)); + tp->GetImageSkiaNamed(IDR_FORWARD_P)); forward_->SetImage(views::CustomButton::BS_DISABLED, - tp->GetBitmapNamed(IDR_FORWARD_D)); + tp->GetImageSkiaNamed(IDR_FORWARD_D)); reload_->SetImage(views::CustomButton::BS_NORMAL, - tp->GetBitmapNamed(IDR_RELOAD)); + tp->GetImageSkiaNamed(IDR_RELOAD)); reload_->SetImage(views::CustomButton::BS_HOT, - tp->GetBitmapNamed(IDR_RELOAD_H)); + tp->GetImageSkiaNamed(IDR_RELOAD_H)); reload_->SetImage(views::CustomButton::BS_PUSHED, - tp->GetBitmapNamed(IDR_RELOAD_P)); + tp->GetImageSkiaNamed(IDR_RELOAD_P)); reload_->SetToggledImage(views::CustomButton::BS_NORMAL, - tp->GetBitmapNamed(IDR_STOP)); + tp->GetImageSkiaNamed(IDR_STOP)); reload_->SetToggledImage(views::CustomButton::BS_HOT, - tp->GetBitmapNamed(IDR_STOP_H)); + tp->GetImageSkiaNamed(IDR_STOP_H)); reload_->SetToggledImage(views::CustomButton::BS_PUSHED, - tp->GetBitmapNamed(IDR_STOP_P)); + tp->GetImageSkiaNamed(IDR_STOP_P)); reload_->SetToggledImage(views::CustomButton::BS_DISABLED, - tp->GetBitmapNamed(IDR_STOP_D)); + tp->GetImageSkiaNamed(IDR_STOP_D)); - home_->SetImage(views::CustomButton::BS_NORMAL, tp->GetBitmapNamed(IDR_HOME)); - home_->SetImage(views::CustomButton::BS_HOT, tp->GetBitmapNamed(IDR_HOME_H)); + home_->SetImage(views::CustomButton::BS_NORMAL, + tp->GetImageSkiaNamed(IDR_HOME)); + home_->SetImage(views::CustomButton::BS_HOT, + tp->GetImageSkiaNamed(IDR_HOME_H)); home_->SetImage(views::CustomButton::BS_PUSHED, - tp->GetBitmapNamed(IDR_HOME_P)); + tp->GetImageSkiaNamed(IDR_HOME_P)); app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); diff --git a/chrome/browser/ui/views/web_intent_picker_views.cc b/chrome/browser/ui/views/web_intent_picker_views.cc index 3ce1a08..ede5873 100644 --- a/chrome/browser/ui/views/web_intent_picker_views.cc +++ b/chrome/browser/ui/views/web_intent_picker_views.cc @@ -114,7 +114,7 @@ StarsView::StarsView(double rating) for (int i = 0; i < 5; ++i) { views::ImageView* image = new views::ImageView(); - image->SetImage(rb.GetBitmapNamed( + image->SetImage(rb.GetImageSkiaNamed( WebIntentPicker::GetNthStarImageIdFromCWSRating(rating, i))); AddChildView(image); } @@ -504,7 +504,7 @@ SuggestedExtensionsRowView::SuggestedExtensionsRowView( SetLayoutManager(new SuggestedExtensionsLayout); icon_ = new views::ImageView(); - icon_->SetImage(extension_->icon.ToSkBitmap()); + icon_->SetImage(extension_->icon.ToImageSkia()); AddChildView(icon_); string16 elided_title = ui::ElideText( @@ -924,7 +924,7 @@ void WebIntentPickerViews::OnInlineDispositionWebContentsLoaded( // Header row. grid_layout->StartRow(0, 0); views::ImageView* icon = new views::ImageView(); - icon->SetImage(service->favicon.ToSkBitmap()); + icon->SetImage(service->favicon.ToImageSkia()); grid_layout->AddView(icon); string16 elided_title = ui::ElideText( @@ -1158,11 +1158,11 @@ views::ImageButton* WebIntentPickerViews::CreateCloseButton() { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); views::ImageButton* close_button = new views::ImageButton(this); close_button->SetImage(views::CustomButton::BS_NORMAL, - rb.GetBitmapNamed(IDR_CLOSE_BAR)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR)); close_button->SetImage(views::CustomButton::BS_HOT, - rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR_H)); close_button->SetImage(views::CustomButton::BS_PUSHED, - rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); + rb.GetImageSkiaNamed(IDR_CLOSE_BAR_P)); return close_button; } #endif diff --git a/chrome/browser/ui/views/wrench_menu.cc b/chrome/browser/ui/views/wrench_menu.cc index 753e80f..0541196 100644 --- a/chrome/browser/ui/views/wrench_menu.cc +++ b/chrome/browser/ui/views/wrench_menu.cc @@ -426,7 +426,7 @@ class WrenchMenu::ZoomView : public WrenchMenuView, fullscreen_button_ = new FullscreenButton(this); fullscreen_button_->SetImage( ImageButton::BS_NORMAL, - ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( + ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_FULLSCREEN_MENU_BUTTON)); fullscreen_button_->set_focusable(true); fullscreen_button_->set_request_focus_on_press(false); diff --git a/ui/views/controls/button/image_button.cc b/ui/views/controls/button/image_button.cc index 85c705d..35e4960 100644 --- a/ui/views/controls/button/image_button.cc +++ b/ui/views/controls/button/image_button.cc @@ -31,14 +31,14 @@ ImageButton::ImageButton(ButtonListener* listener) ImageButton::~ImageButton() { } -void ImageButton::SetImage(ButtonState state, const SkBitmap* image) { - images_[state] = image ? *image : SkBitmap(); +void ImageButton::SetImage(ButtonState state, const gfx::ImageSkia* image) { + images_[state] = image ? *image : gfx::ImageSkia(); PreferredSizeChanged(); } void ImageButton::SetBackground(SkColor color, - const SkBitmap* image, - const SkBitmap* mask) { + const gfx::ImageSkia* image, + const gfx::ImageSkia* mask) { if (!image || !mask) { background_image_.reset(); return; @@ -143,13 +143,13 @@ void ToggleImageButton::SetToggled(bool toggled) { } void ToggleImageButton::SetToggledImage(ButtonState state, - const SkBitmap* image) { + const gfx::ImageSkia* image) { if (toggled_) { - images_[state] = image ? *image : SkBitmap(); + images_[state] = image ? *image : gfx::ImageSkia(); if (state_ == state) SchedulePaint(); } else { - alternate_images_[state] = image ? *image : SkBitmap(); + alternate_images_[state] = image ? *image : gfx::ImageSkia(); } } @@ -160,11 +160,12 @@ void ToggleImageButton::SetToggledTooltipText(const string16& tooltip) { //////////////////////////////////////////////////////////////////////////////// // ToggleImageButton, ImageButton overrides: -void ToggleImageButton::SetImage(ButtonState state, const SkBitmap* image) { +void ToggleImageButton::SetImage(ButtonState state, + const gfx::ImageSkia* image) { if (toggled_) { - alternate_images_[state] = image ? *image : SkBitmap(); + alternate_images_[state] = image ? *image : gfx::ImageSkia(); } else { - images_[state] = image ? *image : SkBitmap(); + images_[state] = image ? *image : gfx::ImageSkia(); if (state_ == state) SchedulePaint(); } diff --git a/ui/views/controls/button/image_button.h b/ui/views/controls/button/image_button.h index ed0c80e..3a54e20 100644 --- a/ui/views/controls/button/image_button.h +++ b/ui/views/controls/button/image_button.h @@ -8,6 +8,7 @@ #include "base/gtest_prod_util.h" #include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/image/image_skia.h" #include "ui/views/controls/button/custom_button.h" namespace views { @@ -36,12 +37,12 @@ class VIEWS_EXPORT ImageButton : public CustomButton { virtual ~ImageButton(); // Set the image the button should use for the provided state. - virtual void SetImage(ButtonState state, const SkBitmap* image); + virtual void SetImage(ButtonState state, const gfx::ImageSkia* image); // Set the background details. void SetBackground(SkColor color, - const SkBitmap* image, - const SkBitmap* mask); + const gfx::ImageSkia* image, + const gfx::ImageSkia* mask); // Set an |image| to draw on top of the normal / hot / pushed image. // Pass NULL for no image. @@ -104,13 +105,14 @@ class VIEWS_EXPORT ToggleImageButton : public ImageButton { // Like ImageButton::SetImage(), but to set the graphics used for the // "has been toggled" state. Must be called for each button state // before the button is toggled. - void SetToggledImage(ButtonState state, const SkBitmap* image); + void SetToggledImage(ButtonState state, const gfx::ImageSkia* image); // Set the tooltip text displayed when the button is toggled. void SetToggledTooltipText(const string16& tooltip); // Overridden from ImageButton: - virtual void SetImage(ButtonState state, const SkBitmap* image) OVERRIDE; + virtual void SetImage(ButtonState state, + const gfx::ImageSkia* image) OVERRIDE; // Overridden from View: virtual bool GetTooltipText(const gfx::Point& p, diff --git a/ui/views/controls/button/image_button_unittest.cc b/ui/views/controls/button/image_button_unittest.cc index 9d9a9b1..f9b17c8 100644 --- a/ui/views/controls/button/image_button_unittest.cc +++ b/ui/views/controls/button/image_button_unittest.cc @@ -35,7 +35,7 @@ TEST_F(ImageButtonTest, Basics) { EXPECT_EQ("5x15", button.GetPreferredSize().ToString()); // Set a normal image. - SkBitmap normal_bitmap = CreateTestBitmap(10, 20); + gfx::ImageSkia normal_bitmap = CreateTestBitmap(10, 20); button.SetImage(CustomButton::BS_NORMAL, &normal_bitmap); // Image uses normal image for painting. @@ -47,7 +47,7 @@ TEST_F(ImageButtonTest, Basics) { EXPECT_EQ("10x20", button.GetPreferredSize().ToString()); // Set a pushed image. - SkBitmap pushed_bitmap = CreateTestBitmap(11, 21); + gfx::ImageSkia pushed_bitmap = CreateTestBitmap(11, 21); button.SetImage(CustomButton::BS_PUSHED, &pushed_bitmap); // By convention, preferred size doesn't change, even though pushed image diff --git a/ui/views/controls/image_view.cc b/ui/views/controls/image_view.cc index 64ccf5b..e09603d 100644 --- a/ui/views/controls/image_view.cc +++ b/ui/views/controls/image_view.cc @@ -30,9 +30,9 @@ void ImageView::SetImage(const SkBitmap& bm) { SchedulePaint(); } -void ImageView::SetImage(const SkBitmap* bm) { - if (bm) { - SetImage(*bm); +void ImageView::SetImage(const gfx::ImageSkia* image_skia) { + if (image_skia) { + SetImage(*image_skia); } else { SkBitmap t; SetImage(t); diff --git a/ui/views/controls/image_view.h b/ui/views/controls/image_view.h index 8827d4e..7c90fd8 100644 --- a/ui/views/controls/image_view.h +++ b/ui/views/controls/image_view.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -7,6 +7,7 @@ #pragma once #include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/image/image_skia.h" #include "ui/views/view.h" namespace gfx { @@ -39,10 +40,10 @@ class VIEWS_EXPORT ImageView : public View { // Set the bitmap that should be displayed. void SetImage(const SkBitmap& bm); - // Set the bitmap that should be displayed from a pointer. Reset the image + // Set the image that should be displayed from a pointer. Reset the image // if the pointer is NULL. The pointer contents is copied in the receiver's // bitmap. - void SetImage(const SkBitmap* bm); + void SetImage(const gfx::ImageSkia* image_skia); // Returns the bitmap currently displayed or NULL of none is currently set. // The returned bitmap is still owned by the ImageView. diff --git a/ui/views/controls/scrollbar/bitmap_scroll_bar.cc b/ui/views/controls/scrollbar/bitmap_scroll_bar.cc index ee2ea4a..aa614ea 100644 --- a/ui/views/controls/scrollbar/bitmap_scroll_bar.cc +++ b/ui/views/controls/scrollbar/bitmap_scroll_bar.cc @@ -134,25 +134,25 @@ class BitmapScrollBarThumb : public BaseScrollBarThumb { } private: - // Returns the bitmap rendered at the start of the thumb. - SkBitmap* start_cap_bitmap() const { + // Returns the image rendered at the start of the thumb. + gfx::ImageSkia* start_cap_bitmap() const { return scroll_bar_->images_[BitmapScrollBar::THUMB_START_CAP][GetState()]; } - // Returns the bitmap rendered at the end of the thumb. - SkBitmap* end_cap_bitmap() const { + // Returns the image rendered at the end of the thumb. + gfx::ImageSkia* end_cap_bitmap() const { return scroll_bar_->images_[BitmapScrollBar::THUMB_END_CAP][GetState()]; } - // Returns the bitmap that is tiled in the background of the thumb between + // Returns the image that is tiled in the background of the thumb between // the start and the end caps. - SkBitmap* background_bitmap() const { + gfx::ImageSkia* background_bitmap() const { return scroll_bar_->images_[BitmapScrollBar::THUMB_MIDDLE][GetState()]; } - // Returns the bitmap that is rendered in the middle of the thumb + // Returns the image that is rendered in the middle of the thumb // transparently over the background bitmap. - SkBitmap* grippy_bitmap() const { + gfx::ImageSkia* grippy_bitmap() const { return scroll_bar_->images_[BitmapScrollBar::THUMB_GRIPPY] [CustomButton::BS_NORMAL]; } @@ -188,22 +188,22 @@ BitmapScrollBar::BitmapScrollBar(bool horizontal, bool show_scroll_buttons) void BitmapScrollBar::SetImage(ScrollBarPart part, CustomButton::ButtonState state, - SkBitmap* bitmap) { + gfx::ImageSkia* image_skia) { DCHECK(part < PART_COUNT); DCHECK(state < CustomButton::BS_COUNT); switch (part) { case PREV_BUTTON: - prev_button_->SetImage(state, bitmap); + prev_button_->SetImage(state, image_skia); break; case NEXT_BUTTON: - next_button_->SetImage(state, bitmap); + next_button_->SetImage(state, image_skia); break; case THUMB_START_CAP: case THUMB_MIDDLE: case THUMB_END_CAP: case THUMB_GRIPPY: case THUMB_TRACK: - images_[part][state] = bitmap; + images_[part][state] = image_skia; break; } } diff --git a/ui/views/controls/scrollbar/bitmap_scroll_bar.h b/ui/views/controls/scrollbar/bitmap_scroll_bar.h index 3f9ccab..3c6a1b4 100644 --- a/ui/views/controls/scrollbar/bitmap_scroll_bar.h +++ b/ui/views/controls/scrollbar/bitmap_scroll_bar.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -51,10 +51,10 @@ class VIEWS_EXPORT BitmapScrollBar : public BaseScrollBar, PART_COUNT }; - // Sets the bitmap to be rendered for the specified part and state. + // Sets the image to be rendered for the specified part and state. void SetImage(ScrollBarPart part, CustomButton::ButtonState state, - SkBitmap* bitmap); + gfx::ImageSkia* image_skia); gfx::Rect GetTrackBounds() const; @@ -79,7 +79,7 @@ class VIEWS_EXPORT BitmapScrollBar : public BaseScrollBar, // The thumb needs to be able to access the part images. friend BitmapScrollBarThumb; - SkBitmap* images_[PART_COUNT][CustomButton::BS_COUNT]; + gfx::ImageSkia* images_[PART_COUNT][CustomButton::BS_COUNT]; // True if the scroll buttons at each end of the scroll bar should be shown. bool show_scroll_buttons_; diff --git a/ui/views/examples/button_example.cc b/ui/views/examples/button_example.cc index a86ee66..21dfc20 100644 --- a/ui/views/examples/button_example.cc +++ b/ui/views/examples/button_example.cc @@ -45,11 +45,11 @@ void ButtonExample::CreateExampleView(View* container) { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); image_button_ = new ImageButton(this); image_button_->SetImage(ImageButton::BS_NORMAL, - rb.GetImageNamed(IDR_CLOSE).ToSkBitmap()); + rb.GetImageNamed(IDR_CLOSE).ToImageSkia()); image_button_->SetImage(ImageButton::BS_HOT, - rb.GetImageNamed(IDR_CLOSE_H).ToSkBitmap()); + rb.GetImageNamed(IDR_CLOSE_H).ToImageSkia()); image_button_->SetImage(ImageButton::BS_PUSHED, - rb.GetImageNamed(IDR_CLOSE_P).ToSkBitmap()); + rb.GetImageNamed(IDR_CLOSE_P).ToImageSkia()); image_button_->SetOverlayImage(rb.GetImageNamed(IDR_MENU_CHECK).ToSkBitmap()); container->AddChildView(image_button_); } diff --git a/ui/views/window/custom_frame_view.cc b/ui/views/window/custom_frame_view.cc index 33974a3..f4dd9dd 100644 --- a/ui/views/window/custom_frame_view.cc +++ b/ui/views/window/custom_frame_view.cc @@ -490,11 +490,11 @@ void CustomFrameView::LayoutWindowControls() { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); close_button_->SetImage(CustomButton::BS_NORMAL, - rb.GetImageNamed(normal_part).ToSkBitmap()); + rb.GetImageNamed(normal_part).ToImageSkia()); close_button_->SetImage(CustomButton::BS_HOT, - rb.GetImageNamed(hot_part).ToSkBitmap()); + rb.GetImageNamed(hot_part).ToImageSkia()); close_button_->SetImage(CustomButton::BS_PUSHED, - rb.GetImageNamed(pushed_part).ToSkBitmap()); + rb.GetImageNamed(pushed_part).ToImageSkia()); } void CustomFrameView::LayoutTitleBar() { @@ -538,11 +538,11 @@ ImageButton* CustomFrameView::InitWindowCaptionButton( ImageButton* button = new ImageButton(this); button->SetAccessibleName(l10n_util::GetStringUTF16(accessibility_string_id)); button->SetImage(CustomButton::BS_NORMAL, - rb.GetImageNamed(normal_image_id).ToSkBitmap()); + rb.GetImageNamed(normal_image_id).ToImageSkia()); button->SetImage(CustomButton::BS_HOT, - rb.GetImageNamed(hot_image_id).ToSkBitmap()); + rb.GetImageNamed(hot_image_id).ToImageSkia()); button->SetImage(CustomButton::BS_PUSHED, - rb.GetImageNamed(pushed_image_id).ToSkBitmap()); + rb.GetImageNamed(pushed_image_id).ToImageSkia()); AddChildView(button); return button; } |