diff options
61 files changed, 449 insertions, 492 deletions
diff --git a/ash/desktop_background/desktop_background_controller.cc b/ash/desktop_background/desktop_background_controller.cc index a173098..5b2562e 100644 --- a/ash/desktop_background/desktop_background_controller.cc +++ b/ash/desktop_background/desktop_background_controller.cc @@ -42,7 +42,7 @@ class DesktopBackgroundController::WallpaperOperation if (cancel_flag_.IsSet()) return; wallpaper_ = ui::ResourceBundle::GetSharedInstance().GetImageNamed( - GetWallpaperInfo(index_).id).ToImageSkia(); + GetWallpaperInfo(index_).id).ToSkBitmap(); if (cancel_flag_.IsSet()) return; layout_ = GetWallpaperInfo(index_).layout; @@ -52,7 +52,7 @@ class DesktopBackgroundController::WallpaperOperation cancel_flag_.Set(); } - const gfx::ImageSkia* wallpaper() { + const SkBitmap* wallpaper() { return wallpaper_; } @@ -70,7 +70,7 @@ class DesktopBackgroundController::WallpaperOperation base::CancellationFlag cancel_flag_; - const gfx::ImageSkia* wallpaper_; + const SkBitmap* wallpaper_; WallpaperLayout layout_; int index_; @@ -103,9 +103,8 @@ void DesktopBackgroundController::SetDefaultWallpaper(int index) { true /* task_is_slow */); } -void DesktopBackgroundController::SetCustomWallpaper( - const gfx::ImageSkia& wallpaper, - WallpaperLayout layout) { +void DesktopBackgroundController::SetCustomWallpaper(const SkBitmap& wallpaper, + WallpaperLayout layout) { internal::RootWindowLayoutManager* root_window_layout = Shell::GetInstance()->root_window_layout(); root_window_layout->SetBackgroundLayer(NULL); @@ -171,7 +170,7 @@ void DesktopBackgroundController::OnWallpaperLoadCompleted( } void DesktopBackgroundController::CreateEmptyWallpaper() { - gfx::ImageSkia dummy; + SkBitmap dummy; internal::CreateDesktopBackground(dummy, CENTER); desktop_background_mode_ = BACKGROUND_IMAGE; } diff --git a/ash/desktop_background/desktop_background_controller.h b/ash/desktop_background/desktop_background_controller.h index 0b80157..a531001 100644 --- a/ash/desktop_background/desktop_background_controller.h +++ b/ash/desktop_background/desktop_background_controller.h @@ -11,9 +11,7 @@ #include "base/basictypes.h" #include "base/memory/weak_ptr.h" -namespace gfx { -class ImageSkia; -} +class SkBitmap; namespace ash { @@ -55,8 +53,7 @@ class ASH_EXPORT DesktopBackgroundController { // Sets the user selected custom wallpaper. Called when user selected a file // from file system or changed the layout of wallpaper. - void SetCustomWallpaper(const gfx::ImageSkia& wallpaper, - WallpaperLayout layout); + void SetCustomWallpaper(const SkBitmap& wallpaper, WallpaperLayout layout); // Cancels the current wallpaper loading operation. void CancelPendingWallpaperOperation(); diff --git a/ash/desktop_background/desktop_background_resources.cc b/ash/desktop_background/desktop_background_resources.cc index 76dc091..e5cf675 100644 --- a/ash/desktop_background/desktop_background_resources.cc +++ b/ash/desktop_background/desktop_background_resources.cc @@ -9,6 +9,7 @@ #include "grit/ui_resources.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image.h" +#include "third_party/skia/include/core/SkBitmap.h" namespace { diff --git a/ash/desktop_background/desktop_background_resources.h b/ash/desktop_background/desktop_background_resources.h index 1de8762..4b48e9d 100644 --- a/ash/desktop_background/desktop_background_resources.h +++ b/ash/desktop_background/desktop_background_resources.h @@ -7,6 +7,8 @@ #include "ash/ash_export.h" +class SkBitmap; + namespace ash { enum WallpaperLayout { diff --git a/ash/desktop_background/desktop_background_view.cc b/ash/desktop_background/desktop_background_view.cc index bedd737..c1c08d8 100644 --- a/ash/desktop_background/desktop_background_view.cc +++ b/ash/desktop_background/desktop_background_view.cc @@ -60,10 +60,11 @@ static int RoundPositive(double x) { //////////////////////////////////////////////////////////////////////////////// // DesktopBackgroundView, public: -DesktopBackgroundView::DesktopBackgroundView(const gfx::ImageSkia& wallpaper, +DesktopBackgroundView::DesktopBackgroundView(const SkBitmap& wallpaper, WallpaperLayout wallpaper_layout) { wallpaper_ = wallpaper; wallpaper_layout_ = wallpaper_layout; + wallpaper_.buildMipMap(false); } DesktopBackgroundView::~DesktopBackgroundView() { @@ -126,7 +127,7 @@ void DesktopBackgroundView::OnMouseReleased(const views::MouseEvent& event) { Shell::GetInstance()->ShowBackgroundMenu(GetWidget(), event.location()); } -void CreateDesktopBackground(const gfx::ImageSkia& wallpaper, +void CreateDesktopBackground(const SkBitmap& wallpaper, WallpaperLayout wallpaper_layout) { views::Widget* desktop_widget = new views::Widget; views::Widget::InitParams params( diff --git a/ash/desktop_background/desktop_background_view.h b/ash/desktop_background/desktop_background_view.h index 16164e4..4a5b676 100644 --- a/ash/desktop_background/desktop_background_view.h +++ b/ash/desktop_background/desktop_background_view.h @@ -7,7 +7,7 @@ #pragma once #include "ash/desktop_background/desktop_background_resources.h" -#include "ui/gfx/image/image_skia.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "ui/views/view.h" #include "ui/views/widget/widget_delegate.h" @@ -16,7 +16,7 @@ namespace internal { class DesktopBackgroundView : public views::WidgetDelegateView { public: - DesktopBackgroundView(const gfx::ImageSkia& wallpaper, + DesktopBackgroundView(const SkBitmap& wallpaper, WallpaperLayout wallpaper_layout); virtual ~DesktopBackgroundView(); @@ -26,7 +26,7 @@ class DesktopBackgroundView : public views::WidgetDelegateView { virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; - gfx::ImageSkia wallpaper_; + SkBitmap wallpaper_; WallpaperLayout wallpaper_layout_; DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundView); diff --git a/ash/shell.cc b/ash/shell.cc index a9f9d42..ebf4a19 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -65,6 +65,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "grit/ui_resources.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/env.h" #include "ui/aura/focus_manager.h" @@ -77,7 +78,6 @@ #include "ui/aura/window.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animator.h" -#include "ui/gfx/image/image_skia.h" #include "ui/gfx/monitor.h" #include "ui/gfx/screen.h" #include "ui/gfx/size.h" @@ -276,7 +276,7 @@ class DummySystemTrayDelegate : public SystemTrayDelegate { return "über@tray"; } - virtual const gfx::ImageSkia& GetUserImage() const OVERRIDE { + virtual const SkBitmap& GetUserImage() const OVERRIDE { return null_image_; } @@ -505,7 +505,7 @@ class DummySystemTrayDelegate : public SystemTrayDelegate { bool bluetooth_enabled_; float volume_; bool caps_lock_enabled_; - gfx::ImageSkia null_image_; + SkBitmap null_image_; DISALLOW_COPY_AND_ASSIGN(DummySystemTrayDelegate); }; diff --git a/ash/shell.h b/ash/shell.h index 237c4945..7d162b4 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -17,10 +17,11 @@ #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" -#include "ui/gfx/insets.h" #include "ui/gfx/size.h" +#include "ui/gfx/insets.h" class CommandLine; +class SkBitmap; namespace aura { class EventFilter; @@ -38,7 +39,6 @@ class BrowserContext; } namespace gfx { -class ImageSkia; class Point; class Rect; } diff --git a/ash/shell/app_list.cc b/ash/shell/app_list.cc index 4e5cb06..b9d1174 100644 --- a/ash/shell/app_list.cc +++ b/ash/shell/app_list.cc @@ -5,9 +5,9 @@ #include <string> #include "ash/shell.h" +#include "ash/shell_delegate.h" #include "ash/shell/example_factory.h" #include "ash/shell/toplevel_window.h" -#include "ash/shell_delegate.h" #include "base/basictypes.h" #include "base/i18n/case_conversion.h" #include "base/i18n/string_search.h" @@ -46,7 +46,7 @@ class WindowTypeLauncherItem : public app_list::AppListItemModel { SetTitle(GetTitle(type)); } - static gfx::ImageSkia GetIcon(Type type) { + static SkBitmap GetIcon(Type type) { static const SkColor kColors[] = { SK_ColorRED, SK_ColorGREEN, @@ -60,7 +60,7 @@ class WindowTypeLauncherItem : public app_list::AppListItemModel { icon.setConfig(SkBitmap::kARGB_8888_Config, kIconSize, kIconSize); icon.allocPixels(); icon.eraseColor(kColors[static_cast<int>(type) % arraysize(kColors)]); - return gfx::ImageSkia(icon); + return icon; } // The text below is not localized as this is an example code. @@ -199,7 +199,7 @@ class ExampleAppListViewDelegate : public app_list::AppListViewDelegate { } } - gfx::ImageSkia CreateSearchBoxIcon() { + SkBitmap CreateSearchBoxIcon() { const string16 icon_text = ASCIIToUTF16("ash"); const gfx::Size icon_size(32, 32); @@ -212,7 +212,7 @@ class ExampleAppListViewDelegate : public app_list::AppListViewDelegate { gfx::Canvas::TEXT_VALIGN_MIDDLE | gfx::Canvas::NO_SUBPIXEL_RENDERING); - return gfx::ImageSkia(canvas.ExtractBitmap()); + return canvas.ExtractBitmap(); } void DecorateSearchBox(app_list::SearchBoxModel* search_box_model) { diff --git a/ash/shell_factory.h b/ash/shell_factory.h index 7e60116..c1ebf51e 100644 --- a/ash/shell_factory.h +++ b/ash/shell_factory.h @@ -9,9 +9,7 @@ #include "ash/ash_export.h" #include "ash/desktop_background/desktop_background_resources.h" -namespace gfx { -class ImageSkia; -} +class SkBitmap; namespace views { class View; @@ -23,7 +21,7 @@ class Widget; namespace ash { namespace internal { -void CreateDesktopBackground(const gfx::ImageSkia& wallpaper, +void CreateDesktopBackground(const SkBitmap& wallpaper, WallpaperLayout wallpaper_layout); ASH_EXPORT views::Widget* CreateStatusArea(views::View* contents); } // namespace internal diff --git a/ash/system/date/tray_date.cc b/ash/system/date/tray_date.cc index e9c9a25..a3224a5 100644 --- a/ash/system/date/tray_date.cc +++ b/ash/system/date/tray_date.cc @@ -16,10 +16,10 @@ #include "base/timer.h" #include "base/utf_string_conversions.h" #include "grit/ui_resources.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkRect.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image.h" -#include "ui/gfx/image/image_skia.h" #include "ui/gfx/size.h" #include "ui/views/controls/button/button.h" #include "ui/views/controls/button/text_button.h" diff --git a/ash/system/network/tray_network.cc b/ash/system/network/tray_network.cc index 95823ca..632d595 100644 --- a/ash/system/network/tray_network.cc +++ b/ash/system/network/tray_network.cc @@ -448,7 +448,7 @@ class NetworkDetailedView : public TrayDetailsView, HoverHighlightView* container = new HoverHighlightView(this); container->set_fixed_height(kTrayPopupItemHeight); container->AddIconAndLabel( - *rb.GetImageNamed(IDR_AURA_UBER_TRAY_NETWORK_AIRPLANE).ToImageSkia(), + *rb.GetImageNamed(IDR_AURA_UBER_TRAY_NETWORK_AIRPLANE).ToSkBitmap(), rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_AIRPLANE_MODE), gfx::Font::NORMAL); AddChildView(container); diff --git a/ash/system/power/tray_power.cc b/ash/system/power/tray_power.cc index 48b206e..4d7b8ae 100644 --- a/ash/system/power/tray_power.cc +++ b/ash/system/power/tray_power.cc @@ -17,12 +17,12 @@ #include "base/utf_string_conversions.h" #include "grit/ash_strings.h" #include "grit/ui_resources.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkRect.h" -#include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image.h" -#include "ui/gfx/image/image_skia.h" #include "ui/gfx/size.h" +#include "ui/base/l10n/l10n_util.h" #include "ui/views/controls/button/button.h" #include "ui/views/controls/button/text_button.h" #include "ui/views/controls/image_view.h" @@ -58,9 +58,9 @@ enum IconSet { ICON_DARK }; -gfx::ImageSkia GetBatteryImage(const PowerSupplyStatus& supply_status, +SkBitmap GetBatteryImage(const PowerSupplyStatus& supply_status, IconSet icon_set) { - gfx::ImageSkia image; + SkBitmap image; gfx::Image all = ui::ResourceBundle::GetSharedInstance().GetImageNamed( icon_set == ICON_DARK ? IDR_AURA_UBER_TRAY_POWER_SMALL_DARK : IDR_AURA_UBER_TRAY_POWER_SMALL); @@ -83,7 +83,7 @@ gfx::ImageSkia GetBatteryImage(const PowerSupplyStatus& supply_status, (supply_status.line_power_on ? kBatteryImageWidth : 0) + 2, image_index * kBatteryImageHeight, kBatteryImageWidth - 2, kBatteryImageHeight); - all.ToImageSkia()->extractSubset(&image, region); + all.ToSkBitmap()->extractSubset(&image, region); return image; } diff --git a/ash/system/status_area_widget_delegate.h b/ash/system/status_area_widget_delegate.h index 35228d4..ffba10d 100644 --- a/ash/system/status_area_widget_delegate.h +++ b/ash/system/status_area_widget_delegate.h @@ -7,7 +7,7 @@ #pragma once #include "ash/ash_export.h" -#include "ui/gfx/image/image_skia.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "ui/views/accessible_pane_view.h" #include "ui/views/layout/box_layout.h" #include "ui/views/widget/widget_delegate.h" diff --git a/ash/system/tray/system_tray_delegate.h b/ash/system/tray/system_tray_delegate.h index d8d48ff..3b9284f 100644 --- a/ash/system/tray/system_tray_delegate.h +++ b/ash/system/tray/system_tray_delegate.h @@ -10,11 +10,12 @@ #include <vector> #include "ash/ash_export.h" -#include "ash/system/power/power_supply_status.h" #include "ash/system/user/login_status.h" +#include "ash/system/power/power_supply_status.h" #include "base/file_path.h" #include "base/i18n/time_formatting.h" #include "base/string16.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/image/image_skia.h" namespace ash { @@ -106,7 +107,7 @@ class SystemTrayDelegate { // Gets information about the logged in user. virtual const std::string GetUserDisplayName() const = 0; virtual const std::string GetUserEmail() const = 0; - virtual const gfx::ImageSkia& GetUserImage() const = 0; + virtual const SkBitmap& GetUserImage() const = 0; virtual user::LoginStatus GetUserLoginStatus() const = 0; // Returns whether a system upgrade is available. diff --git a/ash/system/tray/tray_views.cc b/ash/system/tray/tray_views.cc index 664f987b..5418fa3 100644 --- a/ash/system/tray/tray_views.cc +++ b/ash/system/tray/tray_views.cc @@ -5,6 +5,7 @@ #include "ash/system/tray/tray_views.h" #include "ash/system/tray/tray_constants.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "grit/ash_strings.h" #include "grit/ui_resources.h" #include "grit/ui_resources_standard.h" @@ -12,7 +13,6 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" #include "ui/gfx/image/image.h" -#include "ui/gfx/image/image_skia.h" #include "ui/views/border.h" #include "ui/views/controls/button/image_button.h" #include "ui/views/controls/label.h" @@ -125,7 +125,7 @@ HoverHighlightView::HoverHighlightView(ViewClickListener* listener) HoverHighlightView::~HoverHighlightView() { } -void HoverHighlightView::AddIconAndLabel(const gfx::ImageSkia& image, +void HoverHighlightView::AddIconAndLabel(const SkBitmap& image, const string16& text, gfx::Font::FontStyle style) { SetLayoutManager(new views::BoxLayout( @@ -412,7 +412,7 @@ void SpecialPopupRow::SetTextLabel(int string_id, ViewClickListener* listener) { container->set_text_default_color(kHeaderTextColorNormal); container->AddIconAndLabel( - *rb.GetImageNamed(IDR_AURA_UBER_TRAY_LESS).ToImageSkia(), + *rb.GetImageNamed(IDR_AURA_UBER_TRAY_LESS).ToSkBitmap(), rb.GetLocalizedString(string_id), gfx::Font::BOLD); @@ -528,7 +528,7 @@ void TrayNotificationView::InitView(views::View* contents) { layout->AddPaddingRow(0, kTrayPopupPaddingBetweenItems); } -void TrayNotificationView::SetIconImage(const gfx::ImageSkia& image) { +void TrayNotificationView::SetIconImage(const SkBitmap& image) { icon_->SetImage(image); SchedulePaint(); } @@ -542,7 +542,7 @@ void TrayNotificationView::UpdateView(views::View* new_contents) { } void TrayNotificationView::UpdateViewAndImage(views::View* new_contents, - const gfx::ImageSkia& image) { + const SkBitmap& image) { RemoveAllChildViews(true); InitView(new_contents); icon_->SetImage(image); diff --git a/ash/system/tray/tray_views.h b/ash/system/tray/tray_views.h index 2eff8bb..f6173b2 100644 --- a/ash/system/tray/tray_views.h +++ b/ash/system/tray/tray_views.h @@ -16,12 +16,9 @@ #include "ui/views/controls/slider.h" #include "ui/views/view.h" +class SkBitmap; typedef unsigned int SkColor; -namespace gfx { -class ImageSkia; -} - namespace views { class Label; class BoxLayout; @@ -99,7 +96,7 @@ class HoverHighlightView : public ActionableView { // Convenience function for adding an icon and a label. This also sets the // accessible name. - void AddIconAndLabel(const gfx::ImageSkia& image, + void AddIconAndLabel(const SkBitmap& image, const string16& text, gfx::Font::FontStyle style); @@ -269,14 +266,13 @@ class TrayNotificationView : public views::View, void InitView(views::View* contents); // Sets/updates the icon image. - void SetIconImage(const gfx::ImageSkia& image); + void SetIconImage(const SkBitmap& image); // Replaces the contents view. void UpdateView(views::View* new_contents); // Replaces the contents view and updates the icon image. - void UpdateViewAndImage(views::View* new_contents, - const gfx::ImageSkia& image); + void UpdateViewAndImage(views::View* new_contents, const SkBitmap& image); // Overridden from ButtonListener. virtual void ButtonPressed(views::Button* sender, diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc index d894335..07fb61e 100644 --- a/ash/system/user/tray_user.cc +++ b/ash/system/user/tray_user.cc @@ -53,10 +53,10 @@ class RoundedImageView : public views::View { virtual ~RoundedImageView() { } - // Set the image that should be displayed from a pointer. The pointer - // contents is copied in the receiver's image. - void SetImage(const gfx::ImageSkia& img, const gfx::Size& size) { - image_ = img; + // Set the bitmap that should be displayed from a pointer. The pointer + // contents is copied in the receiver's bitmap. + void SetImage(const SkBitmap& bm, const gfx::Size& size) { + image_ = bm; image_size_ = size; // Try to get the best image quality for the avatar. @@ -99,8 +99,8 @@ class RoundedImageView : public views::View { } private: - gfx::ImageSkia image_; - gfx::ImageSkia resized_; + SkBitmap image_; + SkBitmap resized_; gfx::Size image_size_; int corner_radius_; diff --git a/ash/wm/custom_frame_view_ash.cc b/ash/wm/custom_frame_view_ash.cc index 3132e7f..49cca635 100644 --- a/ash/wm/custom_frame_view_ash.cc +++ b/ash/wm/custom_frame_view_ash.cc @@ -121,13 +121,13 @@ void CustomFrameViewAsh::Layout() { void CustomFrameViewAsh::OnPaint(gfx::Canvas* canvas) { bool paint_as_active = ShouldPaintAsActive(); - int theme_image_id = paint_as_active ? IDR_AURA_WINDOW_HEADER_BASE_ACTIVE : + int theme_bitmap_id = paint_as_active ? IDR_AURA_WINDOW_HEADER_BASE_ACTIVE : IDR_AURA_WINDOW_HEADER_BASE_INACTIVE; frame_painter_->PaintHeader( this, canvas, paint_as_active ? FramePainter::ACTIVE : FramePainter::INACTIVE, - theme_image_id, + theme_bitmap_id, NULL); frame_painter_->PaintTitleBar(this, canvas, GetTitleFont()); frame_painter_->PaintHeaderContentSeparator(this, canvas); diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc index 076af87..f35db43 100644 --- a/ash/wm/frame_painter.cc +++ b/ash/wm/frame_painter.cc @@ -76,7 +76,7 @@ const int kButtonOverlap = 1; // we need to copy the theme image for the window header from a few pixels // inset to preserve alignment with the NTP image, or else we'll break a bunch // of existing themes. We do something similar on OS X for the same reason. -const int kThemeFrameImageOffsetX = 5; +const int kThemeFrameBitmapOffsetX = 5; // Duration of crossfade animation for activating and deactivating frame. const int kActivationCrossfadeDurationMs = 200; // Alpha/opacity value for fully-opaque headers. @@ -87,14 +87,14 @@ const int kFullyOpaque = 255; void TileRoundRect(gfx::Canvas* canvas, int x, int y, int w, int h, SkPaint* paint, - const gfx::ImageSkia& image, + const SkBitmap& bitmap, int corner_radius, - int image_offset_x) { + int bitmap_offset_x) { // To get the shader to sample the image |inset_y| pixels in but tile across // the whole image, we adjust the target rectangle for the shader to the right // and translate the canvas left to compensate. SkRect rect; - rect.iset(x + image_offset_x, y, x + image_offset_x + w, y + h); + rect.iset(x + bitmap_offset_x, y, x + bitmap_offset_x + w, y + h); const SkScalar kRadius = SkIntToScalar(corner_radius); SkScalar radii[8] = { kRadius, kRadius, // top-left @@ -104,7 +104,7 @@ void TileRoundRect(gfx::Canvas* canvas, SkPath path; path.addRoundRect(rect, radii, SkPath::kCW_Direction); - SkShader* shader = SkShader::CreateBitmapShader(image, + SkShader* shader = SkShader::CreateBitmapShader(bitmap, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode); paint->setShader(shader); @@ -113,9 +113,9 @@ void TileRoundRect(gfx::Canvas* canvas, shader->unref(); // Adjust canvas to compensate for image sampling offset, draw, then adjust // back. This is cheaper than pushing/popping the entire canvas state. - canvas->sk_canvas()->translate(SkIntToScalar(-image_offset_x), 0); + canvas->sk_canvas()->translate(SkIntToScalar(-bitmap_offset_x), 0); canvas->DrawPath(path, *paint); - canvas->sk_canvas()->translate(SkIntToScalar(image_offset_x), 0); + canvas->sk_canvas()->translate(SkIntToScalar(bitmap_offset_x), 0); } // Returns true if |window| is a visible, normal window. @@ -189,17 +189,17 @@ void FramePainter::Init(views::Widget* frame, // Window frame image parts. ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); button_separator_ = - rb.GetImageNamed(IDR_AURA_WINDOW_BUTTON_SEPARATOR).ToImageSkia(); + rb.GetImageNamed(IDR_AURA_WINDOW_BUTTON_SEPARATOR).ToSkBitmap(); top_left_corner_ = - rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP_LEFT).ToImageSkia(); + rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP_LEFT).ToSkBitmap(); top_edge_ = - rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP).ToImageSkia(); + rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP).ToSkBitmap(); top_right_corner_ = - rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP_RIGHT).ToImageSkia(); + rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP_RIGHT).ToSkBitmap(); header_left_edge_ = - rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_LEFT).ToImageSkia(); + rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_LEFT).ToSkBitmap(); header_right_edge_ = - rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_RIGHT).ToImageSkia(); + rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_RIGHT).ToSkBitmap(); window_ = frame->GetNativeWindow(); // Ensure we get resize cursors for a few pixels outside our bounds. @@ -306,7 +306,7 @@ void FramePainter::PaintHeader(views::NonClientFrameView* view, gfx::Canvas* canvas, HeaderMode header_mode, int theme_frame_id, - const gfx::ImageSkia* theme_frame_overlay) { + const SkBitmap* theme_frame_overlay) { if (previous_theme_frame_id_ != 0 && previous_theme_frame_id_ != theme_frame_id) { crossfade_animation_.reset(new ui::SlideAnimation(this)); @@ -319,16 +319,15 @@ void FramePainter::PaintHeader(views::NonClientFrameView* view, int opacity = GetHeaderOpacity(header_mode, theme_frame_id, theme_frame_overlay); ui::ThemeProvider* theme_provider = frame_->GetThemeProvider(); - gfx::ImageSkia* theme_frame = theme_provider->GetImageSkiaNamed( - theme_frame_id); + SkBitmap* theme_frame = theme_provider->GetBitmapNamed(theme_frame_id); header_frame_bounds_ = gfx::Rect(0, 0, view->width(), theme_frame->height()); const int kCornerRadius = 2; SkPaint paint; if (crossfade_animation_.get() && crossfade_animation_->is_animating()) { - gfx::ImageSkia* crossfade_theme_frame = - theme_provider->GetImageSkiaNamed(crossfade_theme_frame_id_); + SkBitmap* crossfade_theme_frame = + theme_provider->GetBitmapNamed(crossfade_theme_frame_id_); if (crossfade_theme_frame) { double current_value = crossfade_animation_->GetCurrentValue(); int old_alpha = (1 - current_value) * crossfade_opacity_; @@ -342,7 +341,7 @@ void FramePainter::PaintHeader(views::NonClientFrameView* view, &paint, *crossfade_theme_frame, kCornerRadius, - kThemeFrameImageOffsetX); + kThemeFrameBitmapOffsetX); paint.setAlpha(new_alpha); } else { @@ -359,7 +358,7 @@ void FramePainter::PaintHeader(views::NonClientFrameView* view, &paint, *theme_frame, kCornerRadius, - kThemeFrameImageOffsetX); + kThemeFrameBitmapOffsetX); previous_theme_frame_id_ = theme_frame_id; previous_opacity_ = opacity; @@ -565,16 +564,16 @@ void FramePainter::AnimationProgressed(const ui::Animation* animation) { // FramePainter, private: void FramePainter::SetButtonImages(views::ImageButton* button, - int normal_image_id, - int hot_image_id, - int pushed_image_id) { + int normal_bitmap_id, + int hot_bitmap_id, + int pushed_bitmap_id) { ui::ThemeProvider* theme_provider = frame_->GetThemeProvider(); button->SetImage(views::CustomButton::BS_NORMAL, - theme_provider->GetImageSkiaNamed(normal_image_id)); + theme_provider->GetImageSkiaNamed(normal_bitmap_id)); button->SetImage(views::CustomButton::BS_HOT, - theme_provider->GetImageSkiaNamed(hot_image_id)); + theme_provider->GetImageSkiaNamed(hot_bitmap_id)); button->SetImage(views::CustomButton::BS_PUSHED, - theme_provider->GetImageSkiaNamed(pushed_image_id)); + theme_provider->GetImageSkiaNamed(pushed_bitmap_id)); } int FramePainter::GetTitleOffsetX() const { @@ -585,7 +584,7 @@ int FramePainter::GetTitleOffsetX() const { int FramePainter::GetHeaderOpacity(HeaderMode header_mode, int theme_frame_id, - const gfx::ImageSkia* theme_frame_overlay) { + const SkBitmap* theme_frame_overlay) { // User-provided themes are painted fully opaque. if (frame_->GetThemeProvider()->HasCustomImage(theme_frame_id)) return kFullyOpaque; diff --git a/ash/wm/frame_painter.h b/ash/wm/frame_painter.h index 2d21203..883d671 100644 --- a/ash/wm/frame_painter.h +++ b/ash/wm/frame_painter.h @@ -13,17 +13,17 @@ #include "base/compiler_specific.h" // OVERRIDE #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" -#include "ui/aura/window_observer.h" #include "ui/base/animation/animation_delegate.h" #include "ui/gfx/rect.h" +#include "ui/aura/window_observer.h" +class SkBitmap; namespace aura { class Window; } namespace gfx { class Canvas; class Font; -class ImageSkia; class Point; class Size; } @@ -86,7 +86,7 @@ class ASH_EXPORT FramePainter : public aura::WindowObserver, gfx::Canvas* canvas, HeaderMode header_mode, int theme_frame_id, - const gfx::ImageSkia* theme_frame_overlay); + const SkBitmap* theme_frame_overlay); // Paints the header/content separator line. Exists as a separate function // because some windows with complex headers (e.g. browsers with tab strips) @@ -124,9 +124,9 @@ class ASH_EXPORT FramePainter : public aura::WindowObserver, // Sets the images for a button base on IDs from the |frame_| theme provider. void SetButtonImages(views::ImageButton* button, - int normal_image_id, - int hot_image_id, - int pushed_image_id); + int normal_bitmap_id, + int hot_bitmap_id, + int pushed_bitmap_id); // Returns the offset between window left edge and title string. int GetTitleOffsetX() const; @@ -134,7 +134,7 @@ class ASH_EXPORT FramePainter : public aura::WindowObserver, // Returns the opacity value used to paint the header. int GetHeaderOpacity(HeaderMode header_mode, int theme_frame_id, - const gfx::ImageSkia* theme_frame_overlay); + const SkBitmap* theme_frame_overlay); // Returns true if there is exactly one visible, normal-type window using // a header painted by this class, in which case we should paint a transparent @@ -156,18 +156,18 @@ class ASH_EXPORT FramePainter : public aura::WindowObserver, aura::Window* window_; // Window frame header/caption parts. - const gfx::ImageSkia* button_separator_; - const gfx::ImageSkia* top_left_corner_; - const gfx::ImageSkia* top_edge_; - const gfx::ImageSkia* top_right_corner_; - const gfx::ImageSkia* header_left_edge_; - const gfx::ImageSkia* header_right_edge_; - - // Image id and opacity last used for painting header. + const SkBitmap* button_separator_; + const SkBitmap* top_left_corner_; + const SkBitmap* top_edge_; + const SkBitmap* top_right_corner_; + const SkBitmap* header_left_edge_; + const SkBitmap* header_right_edge_; + + // Bitmap id and opacity last used for painting header. int previous_theme_frame_id_; int previous_opacity_; - // Image id and opacity we are crossfading from. + // Bitmap id and opacity we are crossfading from. int crossfade_theme_frame_id_; int crossfade_opacity_; diff --git a/ash/wm/frame_painter_unittest.cc b/ash/wm/frame_painter_unittest.cc index 57ae977..234d11f 100644 --- a/ash/wm/frame_painter_unittest.cc +++ b/ash/wm/frame_painter_unittest.cc @@ -164,7 +164,7 @@ TEST_F(FramePainterTest, GetHeaderOpacity) { NULL)); // Custom overlay image is drawn completely opaque. - gfx::ImageSkia custom_overlay; + SkBitmap custom_overlay; EXPECT_EQ(255, p1.GetHeaderOpacity(FramePainter::ACTIVE, IDR_AURA_WINDOW_HEADER_BASE_ACTIVE, diff --git a/ash/wm/image_grid.cc b/ash/wm/image_grid.cc index c4fec2a..f5a1c46 100644 --- a/ash/wm/image_grid.cc +++ b/ash/wm/image_grid.cc @@ -6,12 +6,12 @@ #include <algorithm> -#include "third_party/skia/include/core/SkColor.h" -#include "third_party/skia/include/core/SkXfermode.h" #include "ui/gfx/canvas.h" #include "ui/gfx/image/image.h" #include "ui/gfx/rect.h" #include "ui/gfx/transform.h" +#include "third_party/skia/include/core/SkColor.h" +#include "third_party/skia/include/core/SkXfermode.h" using std::max; using std::min; @@ -227,7 +227,7 @@ void ImageGrid::ImagePainter::SetClipRect(const gfx::Rect& clip_rect, void ImageGrid::ImagePainter::OnPaintLayer(gfx::Canvas* canvas) { if (!clip_rect_.IsEmpty()) canvas->ClipRect(clip_rect_); - canvas->DrawBitmapInt(*(image_->ToImageSkia()), 0, 0); + canvas->DrawBitmapInt(*(image_->ToSkBitmap()), 0, 0); } void ImageGrid::ImagePainter::OnDeviceScaleFactorChanged( @@ -238,7 +238,7 @@ void ImageGrid::ImagePainter::OnDeviceScaleFactorChanged( // static gfx::Size ImageGrid::GetImageSize(const gfx::Image* image) { return image ? - gfx::Size(image->ToImageSkia()->width(), image->ToImageSkia()->height()) : + gfx::Size(image->ToSkBitmap()->width(), image->ToSkBitmap()->height()) : gfx::Size(); } diff --git a/ash/wm/panel_frame_view.cc b/ash/wm/panel_frame_view.cc index e0d93e2..f0cdba9 100644 --- a/ash/wm/panel_frame_view.cc +++ b/ash/wm/panel_frame_view.cc @@ -63,13 +63,13 @@ int PanelFrameView::NonClientHitTest(const gfx::Point& point) { void PanelFrameView::OnPaint(gfx::Canvas* canvas) { bool paint_as_active = ShouldPaintAsActive(); - int theme_image_id = paint_as_active ? IDR_AURA_WINDOW_HEADER_BASE_ACTIVE : + int theme_bitmap_id = paint_as_active ? IDR_AURA_WINDOW_HEADER_BASE_ACTIVE : IDR_AURA_WINDOW_HEADER_BASE_INACTIVE; frame_painter_->PaintHeader( this, canvas, paint_as_active ? FramePainter::ACTIVE : FramePainter::INACTIVE, - theme_image_id, + theme_bitmap_id, NULL); frame_painter_->PaintHeaderContentSeparator(this, canvas); } diff --git a/ash/wm/workspace/frame_maximize_button.cc b/ash/wm/workspace/frame_maximize_button.cc index ec986ed..0d83ec3 100644 --- a/ash/wm/workspace/frame_maximize_button.cc +++ b/ash/wm/workspace/frame_maximize_button.cc @@ -4,10 +4,10 @@ #include "ash/wm/workspace/frame_maximize_button.h" -#include "ash/launcher/launcher.h" #include "ash/screen_ash.h" #include "ash/shell.h" #include "ash/wm/property_util.h" +#include "ash/launcher/launcher.h" #include "ash/wm/workspace/phantom_window_controller.h" #include "ash/wm/workspace/snap_sizer.h" #include "grit/ash_strings.h" @@ -217,7 +217,7 @@ gfx::ImageSkia FrameMaximizeButton::GetImageToPaint() { NOTREACHED(); } } - return *ResourceBundle::GetSharedInstance().GetImageNamed(id).ToImageSkia(); + return *ResourceBundle::GetSharedInstance().GetImageNamed(id).ToSkBitmap(); } // Hot and pressed states handled by regular ImageButton. return ImageButton::GetImageToPaint(); diff --git a/ash/wm/workspace/multi_window_resize_controller.cc b/ash/wm/workspace/multi_window_resize_controller.cc index 9219027..053a646 100644 --- a/ash/wm/workspace/multi_window_resize_controller.cc +++ b/ash/wm/workspace/multi_window_resize_controller.cc @@ -67,7 +67,7 @@ class MultiWindowResizeController::ResizeView : public views::View { int image_id = direction == TOP_BOTTOM ? IDR_AURA_MULTI_WINDOW_RESIZE_H : IDR_AURA_MULTI_WINDOW_RESIZE_V; - image_ = rb.GetImageNamed(image_id).ToImageSkia(); + image_ = rb.GetImageNamed(image_id).ToSkBitmap(); } // views::View overrides: @@ -105,7 +105,7 @@ class MultiWindowResizeController::ResizeView : public views::View { private: MultiWindowResizeController* controller_; const Direction direction_; - const gfx::ImageSkia* image_; + const SkBitmap* image_; DISALLOW_COPY_AND_ASSIGN(ResizeView); }; diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index eee8d39..9735799 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -67,9 +67,9 @@ #include "chrome/browser/ui/media_stream_infobar_delegate.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" +#include "chrome/browser/view_type_utils.h" #include "chrome/browser/user_style_sheet_watcher.h" #include "chrome/browser/user_style_sheet_watcher_factory.h" -#include "chrome/browser/view_type_utils.h" #include "chrome/common/child_process_logging.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" @@ -855,9 +855,9 @@ std::string ChromeContentBrowserClient::GetAcceptLangs( return profile->GetPrefs()->GetString(prefs::kAcceptLanguages); } -gfx::ImageSkia* ChromeContentBrowserClient::GetDefaultFavicon() { +SkBitmap* ChromeContentBrowserClient::GetDefaultFavicon() { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - return rb.GetImageSkiaNamed(IDR_DEFAULT_FAVICON); + return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); } bool ChromeContentBrowserClient::AllowAppCache( diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index b5a2153..ab87162 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h @@ -66,7 +66,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { virtual std::string GetApplicationLocale() OVERRIDE; virtual std::string GetAcceptLangs( content::BrowserContext* context) OVERRIDE; - virtual gfx::ImageSkia* GetDefaultFavicon() OVERRIDE; + virtual SkBitmap* GetDefaultFavicon() OVERRIDE; virtual bool AllowAppCache(const GURL& manifest_url, const GURL& first_party, content::ResourceContext* context) OVERRIDE; diff --git a/chrome/browser/chromeos/login/default_user_images.cc b/chrome/browser/chromeos/login/default_user_images.cc index e015c5a..055a5b8 100644 --- a/chrome/browser/chromeos/login/default_user_images.cc +++ b/chrome/browser/chromeos/login/default_user_images.cc @@ -11,8 +11,8 @@ #include "base/string_util.h" #include "base/stringprintf.h" #include "grit/theme_resources.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/resource/resource_bundle.h" -#include "ui/gfx/image/image_skia.h" namespace chromeos { @@ -96,10 +96,10 @@ bool IsDefaultImageUrl(const std::string url, int* image_id) { return IsDefaultImageString(url, kDefaultUrlPrefix, image_id); } -const gfx::ImageSkia& GetDefaultImage(int index) { +const SkBitmap& GetDefaultImage(int index) { DCHECK(index >= 0 && index < kDefaultImagesCount); return *ResourceBundle::GetSharedInstance(). - GetImageSkiaNamed(kDefaultImageResources[index]); + GetBitmapNamed(kDefaultImageResources[index]); } // Resource IDs of default user images. diff --git a/chrome/browser/chromeos/login/default_user_images.h b/chrome/browser/chromeos/login/default_user_images.h index 8d5270a..1950a23 100644 --- a/chrome/browser/chromeos/login/default_user_images.h +++ b/chrome/browser/chromeos/login/default_user_images.h @@ -9,9 +9,7 @@ #include <cstddef> // for size_t #include <string> -namespace gfx { -class ImageSkia; -} +class SkBitmap; namespace chromeos { @@ -33,7 +31,7 @@ std::string GetDefaultImageUrl(int index); bool IsDefaultImageUrl(const std::string url, int* image_id); // Returns bitmap of default user image with specified index. -const gfx::ImageSkia& GetDefaultImage(int index); +const SkBitmap& GetDefaultImage(int index); // Resource IDs of default user images. extern const int kDefaultImageResources[]; diff --git a/chrome/browser/chromeos/login/message_bubble.cc b/chrome/browser/chromeos/login/message_bubble.cc index 91083ab..15eaccb 100644 --- a/chrome/browser/chromeos/login/message_bubble.cc +++ b/chrome/browser/chromeos/login/message_bubble.cc @@ -29,7 +29,7 @@ namespace chromeos { MessageBubble::MessageBubble(views::View* anchor_view, views::BubbleBorder::ArrowLocation arrow_location, - gfx::ImageSkia* image, + SkBitmap* image, const string16& text, const std::vector<string16>& links) : BubbleDelegateView(anchor_view, arrow_location), diff --git a/chrome/browser/chromeos/login/message_bubble.h b/chrome/browser/chromeos/login/message_bubble.h index aa5a797..e506aab 100644 --- a/chrome/browser/chromeos/login/message_bubble.h +++ b/chrome/browser/chromeos/login/message_bubble.h @@ -15,9 +15,7 @@ #include "ui/views/controls/link_listener.h" #include "ui/views/view.h" -namespace gfx { -class ImageSkia; -} +class SkBitmap; namespace views { class ImageButton; @@ -39,7 +37,7 @@ class MessageBubble : public views::BubbleDelegateView, public: MessageBubble(views::View* anchor_view, views::BubbleBorder::ArrowLocation arrow_location, - gfx::ImageSkia* image, + SkBitmap* image, const string16& text, const std::vector<string16>& links); @@ -62,7 +60,7 @@ class MessageBubble : public views::BubbleDelegateView, virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; private: - gfx::ImageSkia* image_; + SkBitmap* image_; string16 text_; views::ImageButton* close_button_; std::vector<views::Link*> help_links_; diff --git a/chrome/browser/chromeos/login/take_photo_view.cc b/chrome/browser/chromeos/login/take_photo_view.cc index c583d36..a9cb1c4 100644 --- a/chrome/browser/chromeos/login/take_photo_view.cc +++ b/chrome/browser/chromeos/login/take_photo_view.cc @@ -256,7 +256,7 @@ void TakePhotoView::ShowCameraError() { user_image_->SetErrorState(); } -const gfx::ImageSkia& TakePhotoView::GetImage() const { +const SkBitmap& TakePhotoView::GetImage() const { return user_image_->GetImage(); } diff --git a/chrome/browser/chromeos/login/take_photo_view.h b/chrome/browser/chromeos/login/take_photo_view.h index 9afc028..33e7d21 100644 --- a/chrome/browser/chromeos/login/take_photo_view.h +++ b/chrome/browser/chromeos/login/take_photo_view.h @@ -15,12 +15,12 @@ class SkBitmap; namespace gfx { class ImageSkia; -} +} // namespace gfx namespace views { class ImageButton; class Label; -} +} // namespace views namespace chromeos { @@ -60,7 +60,7 @@ class TakePhotoView : public views::View, void ShowCameraError(); // Returns the currently selected image. - const gfx::ImageSkia& GetImage() const; + const SkBitmap& GetImage() const; // Sets the image indicating that the view is used only for image preview. void SetImage(gfx::ImageSkia* image); diff --git a/chrome/browser/chromeos/login/user.cc b/chrome/browser/chromeos/login/user.cc index 2edcd15..80d10e2 100644 --- a/chrome/browser/chromeos/login/user.cc +++ b/chrome/browser/chromeos/login/user.cc @@ -42,13 +42,13 @@ User::User(const std::string& email, bool is_guest) } else { is_demo_user_ = true; } - image_ = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + image_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed( kDefaultImageResources[0]); } User::~User() {} -void User::SetImage(const gfx::ImageSkia& image, int image_index) { +void User::SetImage(const SkBitmap& image, int image_index) { image_ = image; image_index_ = image_index; image_is_stub_ = false; @@ -56,7 +56,7 @@ void User::SetImage(const gfx::ImageSkia& image, int image_index) { void User::SetStubImage(int image_index) { image_ = *ResourceBundle::GetSharedInstance(). - GetImageSkiaNamed(kStubImageResourceID); + GetBitmapNamed(kStubImageResourceID); image_index_ = image_index; image_is_stub_ = true; } diff --git a/chrome/browser/chromeos/login/user.h b/chrome/browser/chromeos/login/user.h index 510119f..24a926b 100644 --- a/chrome/browser/chromeos/login/user.h +++ b/chrome/browser/chromeos/login/user.h @@ -11,7 +11,6 @@ #include "base/basictypes.h" #include "third_party/skia/include/core/SkBitmap.h" -#include "ui/gfx/image/image_skia.h" // The demo user is represented by a domainless username. const char kDemoUser[] = "demouser"; @@ -63,13 +62,11 @@ class User { bool NeedsNameTooltip() const; // The image for this user. - const gfx::ImageSkia& image() const { return image_; } + const SkBitmap& image() const { return image_; } int image_index() const { return image_index_; } // The thumbnail of user custom wallpaper. - const SkBitmap& wallpaper_thumbnail() const { - return wallpaper_thumbnail_; - } + const SkBitmap& wallpaper_thumbnail() const { return wallpaper_thumbnail_; } // True if user image is a stub (while real image is being loaded from file). bool image_is_stub() const { return image_is_stub_; } @@ -93,7 +90,7 @@ class User { ~User(); // Setters are private so only UserManager can call them. - void SetImage(const gfx::ImageSkia& image, int image_index); + void SetImage(const SkBitmap& image, int image_index); // Sets a stub image until the next |SetImage| call. |image_index| may be // one of |kExternalImageIndex| or |kProfileImageIndex|. void SetStubImage(int image_index); @@ -112,7 +109,7 @@ class User { std::string email_; // The displayed user email, defaults to |email_|. std::string display_email_; - gfx::ImageSkia image_; + SkBitmap image_; OAuthTokenStatus oauth_token_status_; SkBitmap wallpaper_thumbnail_; diff --git a/chrome/browser/chromeos/login/user_image_screen.cc b/chrome/browser/chromeos/login/user_image_screen.cc index cf0ebbc..7f80c6b 100644 --- a/chrome/browser/chromeos/login/user_image_screen.cc +++ b/chrome/browser/chromeos/login/user_image_screen.cc @@ -18,7 +18,6 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" -#include "ui/gfx/image/image_skia.h" namespace chromeos { @@ -108,7 +107,7 @@ void UserImageScreen::StopCamera() { camera_controller_.Stop(); } -void UserImageScreen::OnPhotoTaken(const gfx::ImageSkia& image) { +void UserImageScreen::OnPhotoTaken(const SkBitmap& image) { UserManager* user_manager = UserManager::Get(); user_manager->SaveUserImage(user_manager->GetLoggedInUser().email(), image); @@ -164,7 +163,7 @@ void UserImageScreen::Observe(int type, // We've got a new profile image. if (actor_) actor_->AddProfileImage( - *content::Details<const gfx::ImageSkia>(details).ptr()); + *content::Details<const SkBitmap>(details).ptr()); break; } case chrome::NOTIFICATION_PROFILE_IMAGE_UPDATE_FAILED: { diff --git a/chrome/browser/chromeos/login/user_image_screen.h b/chrome/browser/chromeos/login/user_image_screen.h index 608c543..e22b506 100644 --- a/chrome/browser/chromeos/login/user_image_screen.h +++ b/chrome/browser/chromeos/login/user_image_screen.h @@ -36,7 +36,7 @@ class UserImageScreen: public WizardScreen, // UserImageScreenActor::Delegate implementation: virtual void StartCamera() OVERRIDE; virtual void StopCamera() OVERRIDE; - virtual void OnPhotoTaken(const gfx::ImageSkia& image) OVERRIDE; + virtual void OnPhotoTaken(const SkBitmap& image) OVERRIDE; virtual void OnProfileImageSelected() OVERRIDE; virtual void OnDefaultImageSelected(int index) OVERRIDE; virtual void OnActorDestroyed(UserImageScreenActor* actor) OVERRIDE; diff --git a/chrome/browser/chromeos/login/user_image_screen_actor.h b/chrome/browser/chromeos/login/user_image_screen_actor.h index cd84c19..8530005 100644 --- a/chrome/browser/chromeos/login/user_image_screen_actor.h +++ b/chrome/browser/chromeos/login/user_image_screen_actor.h @@ -8,10 +8,6 @@ class SkBitmap; -namespace gfx { -class ImageSkia; -} - namespace chromeos { // Interface for dependency injection between UserImageScreen and its actual @@ -27,7 +23,7 @@ class UserImageScreenActor { // Called when UI needs to start video capture. virtual void StartCamera() = 0; // Called when user accepts photo as login user image. - virtual void OnPhotoTaken(const gfx::ImageSkia& image) = 0; + virtual void OnPhotoTaken(const SkBitmap& image) = 0; // Called when user accepts Profile image as login user image. virtual void OnProfileImageSelected() = 0; // Called when user accepts one of the default images as login user @@ -70,7 +66,7 @@ class UserImageScreenActor { virtual bool IsCapturing() const = 0; // Inserts profile image in the list for user to select. - virtual void AddProfileImage(const gfx::ImageSkia& image) {} + virtual void AddProfileImage(const SkBitmap& image) {} // Indicates that there is no custom profile image for the user. virtual void OnProfileImageAbsent() {} diff --git a/chrome/browser/chromeos/options/take_photo_dialog.h b/chrome/browser/chromeos/options/take_photo_dialog.h index 22e83c5..6a509dc 100644 --- a/chrome/browser/chromeos/options/take_photo_dialog.h +++ b/chrome/browser/chromeos/options/take_photo_dialog.h @@ -31,7 +31,7 @@ class TakePhotoDialog : public views::DialogDelegateView, virtual ~Delegate() {} // Called when user accepts the photo. - virtual void OnPhotoAccepted(const gfx::ImageSkia& photo) = 0; + virtual void OnPhotoAccepted(const SkBitmap& photo) = 0; }; explicit TakePhotoDialog(Delegate* delegate); diff --git a/chrome/browser/chromeos/status/data_promo_notification.cc b/chrome/browser/chromeos/status/data_promo_notification.cc index b2cf615..0fe399e 100644 --- a/chrome/browser/chromeos/status/data_promo_notification.cc +++ b/chrome/browser/chromeos/status/data_promo_notification.cc @@ -203,8 +203,7 @@ void DataPromoNotification::ShowOptionalMobileDataPromoNotification( mobile_data_bubble_ = new MessageBubble( host, views::BubbleBorder::TOP_RIGHT, - ResourceBundle::GetSharedInstance().GetImageSkiaNamed( - IDR_NOTIFICATION_3G), + ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_NOTIFICATION_3G), message, links); mobile_data_bubble_->set_link_listener(listener); diff --git a/chrome/browser/chromeos/status/network_menu.cc b/chrome/browser/chromeos/status/network_menu.cc index 6542391..1b5ce7b 100644 --- a/chrome/browser/chromeos/status/network_menu.cc +++ b/chrome/browser/chromeos/status/network_menu.cc @@ -31,11 +31,11 @@ #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "net/base/escape.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/models/menu_model.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" -#include "ui/gfx/image/image_skia.h" #include "ui/gfx/skbitmap_operations.h" #include "ui/views/controls/menu/menu_item_view.h" #include "ui/views/controls/menu/menu_model_adapter.h" @@ -118,7 +118,7 @@ class NetworkMenuModel : public ui::MenuModel { sub_menu_model(NULL), flags(0) { } - MenuItem(ui::MenuModel::ItemType type, string16 label, gfx::ImageSkia icon, + MenuItem(ui::MenuModel::ItemType type, string16 label, SkBitmap icon, const std::string& service_path, int flags) : type(type), label(label), @@ -127,7 +127,7 @@ class NetworkMenuModel : public ui::MenuModel { sub_menu_model(NULL), flags(flags) { } - MenuItem(ui::MenuModel::ItemType type, string16 label, gfx::ImageSkia icon, + MenuItem(ui::MenuModel::ItemType type, string16 label, SkBitmap icon, NetworkMenuModel* sub_menu_model, int flags) : type(type), label(label), @@ -138,7 +138,7 @@ class NetworkMenuModel : public ui::MenuModel { ui::MenuModel::ItemType type; string16 label; - gfx::ImageSkia icon; + SkBitmap icon; std::string service_path; NetworkMenuModel* sub_menu_model; // Weak ptr. int flags; @@ -578,7 +578,7 @@ void MainMenuModel::AddWirelessNetworkMenuItem( flag |= FLAG_DISABLED; if (ShouldHighlightNetwork(wifi_network)) flag |= FLAG_ASSOCIATED; - const gfx::ImageSkia icon = NetworkMenuIcon::GetImage(wifi_network, + const SkBitmap icon = NetworkMenuIcon::GetBitmap(wifi_network, NetworkMenuIcon::COLOR_DARK); menu_items_.push_back( MenuItem(ui::MenuModel::TYPE_COMMAND, @@ -596,7 +596,7 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) { menu_items_.push_back( MenuItem(ui::MenuModel::TYPE_COMMAND, l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_LOCKED), - gfx::ImageSkia(), std::string(), FLAG_DISABLED)); + SkBitmap(), std::string(), FLAG_DISABLED)); return; } @@ -622,9 +622,9 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) { int flag = FLAG_ETHERNET; if (ShouldHighlightNetwork(ethernet_network)) flag |= FLAG_ASSOCIATED; - gfx::ImageSkia icon; - icon = NetworkMenuIcon::GetImage(ethernet_network, - NetworkMenuIcon::COLOR_DARK); + SkBitmap icon; + icon = NetworkMenuIcon::GetBitmap(ethernet_network, + NetworkMenuIcon::COLOR_DARK); menu_items_.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND, label, icon, std::string(), flag)); } @@ -646,8 +646,8 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) { menu_items_.push_back(MenuItem( ui::MenuModel::TYPE_COMMAND, l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_OTHER_WIFI_NETWORKS), - NetworkMenuIcon::GetConnectedImage(NetworkMenuIcon::ARCS, - NetworkMenuIcon::COLOR_DARK), + NetworkMenuIcon::GetConnectedBitmap(NetworkMenuIcon::ARCS, + NetworkMenuIcon::COLOR_DARK), std::string(), FLAG_ADD_WIFI)); } @@ -722,7 +722,7 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) { active_cellular && active_cellular->SupportsDataPlan(); if (isActive) flag |= FLAG_ASSOCIATED; - const gfx::ImageSkia icon = NetworkMenuIcon::GetImage(cell_networks[i], + const SkBitmap icon = NetworkMenuIcon::GetBitmap(cell_networks[i], NetworkMenuIcon::COLOR_DARK); menu_items_.push_back( MenuItem(ui::MenuModel::TYPE_COMMAND, @@ -740,7 +740,7 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) { if (label.length()) { menu_items_.push_back( MenuItem(ui::MenuModel::TYPE_COMMAND, - label, gfx::ImageSkia(), + label, SkBitmap(), std::string(), FLAG_DISABLED)); } } @@ -759,8 +759,8 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) { ui::MenuModel::TYPE_COMMAND, l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_OTHER_CELLULAR_NETWORKS), - NetworkMenuIcon::GetDisconnectedImage(NetworkMenuIcon::BARS, - NetworkMenuIcon::COLOR_DARK), + NetworkMenuIcon::GetDisconnectedBitmap(NetworkMenuIcon::BARS, + NetworkMenuIcon::COLOR_DARK), std::string(), FLAG_ADD_CELLULAR)); } } @@ -771,7 +771,7 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) { label = l10n_util::GetStringFUTF16(IDS_STATUSBAR_NETWORK_MENU_ITEM_INDENT, l10n_util::GetStringUTF16(IDS_STATUSBAR_NO_NETWORKS_MESSAGE)); menu_items_.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND, label, - gfx::ImageSkia(), std::string(), FLAG_DISABLED)); + SkBitmap(), std::string(), FLAG_DISABLED)); } bool show_wifi_scanning = wifi_available && cros->wifi_scanning(); @@ -789,7 +789,7 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) { // Add 'Scanning...' label = l10n_util::GetStringUTF16(IDS_STATUSBAR_WIFI_SCANNING_MESSAGE); menu_items_.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND, label, - gfx::ImageSkia(), std::string(), FLAG_DISABLED)); + SkBitmap(), std::string(), FLAG_DISABLED)); } if (show_toggle_wifi) { @@ -801,7 +801,7 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) { if (cros->wifi_busy()) flag |= FLAG_DISABLED; menu_items_.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND, label, - gfx::ImageSkia(), std::string(), flag)); + SkBitmap(), std::string(), flag)); } if (show_toggle_mobile) { @@ -821,9 +821,9 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) { id = IDS_STATUSBAR_NETWORK_DEVICE_ENABLE; label = l10n_util::GetStringFUTF16(id, l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_CELLULAR)); - gfx::ImageSkia icon; + SkBitmap icon; if (is_locked) { - icon = *rb.GetImageSkiaNamed(IDR_STATUSBAR_NETWORK_SECURE); + icon = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE); } int flag = FLAG_TOGGLE_MOBILE; if (cros->mobile_busy()) @@ -838,7 +838,7 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) { // menu_items_.push_back(MenuItem(cros->offline_mode() ? // ui::MenuModel::TYPE_CHECK : ui::MenuModel::TYPE_COMMAND, // l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_OFFLINE_MODE), - // ImageSkia(), std::string(), FLAG_TOGGLE_OFFLINE)); + // SkBitmap(), std::string(), FLAG_TOGGLE_OFFLINE)); // Additional links like: // * Network settings; @@ -850,7 +850,7 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) { menu_items_.push_back(MenuItem( ui::MenuModel::TYPE_SUBMENU, l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_MORE), - gfx::ImageSkia(), more_menu_model_.get(), FLAG_NONE)); + SkBitmap(), more_menu_model_.get(), FLAG_NONE)); } } @@ -890,7 +890,7 @@ void VPNMenuModel::InitMenuItems(bool should_open_button_options) { flag |= FLAG_DISABLED; if (ShouldHighlightNetwork(vpn)) flag |= FLAG_ASSOCIATED; - const gfx::ImageSkia icon = NetworkMenuIcon::GetImage(vpn, + const SkBitmap icon = NetworkMenuIcon::GetBitmap(vpn, NetworkMenuIcon::COLOR_DARK); menu_items_.push_back( MenuItem(ui::MenuModel::TYPE_COMMAND, @@ -906,14 +906,14 @@ void VPNMenuModel::InitMenuItems(bool should_open_button_options) { menu_items_.push_back(MenuItem( ui::MenuModel::TYPE_COMMAND, l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_ADD_VPN), - gfx::ImageSkia(), std::string(), FLAG_ADD_VPN)); + SkBitmap(), std::string(), FLAG_ADD_VPN)); } // Show disconnect if we have an active VPN. if (active_vpn) { menu_items_.push_back(MenuItem( ui::MenuModel::TYPE_COMMAND, l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DISCONNECT_VPN), - gfx::ImageSkia(), std::string(), FLAG_DISCONNECT_VPN)); + SkBitmap(), std::string(), FLAG_DISCONNECT_VPN)); } } @@ -941,16 +941,14 @@ void MoreMenuModel::InitMenuItems(bool should_open_button_options) { if (message_id != -1) { link_items.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND, l10n_util::GetStringUTF16(message_id), - gfx::ImageSkia(), - std::string(), - FLAG_OPTIONS)); + SkBitmap(), std::string(), FLAG_OPTIONS)); } if (connected) { std::string ip_address = cros->IPAddress(); if (!ip_address.empty()) { address_items.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND, - ASCIIToUTF16(cros->IPAddress()), gfx::ImageSkia(), std::string(), + ASCIIToUTF16(cros->IPAddress()), SkBitmap(), std::string(), FLAG_DISABLED)); } } @@ -964,7 +962,7 @@ void MoreMenuModel::InitMenuItems(bool should_open_button_options) { std::string label = l10n_util::GetStringUTF8( IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET) + " " + hardware_address; address_items.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND, - UTF8ToUTF16(label), gfx::ImageSkia(), std::string(), FLAG_DISABLED)); + UTF8ToUTF16(label), SkBitmap(), std::string(), FLAG_DISABLED)); } } @@ -978,8 +976,7 @@ void MoreMenuModel::InitMenuItems(bool should_open_button_options) { std::string label = l10n_util::GetStringUTF8( IDS_STATUSBAR_NETWORK_DEVICE_WIFI) + " " + hardware_address; address_items.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND, - UTF8ToUTF16(label), gfx::ImageSkia(), std::string(), - FLAG_DISABLED)); + UTF8ToUTF16(label), SkBitmap(), std::string(), FLAG_DISABLED)); } } } diff --git a/chrome/browser/chromeos/status/network_menu_icon.cc b/chrome/browser/chromeos/status/network_menu_icon.cc index 976b335..a6b12a9 100644 --- a/chrome/browser/chromeos/status/network_menu_icon.cc +++ b/chrome/browser/chromeos/status/network_menu_icon.cc @@ -32,13 +32,13 @@ const int kThrobDurationMs = 750; // Images for strength bars for wired networks. const int kNumBarsImages = 5; -gfx::ImageSkia* kBarsImagesAnimatingDark[kNumBarsImages - 1]; -gfx::ImageSkia* kBarsImagesAnimatingLight[kNumBarsImages - 1]; +SkBitmap* kBarsImagesAnimatingDark[kNumBarsImages - 1]; +SkBitmap* kBarsImagesAnimatingLight[kNumBarsImages - 1]; // Imagaes for strength arcs for wireless networks. const int kNumArcsImages = 5; -gfx::ImageSkia* kArcsImagesAnimatingDark[kNumArcsImages - 1]; -gfx::ImageSkia* kArcsImagesAnimatingLight[kNumArcsImages - 1]; +SkBitmap* kArcsImagesAnimatingDark[kNumArcsImages - 1]; +SkBitmap* kArcsImagesAnimatingLight[kNumArcsImages - 1]; // Badge offsets. If a badge is large enough that it won't fit within the icon // when using the right or bottom offset, it gets shifted inwards so it will. @@ -78,8 +78,7 @@ int CellularStrengthIndex(const CellularNetwork* cellular) { return StrengthIndex(cellular->strength(), kNumBarsImages - 1); } -const gfx::ImageSkia* BadgeForNetworkTechnology( - const CellularNetwork* cellular) { +const SkBitmap* BadgeForNetworkTechnology(const CellularNetwork* cellular) { const int kUnknownBadgeType = -1; int id = kUnknownBadgeType; switch (cellular->network_technology()) { @@ -146,7 +145,7 @@ const gfx::ImageSkia* BadgeForNetworkTechnology( if (id == kUnknownBadgeType) return NULL; else - return ResourceBundle::GetSharedInstance().GetImageSkiaNamed(id); + return ResourceBundle::GetSharedInstance().GetBitmapNamed(id); } // Generates a single empty vpn image for blending. @@ -155,7 +154,7 @@ const SkBitmap& GetEmptyVpnBadge() { if (empty_vpn_badge == NULL) { empty_vpn_badge = new SkBitmap(); ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - const gfx::ImageSkia* vpn_badge = rb.GetImageSkiaNamed(kVpnBadgeId); + const SkBitmap* vpn_badge = rb.GetBitmapNamed(kVpnBadgeId); empty_vpn_badge->setConfig(SkBitmap::kARGB_8888_Config, vpn_badge->width(), vpn_badge->height()); @@ -165,13 +164,13 @@ const SkBitmap& GetEmptyVpnBadge() { return *empty_vpn_badge; } -const gfx::ImageSkia GetVpnResource(int resource_id) { +const SkBitmap GetVpnResource(int resource_id) { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - const gfx::ImageSkia* ethernet_icon = rb.GetImageSkiaNamed(resource_id); + const SkBitmap* ethernet_icon = rb.GetBitmapNamed(resource_id); gfx::Canvas canvas( gfx::Size(ethernet_icon->width(), ethernet_icon->height()), false); canvas.DrawBitmapInt(*ethernet_icon, 0, 0); - const gfx::ImageSkia* vpn_badge = rb.GetImageSkiaNamed(kVpnBadgeId); + const SkBitmap* vpn_badge = rb.GetBitmapNamed(kVpnBadgeId); canvas.DrawBitmapInt(*vpn_badge, kBadgeLeftX, kBadgeBottomY); return canvas.ExtractBitmap(); } @@ -182,7 +181,7 @@ const gfx::ImageSkia GetVpnResource(int resource_id) { // NetworkIcon // TODO(stevenjb): Separate class implementation from the definition. -// Sets up and generates an ImageSkia for a Network icon. +// Sets up and generates an SkBitmap for a Network icon. class NetworkIcon { public: // Default constructor is used by the status bar icon (NetworkMenuIcon). @@ -220,7 +219,7 @@ class NetworkIcon { // Resets the icon state. void ClearIconAndBadges() { - icon_ = gfx::ImageSkia(); + icon_ = SkBitmap(); top_left_badge_ = NULL; top_right_badge_ = NULL; bottom_left_badge_ = NULL; @@ -250,7 +249,7 @@ class NetworkIcon { } // Determine whether or not we need to update the icon. - bool dirty = image_.empty(); + bool dirty = bitmap_.empty(); // If the network state has changed, the icon needs updating. if (state_ != network->state()) { @@ -279,8 +278,8 @@ class NetworkIcon { if (dirty) { // Set the icon and badges based on the network. UpdateIcon(network); - // Generate the image from the icon. - GenerateImage(); + // Generate the bitmap from the icon. + GenerateBitmap(); } } @@ -290,7 +289,7 @@ class NetworkIcon { switch (network->type()) { case TYPE_ETHERNET: { - icon_ = *rb.GetImageSkiaNamed(IDR_STATUSBAR_WIRED); + icon_ = *rb.GetBitmapNamed(IDR_STATUSBAR_WIRED); break; } case TYPE_WIFI: { @@ -298,7 +297,7 @@ class NetworkIcon { static_cast<const WifiNetwork*>(network); if (strength_index_ == -1) strength_index_ = WifiStrengthIndex(wifi); - icon_ = NetworkMenuIcon::GetImage( + icon_ = NetworkMenuIcon::GetBitmap( NetworkMenuIcon::ARCS, strength_index_, resource_color_theme_); break; } @@ -307,7 +306,7 @@ class NetworkIcon { static_cast<const WimaxNetwork*>(network); if (strength_index_ == -1) strength_index_ = WimaxStrengthIndex(wimax); - icon_ = NetworkMenuIcon::GetImage( + icon_ = NetworkMenuIcon::GetBitmap( NetworkMenuIcon::BARS, strength_index_, resource_color_theme_); break; } @@ -316,18 +315,18 @@ class NetworkIcon { static_cast<const CellularNetwork*>(network); if (strength_index_ == -1) strength_index_ = CellularStrengthIndex(cellular); - icon_ = NetworkMenuIcon::GetImage( + icon_ = NetworkMenuIcon::GetBitmap( NetworkMenuIcon::BARS, strength_index_, resource_color_theme_); break; } case TYPE_VPN: { - icon_ = *rb.GetImageSkiaNamed(IDR_STATUSBAR_VPN); + icon_ = *rb.GetBitmapNamed(IDR_STATUSBAR_VPN); break; } default: { LOG(WARNING) << "Request for icon for unsupported type: " << network->type(); - icon_ = *rb.GetImageSkiaNamed(IDR_STATUSBAR_WIRED); + icon_ = *rb.GetBitmapNamed(IDR_STATUSBAR_WIRED); break; } } @@ -347,7 +346,7 @@ class NetworkIcon { case TYPE_ETHERNET: { if (network->disconnected()) { bottom_right_badge_ = - rb.GetImageSkiaNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED); + rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED); } break; } @@ -356,12 +355,11 @@ class NetworkIcon { static_cast<const WifiNetwork*>(network); if (wifi->encrypted() && resource_color_theme_ == NetworkMenuIcon::COLOR_DARK) - bottom_right_badge_ = rb.GetImageSkiaNamed( - IDR_STATUSBAR_NETWORK_SECURE); + bottom_right_badge_ = rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE); break; } case TYPE_WIMAX: { - bottom_right_badge_ = rb.GetImageSkiaNamed(IDR_STATUSBAR_NETWORK_4G); + bottom_right_badge_ = rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_4G); break; } case TYPE_CELLULAR: { @@ -370,7 +368,7 @@ class NetworkIcon { if (cellular->roaming_state() == ROAMING_STATE_ROAMING && !cros->IsCellularAlwaysInRoaming()) { // For cellular that always in roaming don't show roaming badge. - top_left_badge_ = rb.GetImageSkiaNamed(IDR_STATUSBAR_NETWORK_ROAMING); + top_left_badge_ = rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_ROAMING); } if (!cellular->connecting()) bottom_right_badge_ = BadgeForNetworkTechnology(cellular); @@ -381,7 +379,7 @@ class NetworkIcon { } // Display warning badge if cros is not loaded. if (is_status_bar_&& !CrosLibrary::Get()->load_error_string().empty()) - top_right_badge_ = rb.GetImageSkiaNamed(IDR_STATUSBAR_NETWORK_WARNING); + top_right_badge_ = rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_WARNING); } // Clears any previous state then sets the base icon and badges. @@ -407,25 +405,25 @@ class NetworkIcon { SetBadges(connected_network); } else { // Use the ethernet icon for VPN when not connected. - icon_ = *rb.GetImageSkiaNamed(IDR_STATUSBAR_WIRED); + icon_ = *rb.GetBitmapNamed(IDR_STATUSBAR_WIRED); // We can be connected to a VPN, even when there is no connected // underlying network. In that case, for the status bar, show the // disconnected badge. if (is_status_bar_) { bottom_right_badge_ = - rb.GetImageSkiaNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED); + rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED); } } // Overlay the VPN badge. - bottom_left_badge_ = rb.GetImageSkiaNamed(kVpnBadgeId); + bottom_left_badge_ = rb.GetBitmapNamed(kVpnBadgeId); } - // Generates the image. Call after setting the icon and badges. - void GenerateImage() { + // Generates the bitmap. Call after setting the icon and badges. + void GenerateBitmap() { if (icon_.empty()) return; - image_ = NetworkMenuIcon::GenerateImageFromComponents( + bitmap_ = NetworkMenuIcon::GenerateBitmapFromComponents( icon_, top_left_badge_, top_right_badge_, @@ -433,19 +431,19 @@ class NetworkIcon { bottom_right_badge_); } - const gfx::ImageSkia GetImage() const { return image_; } + const SkBitmap GetBitmap() const { return bitmap_; } - void set_icon(const gfx::ImageSkia& icon) { icon_ = icon; } - void set_top_left_badge(const gfx::ImageSkia* badge) { + void set_icon(const SkBitmap& icon) { icon_ = icon; } + void set_top_left_badge(const SkBitmap* badge) { top_left_badge_ = badge; } - void set_top_right_badge(const gfx::ImageSkia* badge) { + void set_top_right_badge(const SkBitmap* badge) { top_right_badge_ = badge; } - void set_bottom_left_badge(const gfx::ImageSkia* badge) { + void set_bottom_left_badge(const SkBitmap* badge) { bottom_left_badge_ = badge; } - void set_bottom_right_badge(const gfx::ImageSkia* badge) { + void set_bottom_right_badge(const SkBitmap* badge) { bottom_right_badge_ = badge; } @@ -480,8 +478,7 @@ class NetworkIcon { bool dirty = false; const CellularNetwork* cellular = static_cast<const CellularNetwork*>(network); - const gfx::ImageSkia* technology_badge = BadgeForNetworkTechnology( - cellular); + const SkBitmap* technology_badge = BadgeForNetworkTechnology(cellular); if (technology_badge != bottom_right_badge_) { dirty = true; } @@ -496,12 +493,12 @@ class NetworkIcon { ConnectionState state_; NetworkMenuIcon::ResourceColorTheme resource_color_theme_; int strength_index_; - gfx::ImageSkia image_; - gfx::ImageSkia icon_; - const gfx::ImageSkia* top_left_badge_; - const gfx::ImageSkia* top_right_badge_; - const gfx::ImageSkia* bottom_left_badge_; - const gfx::ImageSkia* bottom_right_badge_; + SkBitmap bitmap_; + SkBitmap icon_; + const SkBitmap* top_left_badge_; + const SkBitmap* top_right_badge_; + const SkBitmap* bottom_left_badge_; + const SkBitmap* bottom_right_badge_; bool is_status_bar_; const Network* connected_network_; // weak pointer; used for VPN icons. NetworkRoamingState roaming_state_; @@ -540,12 +537,12 @@ void NetworkMenuIcon::SetResourceColorTheme(ResourceColorTheme color) { icon_.reset(new NetworkIcon(resource_color_theme_)); } -const gfx::ImageSkia NetworkMenuIcon::GetIconAndText(string16* text) { +const SkBitmap NetworkMenuIcon::GetIconAndText(string16* text) { SetIconAndText(); if (text) *text = text_; - icon_->GenerateImage(); - return icon_->GetImage(); + icon_->GenerateBitmap(); + return icon_->GetBitmap(); } void NetworkMenuIcon::AnimationProgressed(const ui::Animation* animation) { @@ -585,17 +582,17 @@ double NetworkMenuIcon::GetAnimation() { // TODO(stevenjb): move below SetIconAndText. void NetworkMenuIcon::SetConnectingIconAndText() { int image_count; - ImageType image_type; - gfx::ImageSkia** images; + BitmapType bitmap_type; + SkBitmap** images; if (connecting_network_->type() == TYPE_WIFI) { image_count = kNumArcsImages - 1; - image_type = ARCS; + bitmap_type = ARCS; images = resource_color_theme_ == COLOR_DARK ? kArcsImagesAnimatingDark : kArcsImagesAnimatingLight; } else { image_count = kNumBarsImages - 1; - image_type = BARS; + bitmap_type = BARS; images = resource_color_theme_ == COLOR_DARK ? kBarsImagesAnimatingDark : kBarsImagesAnimatingLight; } @@ -604,10 +601,9 @@ void NetworkMenuIcon::SetConnectingIconAndText() { // Lazily cache images. if (!images[index]) { - gfx::ImageSkia source = - GetImage(image_type, index + 1, resource_color_theme_); + SkBitmap source = GetBitmap(bitmap_type, index + 1, resource_color_theme_); images[index] = - new gfx::ImageSkia(NetworkMenuIcon::GenerateConnectingBitmap(source)); + new SkBitmap(NetworkMenuIcon::GenerateConnectingBitmap(source)); } icon_->set_icon(*images[index]); icon_->SetBadges(connecting_network_); @@ -664,12 +660,12 @@ void NetworkMenuIcon::SetActiveNetworkIconAndText(const Network* network) { // Overlay the VPN badge if connecting to a VPN. if (network->type() != TYPE_VPN && cros->virtual_network()) { if (cros->virtual_network()->connecting()) { - const gfx::ImageSkia* vpn_badge = rb.GetImageSkiaNamed(kVpnBadgeId); + const SkBitmap* vpn_badge = rb.GetBitmapNamed(kVpnBadgeId); const double animation = GetAnimation(); animating = true; // Even though this is the only place we use vpn_connecting_badge_, // it is important that this is a member variable since we set a - // pointer to it and access that pointer in icon_->GenerateImage(). + // pointer to it and access that pointer in icon_->GenerateBitmap(). vpn_connecting_badge_ = SkBitmapOperations::CreateBlendedBitmap( GetEmptyVpnBadge(), *vpn_badge, animation); icon_->set_bottom_left_badge(&vpn_connecting_badge_); @@ -703,17 +699,17 @@ void NetworkMenuIcon::SetDisconnectedIconAndText() { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); switch (last_network_type_) { case TYPE_ETHERNET: - icon_->set_icon(*rb.GetImageSkiaNamed(IDR_STATUSBAR_WIRED)); + icon_->set_icon(*rb.GetBitmapNamed(IDR_STATUSBAR_WIRED)); icon_->set_bottom_right_badge( - rb.GetImageSkiaNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED)); + rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED)); break; case TYPE_WIFI: case TYPE_WIMAX: case TYPE_CELLULAR: default: - icon_->set_icon(GetDisconnectedImage(BARS, resource_color_theme_)); + icon_->set_icon(GetDisconnectedBitmap(BARS, resource_color_theme_)); icon_->set_bottom_right_badge( - rb.GetImageSkiaNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED)); + rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED)); break; } if (mode_ == MENU_MODE) @@ -723,15 +719,15 @@ void NetworkMenuIcon::SetDisconnectedIconAndText() { } //////////////////////////////////////////////////////////////////////////////// -// Static functions for generating network icon images: +// Static functions for generating network icon bitmaps: // This defines how we assemble a network icon. -const gfx::ImageSkia NetworkMenuIcon::GenerateImageFromComponents( - const gfx::ImageSkia& icon, - const gfx::ImageSkia* top_left_badge, - const gfx::ImageSkia* top_right_badge, - const gfx::ImageSkia* bottom_left_badge, - const gfx::ImageSkia* bottom_right_badge) { +const SkBitmap NetworkMenuIcon::GenerateBitmapFromComponents( + const SkBitmap& icon, + const SkBitmap* top_left_badge, + const SkBitmap* top_right_badge, + const SkBitmap* bottom_left_badge, + const SkBitmap* bottom_right_badge) { DCHECK(!icon.empty()); gfx::Canvas canvas(icon, false); @@ -752,12 +748,12 @@ const gfx::ImageSkia NetworkMenuIcon::GenerateImageFromComponents( canvas.DrawBitmapInt(*bottom_right_badge, x, y); } - return gfx::ImageSkia(canvas.ExtractBitmap()); + return canvas.ExtractBitmap(); } // We blend connecting icons with a black image to generate a faded icon. const SkBitmap NetworkMenuIcon::GenerateConnectingBitmap( - const gfx::ImageSkia& source) { + const SkBitmap& source) { CR_DEFINE_STATIC_LOCAL(SkBitmap, empty_badge, ()); if (empty_badge.empty()) { empty_badge.setConfig(SkBitmap::kARGB_8888_Config, @@ -772,9 +768,9 @@ const SkBitmap NetworkMenuIcon::GenerateConnectingBitmap( empty_badge, source, kConnectingImageAlpha); } -// Generates and caches an icon image for a network's current state. -const gfx::ImageSkia NetworkMenuIcon::GetImage(const Network* network, - ResourceColorTheme color) { +// Generates and caches an icon bitmap for a network's current state. +const SkBitmap NetworkMenuIcon::GetBitmap(const Network* network, + ResourceColorTheme color) { DCHECK(network); // Maintain a static (global) icon map. Note: Icons are never destroyed; // it is assumed that a finite and reasonable number of network icons will be @@ -798,38 +794,38 @@ const gfx::ImageSkia NetworkMenuIcon::GetImage(const Network* network, } else { icon = iter->second; } - // Update and return the icon's image. + // Update and return the icon's bitmap. icon->Update(); - return icon->GetImage(); + return icon->GetBitmap(); } // Returns an icon for a disconnected VPN. -const gfx::ImageSkia NetworkMenuIcon::GetVpnImage() { - static gfx::ImageSkia* vpn_image = NULL; - if (vpn_image == NULL) - vpn_image = new gfx::ImageSkia(GetVpnResource(IDR_STATUSBAR_VPN)); - return *vpn_image; +const SkBitmap NetworkMenuIcon::GetVpnBitmap() { + static SkBitmap* vpn_bitmap = NULL; + if (vpn_bitmap == NULL) + vpn_bitmap = new SkBitmap(GetVpnResource(IDR_STATUSBAR_VPN)); + return *vpn_bitmap; } -const gfx::ImageSkia NetworkMenuIcon::GetImage(ImageType type, - int index, - ResourceColorTheme color) { +const SkBitmap NetworkMenuIcon::GetBitmap(BitmapType type, + int index, + ResourceColorTheme color) { int width, height; - gfx::ImageSkia* images; + SkBitmap* images; if (type == ARCS) { if (index >= kNumArcsImages) - return gfx::ImageSkia(); + return SkBitmap(); - images = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + images = ResourceBundle::GetSharedInstance().GetBitmapNamed( color == COLOR_DARK ? IDR_STATUSBAR_NETWORK_ARCS_DARK : IDR_STATUSBAR_NETWORK_ARCS_LIGHT); width = images->width(); height = images->height() / kNumArcsImages; } else { if (index >= kNumBarsImages) - return gfx::ImageSkia(); + return SkBitmap(); - images = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + images = ResourceBundle::GetSharedInstance().GetBitmapNamed( color == COLOR_DARK ? IDR_STATUSBAR_NETWORK_BARS_DARK : IDR_STATUSBAR_NETWORK_BARS_LIGHT); width = images->width(); @@ -837,23 +833,23 @@ const gfx::ImageSkia NetworkMenuIcon::GetImage(ImageType type, } SkIRect subset = SkIRect::MakeXYWH(0, index * height, width, height); - gfx::ImageSkia image; + SkBitmap image; images->extractSubset(&image, subset); return image; } -const gfx::ImageSkia NetworkMenuIcon::GetDisconnectedImage( - ImageType type, +const SkBitmap NetworkMenuIcon::GetDisconnectedBitmap( + BitmapType type, ResourceColorTheme color) { - return GetImage(type, 0, color); + return GetBitmap(type, 0, color); } -const gfx::ImageSkia NetworkMenuIcon::GetConnectedImage(ImageType type, - ResourceColorTheme color) { - return GetImage(type, NumImages(type) - 1, color); +const SkBitmap NetworkMenuIcon::GetConnectedBitmap(BitmapType type, + ResourceColorTheme color) { + return GetBitmap(type, NumBitmaps(type) - 1, color); } -int NetworkMenuIcon::NumImages(ImageType type) { +int NetworkMenuIcon::NumBitmaps(BitmapType type) { return (type == ARCS) ? kNumArcsImages : kNumBarsImages; } diff --git a/chrome/browser/chromeos/status/network_menu_icon.h b/chrome/browser/chromeos/status/network_menu_icon.h index d4a79a0..832b3e1 100644 --- a/chrome/browser/chromeos/status/network_menu_icon.h +++ b/chrome/browser/chromeos/status/network_menu_icon.h @@ -13,7 +13,7 @@ // class MyIconDelegate : public NetworkMenuIcon::Delegate { // virtual void NetworkMenuIconChanged() OVERRIDE { // string16 tooltip; -// const ImageSkia* image = network_icon_->GetIconAndText(&tooltip); +// const SkBitmap* bitmap = network_icon_->GetIconAndText(&tooltip); // SetIcon(*bitmap); // SetTooltip(tooltip); // SchedulePaint(); @@ -22,7 +22,7 @@ // MyIconDelegate my_delegate; // NetworkMenuIcon icon(&my_delegate, NetworkMenuIcon::MENU_MODE); // -// NetworkMenuIcon also provides static functions for fetching network images +// NetworkMenuIcon also provides static functions for fetching network bitmaps // (e.g. for network entries in the menu or settings). // Example usage: // Network* network = network_library->FindNetworkByPath(my_network_path_); @@ -36,9 +36,9 @@ #include "base/memory/scoped_ptr.h" #include "chrome/browser/chromeos/cros/network_library.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/animation/animation_delegate.h" #include "ui/base/animation/throb_animation.h" -#include "ui/gfx/image/image_skia.h" namespace chromeos { @@ -57,7 +57,7 @@ class NetworkMenuIcon : public ui::AnimationDelegate { }; // Used for calls to GetBitmap() and GetNumBitmaps() below. - enum ImageType { + enum BitmapType { ARCS = 0, BARS }; @@ -66,8 +66,8 @@ class NetworkMenuIcon : public ui::AnimationDelegate { public: Delegate() {} virtual ~Delegate() {} - // Called when the image has changed due to animation. The callback should - // trigger a call to GetIconAndText() to generate and retrieve the image. + // Called when the bitmap has changed due to animation. The callback should + // trigger a call to GetIconAndText() to generate and retrieve the bitmap. virtual void NetworkMenuIconChanged() = 0; private: @@ -87,52 +87,52 @@ class NetworkMenuIcon : public ui::AnimationDelegate { // Sets the resource color theme (e.g. light or dark icons). void SetResourceColorTheme(ResourceColorTheme color); - // Generates and returns the icon image. If |text| is not NULL, sets it to + // Generates and returns the icon bitmap. If |text| is not NULL, sets it to // the tooltip or display text to show, based on the value of mode_. - const gfx::ImageSkia GetIconAndText(string16* text); + const SkBitmap GetIconAndText(string16* text); // ui::AnimationDelegate implementation. virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; - // Static functions for generating network icon images: + // Static functions for generating network icon bitmaps: - // Composites the images to generate a network icon. Input parameters are + // Composites the bitmaps to generate a network icon. Input parameters are // the icon and badges that are composited to generate |result|. Public // primarily for unit tests. - static const gfx::ImageSkia GenerateImageFromComponents( - const gfx::ImageSkia& icon, - const gfx::ImageSkia* top_left_badge, - const gfx::ImageSkia* top_right_badge, - const gfx::ImageSkia* bottom_left_badge, - const gfx::ImageSkia* bottom_right_badge); + static const SkBitmap GenerateBitmapFromComponents( + const SkBitmap& icon, + const SkBitmap* top_left_badge, + const SkBitmap* top_right_badge, + const SkBitmap* bottom_left_badge, + const SkBitmap* bottom_right_badge); // Returns a modified version of |source| representing the connecting state // of a network. Public for unit tests. - static const SkBitmap GenerateConnectingBitmap(const gfx::ImageSkia& source); + static const SkBitmap GenerateConnectingBitmap(const SkBitmap& source); - // Returns an image associated with |network|, reflecting its current state. - static const gfx::ImageSkia GetImage(const Network* network, - ResourceColorTheme color); + // Returns a bitmap associated with |network|, reflecting its current state. + static const SkBitmap GetBitmap(const Network* network, + ResourceColorTheme color); - // Returns an image representing an unconnected VPN. - static const gfx::ImageSkia GetVpnImage(); + // Returns a bitmap representing an unconnected VPN. + static const SkBitmap GetVpnBitmap(); - // Access a specific image of the specified color theme. If index is out of - // range, an empty image will be returned. - static const gfx::ImageSkia GetImage(ImageType type, - int index, - ResourceColorTheme color); + // Access a specific bitmap of the specified color theme. If index is out of + // range, an empty bitmap will be returned. + static const SkBitmap GetBitmap(BitmapType type, + int index, + ResourceColorTheme color); - // Gets the disconnected image for given type. - static const gfx::ImageSkia GetDisconnectedImage(ImageType type, - ResourceColorTheme color); + // Gets the disconnected bitmap for given type. + static const SkBitmap GetDisconnectedBitmap(BitmapType type, + ResourceColorTheme color); - // Gets the connected image for given type. - static const gfx::ImageSkia GetConnectedImage(ImageType type, - ResourceColorTheme color); + // Gets the connected bitmap for given type. + static const SkBitmap GetConnectedBitmap(BitmapType type, + ResourceColorTheme color); - // Returns total number of images for given type. - static int NumImages(ImageType type); + // Returns total number of bitmaps for given type. + static int NumBitmaps(BitmapType type); protected: // Starts the connection animation if necessary and returns its current value. @@ -158,8 +158,8 @@ class NetworkMenuIcon : public ui::AnimationDelegate { Mode mode_; // A delegate may be specified to receive notifications when this animates. Delegate* delegate_; - // Generated image for connecting to a VPN. - gfx::ImageSkia vpn_connecting_badge_; + // Generated bitmap for connecting to a VPN. + SkBitmap vpn_connecting_badge_; ResourceColorTheme resource_color_theme_; // Animation throbber for animating the icon while conencting. ui::ThrobAnimation animation_connecting_; diff --git a/chrome/browser/chromeos/status/network_menu_icon_unittest.cc b/chrome/browser/chromeos/status/network_menu_icon_unittest.cc index 6944dbb..8e7437e 100644 --- a/chrome/browser/chromeos/status/network_menu_icon_unittest.cc +++ b/chrome/browser/chromeos/status/network_menu_icon_unittest.cc @@ -12,17 +12,8 @@ namespace { -// Compares each pixel in the 1x representation of two images for testing. -// TODO(pkotwicz): Compare pixels of all bitmaps contained within image. -bool CompareTwoImages(const gfx::ImageSkia& image_a, - const gfx::ImageSkia& image_b, - int log_level) { - float actual_scale_factor; - SkBitmap a = image_a.GetBitmapForScale(1.0f, 1.0f, &actual_scale_factor); - DCHECK_EQ(1.0f, actual_scale_factor); - SkBitmap b = image_b.GetBitmapForScale(1.0f, 1.0f, &actual_scale_factor); - DCHECK_EQ(1.0f, actual_scale_factor); - +// Compares each pixel in two bitmaps for testing. +bool CompareTwoBitmaps(const SkBitmap& a, const SkBitmap& b, int log_level) { CHECK(!a.empty()); CHECK(!b.empty()); if (a.getSize() != b.getSize()) { @@ -76,67 +67,67 @@ class NetworkMenuIconTest : public testing::Test { virtual void SetUp() OVERRIDE { cros_ = CrosLibrary::Get()->GetNetworkLibrary(); // Ethernet connected = WIRED icon, no badges. - ethernet_connected_image_ = NetworkMenuIcon::GenerateImageFromComponents( - *rb_.GetImageSkiaNamed(IDR_STATUSBAR_WIRED), + ethernet_connected_bitmap_ = NetworkMenuIcon::GenerateBitmapFromComponents( + *rb_.GetBitmapNamed(IDR_STATUSBAR_WIRED), NULL, NULL, NULL, NULL); // Ethernet disonnected = WIRED icon + DISCONNECTED badge. - ethernet_disconnected_image_ = - NetworkMenuIcon::GenerateImageFromComponents( - *rb_.GetImageSkiaNamed(IDR_STATUSBAR_WIRED), + ethernet_disconnected_bitmap_ = + NetworkMenuIcon::GenerateBitmapFromComponents( + *rb_.GetBitmapNamed(IDR_STATUSBAR_WIRED), NULL, NULL, NULL, - rb_.GetImageSkiaNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED)); + rb_.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED)); // Wifi connected, strength = 100% = ARCS4 icon, no badges. - wifi_connected_100_image_ = NetworkMenuIcon::GenerateImageFromComponents( - NetworkMenuIcon::GetImage( + wifi_connected_100_bitmap_ = NetworkMenuIcon::GenerateBitmapFromComponents( + NetworkMenuIcon::GetBitmap( NetworkMenuIcon::ARCS, - NetworkMenuIcon::NumImages(NetworkMenuIcon::ARCS) - 1, + NetworkMenuIcon::NumBitmaps(NetworkMenuIcon::ARCS) - 1, NetworkMenuIcon::COLOR_DARK), NULL, NULL, NULL, NULL); // Wifi connected, strength = 50%, encrypted = ARCS2 icon + SECURE badge. - wifi_encrypted_50_image_ = NetworkMenuIcon::GenerateImageFromComponents( - NetworkMenuIcon::GetImage(NetworkMenuIcon::ARCS, 3, - NetworkMenuIcon::COLOR_DARK), - NULL, NULL, NULL, rb_.GetImageSkiaNamed(IDR_STATUSBAR_NETWORK_SECURE)); + wifi_encrypted_50_bitmap_ = NetworkMenuIcon::GenerateBitmapFromComponents( + NetworkMenuIcon::GetBitmap(NetworkMenuIcon::ARCS, 3, + NetworkMenuIcon::COLOR_DARK), + NULL, NULL, NULL, rb_.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE)); // Wifi disconnected (strength = 0%) = ARCS0 icon. - wifi_disconnected_image_ = NetworkMenuIcon::GenerateImageFromComponents( - NetworkMenuIcon::GetImage(NetworkMenuIcon::ARCS, 0, - NetworkMenuIcon::COLOR_DARK), + wifi_disconnected_bitmap_ = NetworkMenuIcon::GenerateBitmapFromComponents( + NetworkMenuIcon::GetBitmap(NetworkMenuIcon::ARCS, 0, + NetworkMenuIcon::COLOR_DARK), NULL, NULL, NULL, NULL); // Wifi connecting = IDR_STATUSBAR_NETWORK_ARCS1 (faded). - wifi_connecting_image_ = NetworkMenuIcon::GenerateConnectingImage( - NetworkMenuIcon::GetImage(NetworkMenuIcon::ARCS, 1, - NetworkMenuIcon::COLOR_DARK)); + wifi_connecting_bitmap_ = NetworkMenuIcon::GenerateConnectingBitmap( + NetworkMenuIcon::GetBitmap(NetworkMenuIcon::ARCS, 1, + NetworkMenuIcon::COLOR_DARK)); // 4G connected, strength = 50% = BARS4 icon + 4G badge. - wimax_connected_50_image_ = - NetworkMenuIcon::GenerateImageFromComponents( - NetworkMenuIcon::GetImage( + wimax_connected_50_bitmap_ = + NetworkMenuIcon::GenerateBitmapFromComponents( + NetworkMenuIcon::GetBitmap( NetworkMenuIcon::BARS, 3, NetworkMenuIcon::COLOR_DARK), - NULL, NULL, NULL, rb_.GetImageSkiaNamed(IDR_STATUSBAR_NETWORK_4G)); + NULL, NULL, NULL, rb_.GetBitmapNamed(IDR_STATUSBAR_NETWORK_4G)); // 3G connected, strength = 100% = BARS4 icon + 3G badge. - cellular_connected_100_image_ = - NetworkMenuIcon::GenerateImageFromComponents( - NetworkMenuIcon::GetImage( + cellular_connected_100_bitmap_ = + NetworkMenuIcon::GenerateBitmapFromComponents( + NetworkMenuIcon::GetBitmap( NetworkMenuIcon::BARS, - NetworkMenuIcon::NumImages(NetworkMenuIcon::BARS) - 1, + NetworkMenuIcon::NumBitmaps(NetworkMenuIcon::BARS) - 1, NetworkMenuIcon::COLOR_DARK), - NULL, NULL, NULL, rb_.GetImageSkiaNamed(IDR_STATUSBAR_NETWORK_3G)); + NULL, NULL, NULL, rb_.GetBitmapNamed(IDR_STATUSBAR_NETWORK_3G)); // 3G connected, strength = 50%, roaming = BARS2 icon + roaming & 3G badges. - cellular_roaming_50_image_ = NetworkMenuIcon::GenerateImageFromComponents( - NetworkMenuIcon::GetImage(NetworkMenuIcon::BARS, 3, - NetworkMenuIcon::COLOR_DARK), - rb_.GetImageSkiaNamed(IDR_STATUSBAR_NETWORK_ROAMING), NULL, - NULL, rb_.GetImageSkiaNamed(IDR_STATUSBAR_NETWORK_3G)); + cellular_roaming_50_bitmap_ = NetworkMenuIcon::GenerateBitmapFromComponents( + NetworkMenuIcon::GetBitmap(NetworkMenuIcon::BARS, 3, + NetworkMenuIcon::COLOR_DARK), + rb_.GetBitmapNamed(IDR_STATUSBAR_NETWORK_ROAMING), NULL, + NULL, rb_.GetBitmapNamed(IDR_STATUSBAR_NETWORK_3G)); // 3G disconnected (strength = 0%) = BARS0 icon + 3G badge. - cellular_disconnected_image_ = - NetworkMenuIcon::GenerateImageFromComponents( - NetworkMenuIcon::GetImage(NetworkMenuIcon::BARS, 0, - NetworkMenuIcon::COLOR_DARK), - NULL, NULL, NULL, rb_.GetImageSkiaNamed(IDR_STATUSBAR_NETWORK_3G)); + cellular_disconnected_bitmap_ = + NetworkMenuIcon::GenerateBitmapFromComponents( + NetworkMenuIcon::GetBitmap(NetworkMenuIcon::BARS, 0, + NetworkMenuIcon::COLOR_DARK), + NULL, NULL, NULL, rb_.GetBitmapNamed(IDR_STATUSBAR_NETWORK_3G)); // 3G connecting = IDR_STATUSBAR_NETWORK_BARS1 (faded). - cellular_connecting_image_ = NetworkMenuIcon::GenerateConnectingImage( - NetworkMenuIcon::GetImage(NetworkMenuIcon::BARS, 1, - NetworkMenuIcon::COLOR_DARK)); + cellular_connecting_bitmap_ = NetworkMenuIcon::GenerateConnectingBitmap( + NetworkMenuIcon::GetBitmap(NetworkMenuIcon::BARS, 1, + NetworkMenuIcon::COLOR_DARK)); } virtual void TearDown() OVERRIDE { @@ -176,19 +167,19 @@ class NetworkMenuIconTest : public testing::Test { test_network.SetRoamingState(roaming); } - bool CompareImages(const gfx::ImageSkia& icon, const gfx::ImageSkia& base) { - if (CompareTwoImages(icon, base, 1)) + bool CompareBitmaps(const SkBitmap& icon, const SkBitmap& base) { + if (CompareTwoBitmaps(icon, base, 1)) return true; - EXPECT_FALSE(CompareTwoImages(icon, ethernet_connected_image_, 2)); - EXPECT_FALSE(CompareTwoImages(icon, ethernet_disconnected_image_, 2)); - EXPECT_FALSE(CompareTwoImages(icon, wifi_connected_100_image_, 2)); - EXPECT_FALSE(CompareTwoImages(icon, wifi_encrypted_50_image_, 2)); - EXPECT_FALSE(CompareTwoImages(icon, wifi_disconnected_image_, 2)); - EXPECT_FALSE(CompareTwoImages(icon, wifi_connecting_image_, 2)); - EXPECT_FALSE(CompareTwoImages(icon, cellular_connected_100_image_, 2)); - EXPECT_FALSE(CompareTwoImages(icon, cellular_roaming_50_image_, 2)); - EXPECT_FALSE(CompareTwoImages(icon, cellular_disconnected_image_, 2)); - EXPECT_FALSE(CompareTwoImages(icon, cellular_connecting_image_, 2)); + EXPECT_FALSE(CompareTwoBitmaps(icon, ethernet_connected_bitmap_, 2)); + EXPECT_FALSE(CompareTwoBitmaps(icon, ethernet_disconnected_bitmap_, 2)); + EXPECT_FALSE(CompareTwoBitmaps(icon, wifi_connected_100_bitmap_, 2)); + EXPECT_FALSE(CompareTwoBitmaps(icon, wifi_encrypted_50_bitmap_, 2)); + EXPECT_FALSE(CompareTwoBitmaps(icon, wifi_disconnected_bitmap_, 2)); + EXPECT_FALSE(CompareTwoBitmaps(icon, wifi_connecting_bitmap_, 2)); + EXPECT_FALSE(CompareTwoBitmaps(icon, cellular_connected_100_bitmap_, 2)); + EXPECT_FALSE(CompareTwoBitmaps(icon, cellular_roaming_50_bitmap_, 2)); + EXPECT_FALSE(CompareTwoBitmaps(icon, cellular_disconnected_bitmap_, 2)); + EXPECT_FALSE(CompareTwoBitmaps(icon, cellular_connecting_bitmap_, 2)); return false; } @@ -196,17 +187,17 @@ class NetworkMenuIconTest : public testing::Test { ScopedStubCrosEnabler cros_stub_; NetworkLibrary* cros_; ResourceBundle& rb_; - gfx::ImageSkia ethernet_connected_image_; - gfx::ImageSkia ethernet_disconnected_image_; - gfx::ImageSkia wifi_connected_100_image_; - gfx::ImageSkia wifi_encrypted_50_image_; - gfx::ImageSkia wifi_disconnected_image_; - gfx::ImageSkia wifi_connecting_image_; - gfx::ImageSkia wimax_connected_50_image_; - gfx::ImageSkia cellular_connected_100_image_; - gfx::ImageSkia cellular_roaming_50_image_; - gfx::ImageSkia cellular_disconnected_image_; - gfx::ImageSkia cellular_connecting_image_; + SkBitmap ethernet_connected_bitmap_; + SkBitmap ethernet_disconnected_bitmap_; + SkBitmap wifi_connected_100_bitmap_; + SkBitmap wifi_encrypted_50_bitmap_; + SkBitmap wifi_disconnected_bitmap_; + SkBitmap wifi_connecting_bitmap_; + SkBitmap wimax_connected_50_bitmap_; + SkBitmap cellular_connected_100_bitmap_; + SkBitmap cellular_roaming_50_bitmap_; + SkBitmap cellular_disconnected_bitmap_; + SkBitmap cellular_connecting_bitmap_; }; // Compare icon cache results against expected results fron SetUp(). @@ -214,35 +205,35 @@ TEST_F(NetworkMenuIconTest, EthernetIcon) { Network* network = cros_->FindNetworkByPath("eth1"); ASSERT_NE(static_cast<const Network*>(NULL), network); SetConnected(network, true); - gfx::ImageSkia icon = NetworkMenuIcon::GetImage(network, - NetworkMenuIcon::COLOR_DARK); - EXPECT_TRUE(CompareImages(icon, ethernet_connected_image_)); + SkBitmap icon = NetworkMenuIcon::GetBitmap(network, + NetworkMenuIcon::COLOR_DARK); + EXPECT_TRUE(CompareBitmaps(icon, ethernet_connected_bitmap_)); SetConnected(network, false); - icon = NetworkMenuIcon::GetImage(network, - NetworkMenuIcon::COLOR_DARK); - EXPECT_TRUE(CompareImages(icon, ethernet_disconnected_image_)); + icon = NetworkMenuIcon::GetBitmap(network, + NetworkMenuIcon::COLOR_DARK); + EXPECT_TRUE(CompareBitmaps(icon, ethernet_disconnected_bitmap_)); } TEST_F(NetworkMenuIconTest, WifiIcon) { WifiNetwork* network = cros_->FindWifiNetworkByPath("wifi1"); ASSERT_NE(static_cast<const Network*>(NULL), network); - gfx::ImageSkia icon = NetworkMenuIcon::GetImage(network, - NetworkMenuIcon::COLOR_DARK); - EXPECT_TRUE(CompareImages(icon, wifi_connected_100_image_)); + SkBitmap icon = NetworkMenuIcon::GetBitmap(network, + NetworkMenuIcon::COLOR_DARK); + EXPECT_TRUE(CompareBitmaps(icon, wifi_connected_100_bitmap_)); SetStrength(network, 50); SetEncryption(network, SECURITY_RSN); - icon = NetworkMenuIcon::GetImage(network, - NetworkMenuIcon::COLOR_DARK); - EXPECT_TRUE(CompareImages(icon, wifi_encrypted_50_image_)); + icon = NetworkMenuIcon::GetBitmap(network, + NetworkMenuIcon::COLOR_DARK); + EXPECT_TRUE(CompareBitmaps(icon, wifi_encrypted_50_bitmap_)); SetConnected(network, false); SetStrength(network, 0); SetEncryption(network, SECURITY_NONE); - icon = NetworkMenuIcon::GetImage(network, - NetworkMenuIcon::COLOR_DARK); - EXPECT_TRUE(CompareImages(icon, wifi_disconnected_image_)); + icon = NetworkMenuIcon::GetBitmap(network, + NetworkMenuIcon::COLOR_DARK); + EXPECT_TRUE(CompareBitmaps(icon, wifi_disconnected_bitmap_)); } TEST_F(NetworkMenuIconTest, CellularIcon) { @@ -251,22 +242,22 @@ TEST_F(NetworkMenuIconTest, CellularIcon) { SetConnected(network, true); SetStrength(network, 100); SetRoamingState(network, ROAMING_STATE_HOME); - gfx::ImageSkia icon = NetworkMenuIcon::GetImage(network, - NetworkMenuIcon::COLOR_DARK); - EXPECT_TRUE(CompareImages(icon, cellular_connected_100_image_)); + SkBitmap icon = NetworkMenuIcon::GetBitmap(network, + NetworkMenuIcon::COLOR_DARK); + EXPECT_TRUE(CompareBitmaps(icon, cellular_connected_100_bitmap_)); SetStrength(network, 50); SetRoamingState(network, ROAMING_STATE_ROAMING); - icon = NetworkMenuIcon::GetImage(network, - NetworkMenuIcon::COLOR_DARK); - EXPECT_TRUE(CompareImages(icon, cellular_roaming_50_image_)); + icon = NetworkMenuIcon::GetBitmap(network, + NetworkMenuIcon::COLOR_DARK); + EXPECT_TRUE(CompareBitmaps(icon, cellular_roaming_50_bitmap_)); SetConnected(network, false); SetStrength(network, 0); SetRoamingState(network, ROAMING_STATE_HOME); - icon = NetworkMenuIcon::GetImage(network, - NetworkMenuIcon::COLOR_DARK); - EXPECT_TRUE(CompareImages(icon, cellular_disconnected_image_)); + icon = NetworkMenuIcon::GetBitmap(network, + NetworkMenuIcon::COLOR_DARK); + EXPECT_TRUE(CompareBitmaps(icon, cellular_disconnected_bitmap_)); } namespace { @@ -311,7 +302,7 @@ class TestNetworkMenuIcon : public NetworkMenuIcon { TEST_F(NetworkMenuIconTest, StatusIconMenuMode) { TestNetworkMenuIcon menu_icon(NetworkMenuIcon::MENU_MODE); - gfx::ImageSkia icon; + SkBitmap icon; // Set cellular1 to connecting. CellularNetwork* cellular1 = cros_->FindCellularNetworkByPath("cellular1"); @@ -321,12 +312,12 @@ TEST_F(NetworkMenuIconTest, StatusIconMenuMode) { // For MENU_MODE, we always display the connecting icon (cellular1). icon = menu_icon.GetIconAndText(NULL); - EXPECT_TRUE(CompareImages(icon, cellular_connecting_image_)); + EXPECT_TRUE(CompareBitmaps(icon, cellular_connecting_bitmap_)); // Set cellular1 to connected; ethernet icon should be shown. SetConnected(cellular1, true); icon = menu_icon.GetIconAndText(NULL); - EXPECT_TRUE(CompareImages(icon, ethernet_connected_image_)); + EXPECT_TRUE(CompareBitmaps(icon, ethernet_connected_bitmap_)); // Set ethernet to inactive/disconnected; wifi icon should be shown. Network* eth1 = cros_->FindNetworkByPath("eth1"); @@ -334,12 +325,12 @@ TEST_F(NetworkMenuIconTest, StatusIconMenuMode) { SetActive(eth1, false); SetConnected(eth1, false); icon = menu_icon.GetIconAndText(NULL); - EXPECT_TRUE(CompareImages(icon, wifi_connected_100_image_)); + EXPECT_TRUE(CompareBitmaps(icon, wifi_connected_100_bitmap_)); } TEST_F(NetworkMenuIconTest, StatusIconDropdownMode) { TestNetworkMenuIcon menu_icon(NetworkMenuIcon::DROPDOWN_MODE); - gfx::ImageSkia icon; + SkBitmap icon; // Set wifi1 to connecting. WifiNetwork* wifi1 = cros_->FindWifiNetworkByPath("wifi1"); @@ -348,7 +339,7 @@ TEST_F(NetworkMenuIconTest, StatusIconDropdownMode) { // For DROPDOWN_MODE, we prioritize the connected network (ethernet). icon = menu_icon.GetIconAndText(NULL); - EXPECT_TRUE(CompareImages(icon, ethernet_connected_image_)); + EXPECT_TRUE(CompareBitmaps(icon, ethernet_connected_bitmap_)); // Set ethernet to inactive/disconnected. Network* ethernet = cros_->FindNetworkByPath("eth1"); @@ -358,19 +349,19 @@ TEST_F(NetworkMenuIconTest, StatusIconDropdownMode) { // Icon should now be cellular connected icon. icon = menu_icon.GetIconAndText(NULL); - EXPECT_TRUE(CompareImages(icon, cellular_connected_100_image_)); + EXPECT_TRUE(CompareBitmaps(icon, cellular_connected_100_bitmap_)); // Set cellular1 to disconnected; Icon should now be wimax icon. CellularNetwork* cellular1 = cros_->FindCellularNetworkByPath("cellular1"); ASSERT_NE(static_cast<const Network*>(NULL), cellular1); SetConnected(cellular1, false); icon = menu_icon.GetIconAndText(NULL); - EXPECT_TRUE(CompareImages(icon, wimax_connected_50_image_)); + EXPECT_TRUE(CompareBitmaps(icon, wimax_connected_50_bitmap_)); // Set wifi1 to connected. Icon should now be wifi connected icon. SetConnected(wifi1, true); icon = menu_icon.GetIconAndText(NULL); - EXPECT_TRUE(CompareImages(icon, wifi_connected_100_image_)); + EXPECT_TRUE(CompareBitmaps(icon, wifi_connected_100_bitmap_)); } } // namespace chromeos diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc index 966989d..48fbb57 100644 --- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc +++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc @@ -90,7 +90,7 @@ ash::NetworkIconInfo CreateNetworkIconInfo(const Network* network, NetworkMenu* network_menu) { ash::NetworkIconInfo info; info.name = UTF8ToUTF16(network->name()); - info.image = network_icon->GetImage(network, NetworkMenuIcon::COLOR_DARK); + info.image = network_icon->GetBitmap(network, NetworkMenuIcon::COLOR_DARK); info.service_path = network->service_path(); info.highlight = network_menu->ShouldHighlightNetwork(network); info.tray_icon_visible = ShouldShowNetworkIconInTray(network); @@ -244,7 +244,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, return UserManager::Get()->GetLoggedInUser().display_email(); } - virtual const gfx::ImageSkia& GetUserImage() const OVERRIDE { + virtual const SkBitmap& GetUserImage() const OVERRIDE { return UserManager::Get()->GetLoggedInUser().image(); } diff --git a/chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.cc b/chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.cc index 7ca70d3..086d2eb 100644 --- a/chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.cc +++ b/chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.cc @@ -256,8 +256,8 @@ void BrowserNonClientFrameViewAsh::OnPaint(gfx::Canvas* canvas) { canvas, ShouldPaintAsActive() ? ash::FramePainter::ACTIVE : ash::FramePainter::INACTIVE, - GetThemeFrameImageId(), - GetThemeFrameOverlayImage()); + GetThemeFrameBitmapId(), + GetThemeFrameOverlayBitmap()); if (browser_view()->ShouldShowWindowTitle()) frame_painter_->PaintTitleBar(this, canvas, BrowserFrame::GetTitleFont()); if (browser_view()->IsToolbarVisible()) @@ -344,7 +344,7 @@ bool BrowserNonClientFrameViewAsh::ShouldTabIconViewAnimate() const { gfx::ImageSkia BrowserNonClientFrameViewAsh::GetFaviconForTabIconView() { views::WidgetDelegate* delegate = frame()->widget_delegate(); if (!delegate) - return gfx::ImageSkia(); + return SkBitmap(); return delegate->GetWindowIcon(); } @@ -395,7 +395,7 @@ bool BrowserNonClientFrameViewAsh::UseShortHeader() const { void BrowserNonClientFrameViewAsh::LayoutAvatar() { DCHECK(avatar_button()); - gfx::ImageSkia incognito_icon = browser_view()->GetOTRAvatarIcon(); + SkBitmap incognito_icon = browser_view()->GetOTRAvatarIcon(); int avatar_bottom = GetHorizontalTabStripVerticalOffset(false) + browser_view()->GetTabStripHeight() - kAvatarBottomSpacing; @@ -441,7 +441,7 @@ void BrowserNonClientFrameViewAsh::PaintToolbarBackground( // source y position. If you have to debug this code use an image editor // to paint a diagonal line through the toolbar image and ensure it lines up // across the tab and toolbar. - gfx::ImageSkia* theme_toolbar = tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR); + SkBitmap* theme_toolbar = tp->GetBitmapNamed(IDR_THEME_TOOLBAR); canvas->TileImageInt( *theme_toolbar, x, bottom_y - GetHorizontalTabStripVerticalOffset(false), @@ -451,22 +451,21 @@ void BrowserNonClientFrameViewAsh::PaintToolbarBackground( // The content area line has a shadow that extends a couple of pixels above // the toolbar bounds. const int kContentShadowHeight = 2; - gfx::ImageSkia* toolbar_top = - tp->GetImageSkiaNamed(IDR_TOOLBAR_SHADE_TOP); + SkBitmap* toolbar_top = + tp->GetBitmapNamed(IDR_TOOLBAR_SHADE_TOP); canvas->TileImageInt(*toolbar_top, 0, 0, x, y - kContentShadowHeight, w, split_point + kContentShadowHeight + 1); // Draw the "lightening" shade line around the edges of the toolbar. - gfx::ImageSkia* toolbar_left = tp->GetImageSkiaNamed(IDR_TOOLBAR_SHADE_LEFT); + SkBitmap* toolbar_left = tp->GetBitmapNamed(IDR_TOOLBAR_SHADE_LEFT); canvas->TileImageInt(*toolbar_left, 0, 0, x + kClientEdgeThickness, y + kClientEdgeThickness + kContentShadowHeight, toolbar_left->width(), theme_toolbar->height()); - gfx::ImageSkia* toolbar_right = - tp->GetImageSkiaNamed(IDR_TOOLBAR_SHADE_RIGHT); + SkBitmap* toolbar_right = tp->GetBitmapNamed(IDR_TOOLBAR_SHADE_RIGHT); canvas->TileImageInt(*toolbar_right, 0, 0, w - toolbar_right->width() - 2 * kClientEdgeThickness, @@ -487,7 +486,7 @@ void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { ThemeService::GetDefaultColor(ThemeService::COLOR_TOOLBAR_SEPARATOR)); } -int BrowserNonClientFrameViewAsh::GetThemeFrameImageId() const { +int BrowserNonClientFrameViewAsh::GetThemeFrameBitmapId() const { bool is_incognito = browser_view()->IsOffTheRecord(); if (browser_view()->IsBrowserTypeNormal()) { // Use the standard resource ids to allow users to theme the frames. @@ -509,13 +508,13 @@ int BrowserNonClientFrameViewAsh::GetThemeFrameImageId() const { IDR_AURA_WINDOW_HEADER_BASE_INACTIVE; } -const gfx::ImageSkia* -BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImage() const { +const SkBitmap* +BrowserNonClientFrameViewAsh::GetThemeFrameOverlayBitmap() const { ui::ThemeProvider* tp = GetThemeProvider(); if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && browser_view()->IsBrowserTypeNormal() && !browser_view()->IsOffTheRecord()) { - return tp->GetImageSkiaNamed(ShouldPaintAsActive() ? + return tp->GetBitmapNamed(ShouldPaintAsActive() ? IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE); } return NULL; diff --git a/chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.h b/chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.h index e9318b0..d2a9e7f 100644 --- a/chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.h +++ b/chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.h @@ -81,10 +81,10 @@ class BrowserNonClientFrameViewAsh : public BrowserNonClientFrameView, // above the content area. void PaintContentEdge(gfx::Canvas* canvas); - // Returns the correct image id for the frame header based on activation + // Returns the correct bitmap id for the frame header based on activation // state and incognito mode. - int GetThemeFrameImageId() const; - const gfx::ImageSkia* GetThemeFrameOverlayImage() const; + int GetThemeFrameBitmapId() const; + const SkBitmap* GetThemeFrameOverlayBitmap() const; // Window controls. The |size_button_| either toggles maximized or toggles // minimized. The exact behavior is determined by |size_button_minimizes_|. diff --git a/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc b/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc index 36cd990..cad8a9b 100644 --- a/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc +++ b/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc @@ -149,10 +149,10 @@ void NetworkDropdown::NetworkMenuIconChanged() { void NetworkDropdown::SetNetworkIconAndText() { string16 text; - const gfx::ImageSkia icon_image = network_icon_->GetIconAndText(&text); + const SkBitmap icon_bitmap = network_icon_->GetIconAndText(&text); std::string icon_str = - icon_image.empty() ? - std::string() : web_ui_util::GetImageDataUrl(icon_image); + icon_bitmap.empty() ? + std::string() : web_ui_util::GetImageDataUrl(icon_bitmap); base::StringValue title(text); base::StringValue icon(icon_str); web_ui_->CallJavascriptFunction("cr.ui.DropDown.updateNetworkTitle", diff --git a/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc index f7f4fc0..6da2ad4 100644 --- a/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc @@ -151,7 +151,7 @@ void UserImageScreenHandler::RegisterMessages() { base::Unretained(this))); } -void UserImageScreenHandler::AddProfileImage(const gfx::ImageSkia& image) { +void UserImageScreenHandler::AddProfileImage(const SkBitmap& image) { profile_picture_data_url_ = web_ui_util::GetImageDataUrl(image); SendProfileImage(profile_picture_data_url_); } @@ -173,7 +173,7 @@ void UserImageScreenHandler::OnProfileImageAbsent() { } } -void UserImageScreenHandler::OnPhotoAccepted(const gfx::ImageSkia& photo) { +void UserImageScreenHandler::OnPhotoAccepted(const SkBitmap& photo) { user_photo_ = photo; user_photo_data_url_ = web_ui_util::GetImageDataUrl(user_photo_); selected_image_ = User::kExternalImageIndex; diff --git a/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h index 5392c77..c8035f5 100644 --- a/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h @@ -12,7 +12,6 @@ #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" #include "third_party/skia/include/core/SkBitmap.h" -#include "ui/gfx/image/image_skia.h" #include "ui/gfx/native_widget_types.h" namespace base { @@ -47,14 +46,14 @@ class UserImageScreenHandler : public UserImageScreenActor, virtual void ShowCameraInitializing() OVERRIDE; virtual void CheckCameraPresence() OVERRIDE; virtual bool IsCapturing() const OVERRIDE; - virtual void AddProfileImage(const gfx::ImageSkia& image) OVERRIDE; + virtual void AddProfileImage(const SkBitmap& image) OVERRIDE; virtual void OnProfileImageAbsent() OVERRIDE; // WebUIMessageHandler implementation: virtual void RegisterMessages() OVERRIDE; // TakePhotoDialog::Delegate implementation. - virtual void OnPhotoAccepted(const gfx::ImageSkia& photo) OVERRIDE; + virtual void OnPhotoAccepted(const SkBitmap& photo) OVERRIDE; private: // Sends profile image as a data URL to the page. @@ -84,7 +83,7 @@ class UserImageScreenHandler : public UserImageScreenActor, int selected_image_; // Last user photo, if taken. - gfx::ImageSkia user_photo_; + SkBitmap user_photo_; // Data URL for |user_photo_|. std::string user_photo_data_url_; diff --git a/chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.cc index 5c79430..f2fa95e 100644 --- a/chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.cc +++ b/chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.cc @@ -27,6 +27,7 @@ #include "content/public/common/url_constants.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/views/widget/widget.h" @@ -216,7 +217,7 @@ void ChangePictureOptionsHandler::SendSelectedImage() { } } -void ChangePictureOptionsHandler::SendProfileImage(const gfx::ImageSkia& image, +void ChangePictureOptionsHandler::SendProfileImage(const SkBitmap& image, bool should_select) { base::StringValue data_url(web_ui_util::GetImageDataUrl(image)); base::FundamentalValue select(should_select); @@ -300,7 +301,7 @@ void ChangePictureOptionsHandler::FileSelected(const FilePath& path, kHistogramImagesCount); } -void ChangePictureOptionsHandler::OnPhotoAccepted(const gfx::ImageSkia& photo) { +void ChangePictureOptionsHandler::OnPhotoAccepted(const SkBitmap& photo) { UserManager* user_manager = UserManager::Get(); user_manager->SaveUserImage(user_manager->GetLoggedInUser().email(), photo); UMA_HISTOGRAM_ENUMERATION("UserImage.ChangeChoice", @@ -332,8 +333,7 @@ void ChangePictureOptionsHandler::Observe( OptionsPageUIHandler::Observe(type, source, details); if (type == chrome::NOTIFICATION_PROFILE_IMAGE_UPDATED) { // User profile image has been updated. - SendProfileImage(*content::Details<const gfx::ImageSkia>(details).ptr(), - false); + SendProfileImage(*content::Details<const SkBitmap>(details).ptr(), false); } } diff --git a/chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.h b/chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.h index 14561a0..7c40516 100644 --- a/chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.h +++ b/chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.h @@ -10,7 +10,6 @@ #include "chrome/browser/ui/select_file_dialog.h" #include "chrome/browser/ui/webui/options2/options_ui2.h" #include "content/public/browser/notification_registrar.h" -#include "ui/gfx/image/image_skia.h" #include "ui/gfx/native_widget_types.h" namespace base { @@ -45,7 +44,7 @@ class ChangePictureOptionsHandler : public ::options2::OptionsPageUIHandler, // Sends the profile image to the page. If |should_select| is true then // the profile image element is selected. - void SendProfileImage(const gfx::ImageSkia& image, bool should_select); + void SendProfileImage(const SkBitmap& image, bool should_select); // Starts profile image update and shows the last downloaded profile image, // if any, on the page. Shouldn't be called before |SendProfileImage|. @@ -81,7 +80,7 @@ class ChangePictureOptionsHandler : public ::options2::OptionsPageUIHandler, int index, void* params) OVERRIDE; // TakePhotoDialog::Delegate implementation. - virtual void OnPhotoAccepted(const gfx::ImageSkia& photo) OVERRIDE; + virtual void OnPhotoAccepted(const SkBitmap& photo) OVERRIDE; // content::NotificationObserver implementation. virtual void Observe(int type, @@ -97,7 +96,7 @@ class ChangePictureOptionsHandler : public ::options2::OptionsPageUIHandler, scoped_refptr<SelectFileDialog> select_file_dialog_; // Previous user image from camera/file and its data URL. - gfx::ImageSkia previous_image_; + SkBitmap previous_image_; std::string previous_image_data_url_; // Index of the previous user image. diff --git a/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc index a74f299..60755e4 100644 --- a/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc +++ b/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc @@ -52,9 +52,9 @@ #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "grit/theme_resources.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" -#include "ui/gfx/image/image_skia.h" #include "ui/views/widget/widget.h" namespace { @@ -98,7 +98,7 @@ class NetworkInfoDictionary { void set_service_path(const std::string& service_path) { service_path_ = service_path; } - void set_icon(const gfx::ImageSkia& icon) { + void set_icon(const SkBitmap& icon) { icon_url_ = icon.isNull() ? "" : web_ui_util::GetImageDataUrl(icon); } void set_name(const std::string& name) { @@ -167,7 +167,7 @@ NetworkInfoDictionary::NetworkInfoDictionary() { NetworkInfoDictionary::NetworkInfoDictionary(const chromeos::Network* network) { set_service_path(network->service_path()); - set_icon(chromeos::NetworkMenuIcon::GetImage(network, + set_icon(chromeos::NetworkMenuIcon::GetBitmap(network, chromeos::NetworkMenuIcon::COLOR_DARK)); set_name(network->name()); set_connecting(network->connecting()); @@ -184,7 +184,7 @@ NetworkInfoDictionary::NetworkInfoDictionary( const chromeos::Network* network, const chromeos::Network* remembered) { set_service_path(remembered->service_path()); - set_icon(chromeos::NetworkMenuIcon::GetImage( + set_icon(chromeos::NetworkMenuIcon::GetBitmap( network ? network : remembered, chromeos::NetworkMenuIcon::COLOR_DARK)); set_name(remembered->name()); set_connecting(network ? network->connecting() : false); @@ -1351,7 +1351,7 @@ ListValue* InternetOptionsHandler::GetWirelessList() { NetworkInfoDictionary network_dict; network_dict.set_service_path(kOtherNetworksFakePath); network_dict.set_icon( - chromeos::NetworkMenuIcon::GetDisconnectedImage( + chromeos::NetworkMenuIcon::GetDisconnectedBitmap( chromeos::NetworkMenuIcon::BARS, chromeos::NetworkMenuIcon::COLOR_DARK)); network_dict.set_name( diff --git a/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h b/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h index 60b46da..3dd15af 100644 --- a/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h +++ b/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h @@ -15,10 +15,7 @@ #include "ui/gfx/native_widget_types.h" class Browser; - -namespace gfx { -class ImageSkia; -} +class SkBitmap; namespace views { class WidgetDelegate; diff --git a/chrome/browser/ui/webui/options2/chromeos/user_image_source2.cc b/chrome/browser/ui/webui/options2/chromeos/user_image_source2.cc index 67deb51..03d929b 100644 --- a/chrome/browser/ui/webui/options2/chromeos/user_image_source2.cc +++ b/chrome/browser/ui/webui/options2/chromeos/user_image_source2.cc @@ -24,7 +24,7 @@ std::vector<unsigned char> UserImageSource::GetUserImage( return user_image; } gfx::PNGCodec::EncodeBGRASkBitmap( - *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + *ResourceBundle::GetSharedInstance().GetBitmapNamed( IDR_LOGIN_DEFAULT_USER), false, &user_image); diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc index 859204f..b5abf12c 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc @@ -5,7 +5,7 @@ #include "content/public/browser/content_browser_client.h" #include "base/file_path.h" -#include "ui/gfx/image/image_skia.h" +#include "third_party/skia/include/core/SkBitmap.h" namespace content { @@ -78,8 +78,8 @@ std::string ContentBrowserClient::GetAcceptLangs(BrowserContext* context) { return std::string(); } -gfx::ImageSkia* ContentBrowserClient::GetDefaultFavicon() { - static gfx::ImageSkia* empty = new gfx::ImageSkia(); +SkBitmap* ContentBrowserClient::GetDefaultFavicon() { + static SkBitmap* empty = new SkBitmap(); return empty; } diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index 54569e7..fcf53c7 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -21,6 +21,7 @@ class FilePath; class GURL; class PluginProcessHost; class ResourceDispatcherHost; +class SkBitmap; namespace webkit_glue { struct WebPreferences; @@ -30,10 +31,6 @@ namespace crypto { class CryptoModuleBlockingPasswordDelegate; } -namespace gfx { -class ImageSkia; -} - namespace net { class CookieList; class CookieOptions; @@ -177,7 +174,7 @@ class CONTENT_EXPORT ContentBrowserClient { virtual std::string GetAcceptLangs(BrowserContext* context); // Returns the default favicon. The callee doesn't own the given bitmap. - virtual gfx::ImageSkia* GetDefaultFavicon(); + virtual SkBitmap* GetDefaultFavicon(); // Allow the embedder to control if an AppCache can be used for the given url. // This is called on the IO thread. diff --git a/content/public/browser/favicon_status.cc b/content/public/browser/favicon_status.cc index c9da916..2ab0e8a 100644 --- a/content/public/browser/favicon_status.cc +++ b/content/public/browser/favicon_status.cc @@ -5,12 +5,11 @@ #include "content/public/browser/favicon_status.h" #include "content/public/browser/content_browser_client.h" -#include "ui/gfx/image/image_skia.h" namespace content { FaviconStatus::FaviconStatus() : valid(false) { - bitmap = *GetContentClient()->browser()->GetDefaultFavicon()->bitmap(); + bitmap = *GetContentClient()->browser()->GetDefaultFavicon(); } } // namespace content diff --git a/content/shell/shell_content_browser_client.cc b/content/shell/shell_content_browser_client.cc index dca4df0..530fa4a 100644 --- a/content/shell/shell_content_browser_client.cc +++ b/content/shell/shell_content_browser_client.cc @@ -14,6 +14,7 @@ #include "content/shell/shell_resource_dispatcher_host_delegate.h" #include "content/shell/shell_switches.h" #include "googleurl/src/gurl.h" +#include "third_party/skia/include/core/SkBitmap.h" namespace content { diff --git a/ui/views/examples/content_client/examples_content_browser_client.cc b/ui/views/examples/content_client/examples_content_browser_client.cc index 0c1f738..fac0d07 100644 --- a/ui/views/examples/content_client/examples_content_browser_client.cc +++ b/ui/views/examples/content_client/examples_content_browser_client.cc @@ -13,6 +13,7 @@ #include "content/shell/shell_resource_dispatcher_host_delegate.h" #include "content/shell/shell_switches.h" #include "googleurl/src/gurl.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "ui/views/examples/content_client/examples_browser_main_parts.h" namespace views { |