diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-31 13:28:21 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-31 13:28:21 +0000 |
commit | 2eb6b89474c70bf69590fe07ab57bd95ca407b69 (patch) | |
tree | d6742fb05829eae0800976fef4d668977ef25f02 /ash | |
parent | 7afa6f3a5c5a13fda9e96b65dee2c08071af0c05 (diff) | |
download | chromium_src-2eb6b89474c70bf69590fe07ab57bd95ca407b69.zip chromium_src-2eb6b89474c70bf69590fe07ab57bd95ca407b69.tar.gz chromium_src-2eb6b89474c70bf69590fe07ab57bd95ca407b69.tar.bz2 |
Revert 139776 - Convert ash and chromeos parts of chrome/ to ImageSkia
Used same conversion script as 10437006
Changed by hand afterwards:
1 ash/shell/app_list.cc
2 ash/shell/content_client/shell_content_browser_client.h
3 ash/shell/window_watcher.cc
4 ash/system/tray/tray_views.h
5 ash/system/user/tray_user.cc
6 ash/test/test_launcher_delegate.cc
7 ash/wm/frame_painter.cc
8 ash/wm/image_grid_unittest.cc
9 chrome/browser/chrome_content_browser_client.cc
10 chrome/browser/chrome_content_browser_client.h
11 chrome/browser/chromeos/extensions/file_manager_util.cc
12 chrome/browser/chromeos/login/message_bubble.h
13 chrome/browser/chromeos/login/take_photo_view.cc
14 chrome/browser/chromeos/login/take_photo_view.h
15 chrome/browser/chromeos/login/user.h
16 chrome/browser/chromeos/login/user_image_screen.cc
17 chrome/browser/chromeos/login/user_image_screen_actor.h
18 chrome/browser/chromeos/login/webui_login_view.cc
19 chrome/browser/chromeos/options/take_photo_dialog.cc
20 chrome/browser/chromeos/status/data_promo_notification.cc
21 chrome/browser/chromeos/status/network_menu_icon.cc
22 chrome/browser/chromeos/status/network_menu_icon.h
23 chrome/browser/chromeos/status/network_menu_icon_unittest.cc
24 chrome/browser/debugger/devtools_window.cc
25 chrome/browser/favicon/favicon_handler.cc
26 chrome/browser/favicon/favicon_tab_helper.cc
27 chrome/browser/instant/instant_loader.cc
28 chrome/browser/ui/toolbar/back_forward_menu_model.cc
29 chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.cc
30 chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc
31 chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h
32 chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.cc
33 chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.h
34 chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h
35 chrome/browser/ui/webui/options2/chromeos/user_image_source2.cc
36 chrome/browser/ui/webui/options2/chromeos/wallpaper_thumbnail_source2.cc
37 content/browser/mock_content_browser_client.cc
38 content/browser/mock_content_browser_client.h
39 content/public/browser/content_browser_client.h
40 content/public/browser/favicon_status.cc
41 content/public/browser/favicon_status.h
42 content/shell/shell_content_browser_client.cc
43 content/shell/shell_content_browser_client.h
44 ui/views/examples/content_client/examples_content_browser_client.cc
45 ui/views/examples/content_client/examples_content_browser_client.h
Fixed headers and spacing
1 ash/desktop_background/desktop_background_controller.cc
2 ash/desktop_background/desktop_background_controller.h
3 ash/desktop_background/desktop_background_resources.cc
4 ash/desktop_background/desktop_background_resources.h
5 ash/shell.h
6 ash/shell_factory.h
7 ash/system/tray/system_tray_delegate.h
8 ash/wm/frame_painter.h
9 chrome/browser/chromeos/login/default_user_images.h
10 chrome/browser/chromeos/status/network_menu.cc
Test=Compiles
Bug=124566
Review URL: https://chromiumcodereview.appspot.com/10443062
TBR=pkotwicz@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10456054
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139778 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
26 files changed, 110 insertions, 116 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); }; |