diff options
94 files changed, 557 insertions, 511 deletions
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index e7a2330..df56b7d 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -79,7 +79,6 @@ #include "content/public/browser/web_contents.h" #include "content/public/common/process_type.h" #include "googleurl/src/gurl.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/codec/png_codec.h" #include "ui/gfx/rect.h" diff --git a/chrome/browser/automation/automation_provider_observers_chromeos.cc b/chrome/browser/automation/automation_provider_observers_chromeos.cc index 694ff05..3606436 100644 --- a/chrome/browser/automation/automation_provider_observers_chromeos.cc +++ b/chrome/browser/automation/automation_provider_observers_chromeos.cc @@ -489,7 +489,7 @@ void PhotoCaptureObserver::OnCapturingStopped( chromeos::TakePhotoDialog* take_photo_dialog, chromeos::TakePhotoView* take_photo_view) { take_photo_dialog->Accept(); - const SkBitmap& photo = take_photo_view->GetImage(); + const gfx::ImageSkia& photo = take_photo_view->GetImage(); chromeos::UserManager* user_manager = chromeos::UserManager::Get(); if (!user_manager) { if (automation_) { diff --git a/chrome/browser/background/background_application_list_model.cc b/chrome/browser/background/background_application_list_model.cc index 6965c6b..3501404 100644 --- a/chrome/browser/background/background_application_list_model.cc +++ b/chrome/browser/background/background_application_list_model.cc @@ -10,9 +10,9 @@ #include "base/stl_util.h" #include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" -#include "chrome/browser/background/background_mode_manager.h" #include "chrome/browser/background/background_contents_service.h" #include "chrome/browser/background/background_contents_service_factory.h" +#include "chrome/browser/background/background_mode_manager.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/extension_prefs.h" #include "chrome/browser/extensions/extension_service.h" @@ -26,6 +26,7 @@ #include "content/public/browser/notification_source.h" #include "ui/base/l10n/l10n_util_collator.h" #include "ui/gfx/image/image.h" +#include "ui/gfx/image/image_skia.h" using extensions::Extension; using extensions::ExtensionList; @@ -72,7 +73,7 @@ class BackgroundApplicationListModel::Application void RequestIcon(ExtensionIconSet::Icons size); const Extension* extension_; - scoped_ptr<SkBitmap> icon_; + scoped_ptr<gfx::ImageSkia> icon_; BackgroundApplicationListModel* model_; ImageLoadingTracker tracker_; }; @@ -146,7 +147,7 @@ void BackgroundApplicationListModel::Application::OnImageLoaded( int index) { if (image.IsEmpty()) return; - icon_.reset(image.CopySkBitmap()); + icon_.reset(image.CopyImageSkia()); model_->SendApplicationDataChangedNotifications(extension_); } @@ -240,7 +241,7 @@ BackgroundApplicationListModel::FindApplication( return (found == applications_.end()) ? NULL : found->second; } -const SkBitmap* BackgroundApplicationListModel::GetIcon( +const gfx::ImageSkia* BackgroundApplicationListModel::GetIcon( const Extension* extension) { const Application* application = FindApplication(extension); if (application) diff --git a/chrome/browser/background/background_application_list_model.h b/chrome/browser/background/background_application_list_model.h index c4f6a45..f38a767 100644 --- a/chrome/browser/background/background_application_list_model.h +++ b/chrome/browser/background/background_application_list_model.h @@ -17,6 +17,10 @@ class Profile; +namespace gfx { +class ImageSkia; +} + // Model for list of Background Applications associated with a Profile (i.e. // extensions with kBackgroundPermission set, or hosted apps with a // BackgroundContents). @@ -55,11 +59,11 @@ class BackgroundApplicationListModel : public content::NotificationObserver { // that there is no icon associated with the extension, or that a pending // task to retrieve the icon has not completed. See the Observer class above. // - // NOTE: The model manages the SkBitmap result, that is it "owns" the memory, + // NOTE: The model manages the ImageSkia result, that is it "owns" the memory, // releasing it if the associated background application is unloaded. // NOTE: All icons are currently sized as // ExtensionIconSet::EXTENSION_ICON_BITTY. - const SkBitmap* GetIcon(const extensions::Extension* extension); + const gfx::ImageSkia* GetIcon(const extensions::Extension* extension); // Return the position of |extension| within this list model. int GetPosition(const extensions::Extension* extension) const; diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc index 76d079d..e5c5314 100644 --- a/chrome/browser/background/background_mode_manager.cc +++ b/chrome/browser/background/background_mode_manager.cc @@ -117,7 +117,7 @@ void BackgroundModeManager::BackgroundModeData::BuildProfileMenu( applications_->begin(); cursor != applications_->end(); ++cursor, ++position) { - const SkBitmap* icon = applications_->GetIcon(*cursor); + const gfx::ImageSkia* icon = applications_->GetIcon(*cursor); DCHECK(position == applications_->GetPosition(*cursor)); const std::string& name = (*cursor)->name(); menu->AddItem(position, UTF8ToUTF16(name)); @@ -663,9 +663,9 @@ void BackgroundModeManager::CreateStatusTrayIcon() { // Set the image and add ourselves as a click observer on it. // TODO(rlp): Status tray icon should have submenus for each profile. - SkBitmap* bitmap = ResourceBundle::GetSharedInstance().GetBitmapNamed( - IDR_STATUS_TRAY_ICON); - status_icon_->SetImage(*bitmap); + gfx::ImageSkia* image_skia = ResourceBundle::GetSharedInstance(). + GetImageSkiaNamed(IDR_STATUS_TRAY_ICON); + status_icon_->SetImage(*image_skia); status_icon_->SetToolTip(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); UpdateStatusTrayIconContextMenu(); } diff --git a/chrome/browser/background/background_mode_manager_win.cc b/chrome/browser/background/background_mode_manager_win.cc index 33b79e2..6c4eabf 100644 --- a/chrome/browser/background/background_mode_manager_win.cc +++ b/chrome/browser/background/background_mode_manager_win.cc @@ -11,13 +11,13 @@ #include "base/utf_string_conversions.h" #include "base/win/registry.h" #include "chrome/browser/background/background_mode_manager.h" -#include "chrome/installer/util/auto_launch_util.h" #include "chrome/common/chrome_switches.h" +#include "chrome/installer/util/auto_launch_util.h" #include "content/public/browser/browser_thread.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/gfx/image/image_skia.h" using content::BrowserThread; @@ -38,7 +38,7 @@ void BackgroundModeManager::DisplayAppInstalledNotification( // a background app has been installed. CreateStatusTrayIcon(); status_icon_->DisplayBalloon( - SkBitmap(), + gfx::ImageSkia(), l10n_util::GetStringUTF16(IDS_BACKGROUND_APP_INSTALLED_BALLOON_TITLE), l10n_util::GetStringFUTF16( IDS_BACKGROUND_APP_INSTALLED_BALLOON_BODY, diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 3b48f9c..737ca17 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -392,7 +392,7 @@ Profile* CreateProfile(const content::MainFunctionParams& parameters, if (!parameters.ui_task && browser_shutdown::delete_resources_on_shutdown) { // Only delete the resources if we're not running tests. If we're running // tests the resources need to be reused as many places in the UI cache - // SkBitmaps from the ResourceBundle. + // ImageSkias from the ResourceBundle. ResourceBundle::CleanupSharedInstance(); } diff --git a/chrome/browser/chromeos/login/user_manager_impl.cc b/chrome/browser/chromeos/login/user_manager_impl.cc index 846790c..c242ef5 100644 --- a/chrome/browser/chromeos/login/user_manager_impl.cc +++ b/chrome/browser/chromeos/login/user_manager_impl.cc @@ -53,6 +53,7 @@ #include "skia/ext/image_operations.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/codec/png_codec.h" +#include "ui/gfx/image/image_skia.h" using content::BrowserThread; @@ -1282,7 +1283,7 @@ void UserManagerImpl::InitDownloadedProfileImage() { VLOG(1) << "Profile image initialized"; downloaded_profile_image_ = logged_in_user_->image(); downloaded_profile_image_data_url_ = - web_ui_util::GetImageDataUrl(downloaded_profile_image_); + web_ui_util::GetImageDataUrl(gfx::ImageSkia(downloaded_profile_image_)); } } @@ -1362,7 +1363,8 @@ void UserManagerImpl::OnDownloadComplete(ProfileDownloader* downloader, if (result == kDownloadSuccess) { // Check if this image is not the same as already downloaded. std::string new_image_data_url = - web_ui_util::GetImageDataUrl(downloader->GetProfilePicture()); + web_ui_util::GetImageDataUrl(gfx::ImageSkia( + downloader->GetProfilePicture())); if (!downloaded_profile_image_data_url_.empty() && new_image_data_url == downloaded_profile_image_data_url_) return; diff --git a/chrome/browser/custom_home_pages_table_model.h b/chrome/browser/custom_home_pages_table_model.h index 3af68d3..0e43f69 100644 --- a/chrome/browser/custom_home_pages_table_model.h +++ b/chrome/browser/custom_home_pages_table_model.h @@ -15,7 +15,6 @@ class GURL; class Profile; -class SkBitmap; namespace ui { class TableModelObserver; diff --git a/chrome/browser/download/download_extension_api.cc b/chrome/browser/download/download_extension_api.cc index a89332d..de5a5657 100644 --- a/chrome/browser/download/download_extension_api.cc +++ b/chrome/browser/download/download_extension_api.cc @@ -249,7 +249,7 @@ void DownloadFileIconExtractorImpl::OnIconLoadComplete( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); std::string url; if (icon) - url = web_ui_util::GetImageDataUrl(*icon->ToSkBitmap()); + url = web_ui_util::GetImageDataUrl(*icon->ToImageSkia()); callback_.Run(url); } diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index 4d2e3ca..1119df0 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -183,13 +183,13 @@ void GenerateFileNameFromRequest(const DownloadItem& download_item, // Download progress painting -------------------------------------------------- -// Common bitmaps used for download progress animations. We load them once the +// Common images used for download progress animations. We load them once the // first time we do a progress paint, then reuse them as they are always the // same. -SkBitmap* g_foreground_16 = NULL; -SkBitmap* g_background_16 = NULL; -SkBitmap* g_foreground_32 = NULL; -SkBitmap* g_background_32 = NULL; +gfx::ImageSkia* g_foreground_16 = NULL; +gfx::ImageSkia* g_background_16 = NULL; +gfx::ImageSkia* g_foreground_32 = NULL; +gfx::ImageSkia* g_background_32 = NULL; void PaintDownloadProgress(gfx::Canvas* canvas, #if defined(TOOLKIT_VIEWS) @@ -200,22 +200,24 @@ void PaintDownloadProgress(gfx::Canvas* canvas, int start_angle, int percent_done, PaintDownloadProgressSize size) { - // Load up our common bitmaps + // Load up our common images if (!g_background_16) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - g_foreground_16 = rb.GetBitmapNamed(IDR_DOWNLOAD_PROGRESS_FOREGROUND_16); - g_background_16 = rb.GetBitmapNamed(IDR_DOWNLOAD_PROGRESS_BACKGROUND_16); - g_foreground_32 = rb.GetBitmapNamed(IDR_DOWNLOAD_PROGRESS_FOREGROUND_32); - g_background_32 = rb.GetBitmapNamed(IDR_DOWNLOAD_PROGRESS_BACKGROUND_32); + g_foreground_16 = rb.GetImageSkiaNamed(IDR_DOWNLOAD_PROGRESS_FOREGROUND_16); + g_background_16 = rb.GetImageSkiaNamed(IDR_DOWNLOAD_PROGRESS_BACKGROUND_16); + g_foreground_32 = rb.GetImageSkiaNamed(IDR_DOWNLOAD_PROGRESS_FOREGROUND_32); + g_background_32 = rb.GetImageSkiaNamed(IDR_DOWNLOAD_PROGRESS_BACKGROUND_32); } - SkBitmap* background = (size == BIG) ? g_background_32 : g_background_16; - SkBitmap* foreground = (size == BIG) ? g_foreground_32 : g_foreground_16; + gfx::ImageSkia* background = + (size == BIG) ? g_background_32 : g_background_16; + gfx::ImageSkia* foreground = + (size == BIG) ? g_foreground_32 : g_foreground_16; const int kProgressIconSize = (size == BIG) ? kBigProgressIconSize : kSmallProgressIconSize; - // We start by storing the bounds of the background and foreground bitmaps + // We start by storing the bounds of the background and foreground images // so that it is easy to mirror the bounds if the UI layout is RTL. gfx::Rect background_bounds(origin_x, origin_y, background->width(), background->height()); @@ -298,14 +300,14 @@ void PaintDownloadComplete(gfx::Canvas* canvas, int origin_y, double animation_progress, PaintDownloadProgressSize size) { - // Load up our common bitmaps. + // Load up our common images. if (!g_foreground_16) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - g_foreground_16 = rb.GetBitmapNamed(IDR_DOWNLOAD_PROGRESS_FOREGROUND_16); - g_foreground_32 = rb.GetBitmapNamed(IDR_DOWNLOAD_PROGRESS_FOREGROUND_32); + g_foreground_16 = rb.GetImageSkiaNamed(IDR_DOWNLOAD_PROGRESS_FOREGROUND_16); + g_foreground_32 = rb.GetImageSkiaNamed(IDR_DOWNLOAD_PROGRESS_FOREGROUND_32); } - SkBitmap* complete = (size == BIG) ? g_foreground_32 : g_foreground_16; + gfx::ImageSkia* complete = (size == BIG) ? g_foreground_32 : g_foreground_16; gfx::Rect complete_bounds(origin_x, origin_y, complete->width(), complete->height()); @@ -330,14 +332,14 @@ void PaintDownloadInterrupted(gfx::Canvas* canvas, int origin_y, double animation_progress, PaintDownloadProgressSize size) { - // Load up our common bitmaps. + // Load up our common images. if (!g_foreground_16) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - g_foreground_16 = rb.GetBitmapNamed(IDR_DOWNLOAD_PROGRESS_FOREGROUND_16); - g_foreground_32 = rb.GetBitmapNamed(IDR_DOWNLOAD_PROGRESS_FOREGROUND_32); + g_foreground_16 = rb.GetImageSkiaNamed(IDR_DOWNLOAD_PROGRESS_FOREGROUND_16); + g_foreground_32 = rb.GetImageSkiaNamed(IDR_DOWNLOAD_PROGRESS_FOREGROUND_32); } - SkBitmap* complete = (size == BIG) ? g_foreground_32 : g_foreground_16; + gfx::ImageSkia* complete = (size == BIG) ? g_foreground_32 : g_foreground_16; gfx::Rect complete_bounds(origin_x, origin_y, complete->width(), complete->height()); diff --git a/chrome/browser/download/download_util.h b/chrome/browser/download/download_util.h index 8bd4f21..11215e6 100644 --- a/chrome/browser/download/download_util.h +++ b/chrome/browser/download/download_util.h @@ -78,7 +78,7 @@ int GetBigProgressIconSize(); const int kSmallProgressIconSize = 39; const int kBigProgressIconSize = 52; -// The offset required to center the icon in the progress bitmaps. +// The offset required to center the icon in the progress images. int GetBigProgressIconOffset(); const int kSmallProgressIconOffset = diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc index 3bde203..39896f5 100644 --- a/chrome/browser/extensions/extension_function_dispatcher.cc +++ b/chrome/browser/extensions/extension_function_dispatcher.cc @@ -31,7 +31,6 @@ #include "ipc/ipc_message.h" #include "ipc/ipc_message_macros.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "webkit/glue/resource_type.h" using extensions::Extension; diff --git a/chrome/browser/extensions/extension_install_dialog.cc b/chrome/browser/extensions/extension_install_dialog.cc index 46c98cb..b404e53 100644 --- a/chrome/browser/extensions/extension_install_dialog.cc +++ b/chrome/browser/extensions/extension_install_dialog.cc @@ -7,13 +7,12 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/file_path.h" -#include "base/message_loop.h" #include "base/memory/scoped_ptr.h" +#include "base/message_loop.h" #include "base/values.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/image/image.h" namespace { diff --git a/chrome/browser/extensions/extension_install_dialog.h b/chrome/browser/extensions/extension_install_dialog.h index 9aabe0c..7f3439e 100644 --- a/chrome/browser/extensions/extension_install_dialog.h +++ b/chrome/browser/extensions/extension_install_dialog.h @@ -13,7 +13,6 @@ #include "chrome/browser/extensions/extension_install_ui.h" class Profile; -class SkBitmap; namespace base { class DictionaryValue; diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc index ee3a193..5739ae6 100644 --- a/chrome/browser/extensions/extension_install_ui.cc +++ b/chrome/browser/extensions/extension_install_ui.cc @@ -184,14 +184,14 @@ void ExtensionInstallUI::Prompt::AppendRatingStars( ResourceBundle& rb = ResourceBundle::GetSharedInstance(); int i; for (i = 0; i < rating_integer; i++) { - appender(rb.GetBitmapNamed(IDR_EXTENSIONS_RATING_STAR_ON), data); + appender(rb.GetImageSkiaNamed(IDR_EXTENSIONS_RATING_STAR_ON), data); } if (rating_fractional) { - appender(rb.GetBitmapNamed(IDR_EXTENSIONS_RATING_STAR_HALF_LEFT), data); + appender(rb.GetImageSkiaNamed(IDR_EXTENSIONS_RATING_STAR_HALF_LEFT), data); i++; } for (; i < kMaxExtensionRating; i++) { - appender(rb.GetBitmapNamed(IDR_EXTENSIONS_RATING_STAR_OFF), data); + appender(rb.GetImageSkiaNamed(IDR_EXTENSIONS_RATING_STAR_OFF), data); } } diff --git a/chrome/browser/extensions/extension_install_ui.h b/chrome/browser/extensions/extension_install_ui.h index 58525e1..1f46eec 100644 --- a/chrome/browser/extensions/extension_install_ui.h +++ b/chrome/browser/extensions/extension_install_ui.h @@ -15,6 +15,7 @@ #include "chrome/common/extensions/url_pattern.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/image/image.h" +#include "ui/gfx/image/image_skia.h" #include "ui/gfx/native_widget_types.h" class Browser; @@ -80,7 +81,7 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer { // components.ratingutils.setFractionalYellowStars). Callers pass in an // "appender", which will be repeatedly called back with the star images // that they append to the star display area. - typedef void(*StarAppender)(const SkBitmap*, void*); + typedef void(*StarAppender)(const gfx::ImageSkia*, void*); void AppendRatingStars(StarAppender appender, void* data) const; string16 GetRatingCount() const; string16 GetUserCount() const; diff --git a/chrome/browser/extensions/extension_uninstall_dialog.cc b/chrome/browser/extensions/extension_uninstall_dialog.cc index 13c718e..935ff92 100644 --- a/chrome/browser/extensions/extension_uninstall_dialog.cc +++ b/chrome/browser/extensions/extension_uninstall_dialog.cc @@ -46,14 +46,14 @@ void ExtensionUninstallDialog::ConfirmUninstall( void ExtensionUninstallDialog::SetIcon(const gfx::Image& image) { if (image.IsEmpty()) { if (extension_->is_app()) { - icon_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed( + icon_ = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_APP_DEFAULT_ICON); } else { - icon_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed( + icon_ = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_EXTENSION_DEFAULT_ICON); } } else { - icon_ = *image.ToSkBitmap(); + icon_ = *image.ToImageSkia(); } } diff --git a/chrome/browser/extensions/extension_uninstall_dialog.h b/chrome/browser/extensions/extension_uninstall_dialog.h index 83b4ab1..6d465c8 100644 --- a/chrome/browser/extensions/extension_uninstall_dialog.h +++ b/chrome/browser/extensions/extension_uninstall_dialog.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,10 +7,10 @@ #pragma once #include "base/basictypes.h" -#include "base/memory/weak_ptr.h" #include "base/compiler_specific.h" +#include "base/memory/weak_ptr.h" #include "chrome/browser/extensions/image_loading_tracker.h" -#include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/image/image_skia.h" class MessageLoop; class Profile; @@ -60,11 +60,11 @@ class ExtensionUninstallDialog const extensions::Extension* extension_; // The extensions icon. - SkBitmap icon_; + gfx::ImageSkia icon_; private: // Sets the icon that will be used in the dialog. If |icon| contains an empty - // bitmap, then we use a default icon instead. + // image, then we use a default icon instead. void SetIcon(const gfx::Image& image); // ImageLoadingTracker::Observer: diff --git a/chrome/browser/media/media_stream_capture_indicator.cc b/chrome/browser/media/media_stream_capture_indicator.cc index e3e8ad0..55f6751 100644 --- a/chrome/browser/media/media_stream_capture_indicator.cc +++ b/chrome/browser/media/media_stream_capture_indicator.cc @@ -159,11 +159,11 @@ void MediaStreamCaptureIndicator::CreateStatusTray() { void MediaStreamCaptureIndicator::EnsureStatusTrayIcon() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (tray_image_.empty()) { - tray_image_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed( + tray_image_ = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_MEDIA_STREAM_CAPTURE_LED); } if (balloon_image_.empty()) { - balloon_image_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed( + balloon_image_ = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_PRODUCT_LOGO_32); } } diff --git a/chrome/browser/media/media_stream_capture_indicator.h b/chrome/browser/media/media_stream_capture_indicator.h index 88efcda..588707a 100644 --- a/chrome/browser/media/media_stream_capture_indicator.h +++ b/chrome/browser/media/media_stream_capture_indicator.h @@ -6,13 +6,13 @@ #define CHROME_BROWSER_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_ #pragma once -#include <vector> #include <string> +#include <vector> #include "base/memory/ref_counted.h" #include "content/public/common/media_stream_request.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/models/simple_menu_model.h" +#include "ui/gfx/image/image_skia.h" class StatusIcon; class StatusTray; @@ -130,9 +130,9 @@ class MediaStreamCaptureIndicator StatusIcon* status_icon_; // Icon to be displayed on the status tray. - SkBitmap tray_image_; + gfx::ImageSkia tray_image_; - SkBitmap balloon_image_; + gfx::ImageSkia balloon_image_; // A list that contains the usage information of the opened capture devices. typedef std::vector<CaptureDeviceTab> CaptureDeviceTabs; diff --git a/chrome/browser/ntp_background_util.cc b/chrome/browser/ntp_background_util.cc index 297a0f0..ddd975e 100644 --- a/chrome/browser/ntp_background_util.cc +++ b/chrome/browser/ntp_background_util.cc @@ -9,16 +9,16 @@ #include "base/logging.h" #include "chrome/browser/themes/theme_service.h" #include "grit/theme_resources.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/canvas.h" +#include "ui/gfx/image/image_skia.h" #include "ui/gfx/rect.h" #include "ui/gfx/skia_util.h" namespace { void PaintThemeBackground( - gfx::Canvas* canvas, SkBitmap* ntp_background, int tiling, int alignment, - const gfx::Rect& area, int tab_contents_height) { + gfx::Canvas* canvas, gfx::ImageSkia* ntp_background, int tiling, + int alignment, const gfx::Rect& area, int tab_contents_height) { int x_pos = 0; int y_pos = 0; int width = area.width() + ntp_background->width(); @@ -78,7 +78,8 @@ void NtpBackgroundUtil::PaintBackgroundDetachedMode(ui::ThemeProvider* tp, int alignment; if (tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_ALIGNMENT, &alignment)) { - SkBitmap* ntp_background = tp->GetBitmapNamed(IDR_THEME_NTP_BACKGROUND); + gfx::ImageSkia* ntp_background = + tp->GetImageSkiaNamed(IDR_THEME_NTP_BACKGROUND); PaintThemeBackground( canvas, ntp_background, tiling, alignment, area, tab_contents_height); diff --git a/chrome/browser/speech/speech_recognition_bubble.cc b/chrome/browser/speech/speech_recognition_bubble.cc index 98c3fe1..a9aafba 100644 --- a/chrome/browser/speech/speech_recognition_bubble.cc +++ b/chrome/browser/speech/speech_recognition_bubble.cc @@ -29,10 +29,10 @@ class SpeechRecognitionBubbleImages { public: const std::vector<SkBitmap>& spinner() { return spinner_; } const std::vector<SkBitmap>& warm_up() { return warm_up_; } - SkBitmap* mic_full() { return mic_full_; } - SkBitmap* mic_empty() { return mic_empty_; } - SkBitmap* mic_noise() { return mic_noise_; } - SkBitmap* mic_mask() { return mic_mask_; } + gfx::ImageSkia* mic_full() { return mic_full_; } + gfx::ImageSkia* mic_empty() { return mic_empty_; } + gfx::ImageSkia* mic_noise() { return mic_noise_; } + gfx::ImageSkia* mic_mask() { return mic_mask_; } private: // Private constructor to enforce singleton. @@ -42,28 +42,28 @@ class SpeechRecognitionBubbleImages { std::vector<SkBitmap> spinner_; // Frames for the progress spinner. std::vector<SkBitmap> warm_up_; // Frames for the warm up animation. - // These bitmaps are owned by ResourceBundle and need not be destroyed. - SkBitmap* mic_full_; // Mic image with full volume. - SkBitmap* mic_noise_; // Mic image with full noise volume. - SkBitmap* mic_empty_; // Mic image with zero volume. - SkBitmap* mic_mask_; // Gradient mask used by the volume indicator. + // These images are owned by ResourceBundle and need not be destroyed. + gfx::ImageSkia* mic_full_; // Mic image with full volume. + gfx::ImageSkia* mic_noise_; // Mic image with full noise volume. + gfx::ImageSkia* mic_empty_; // Mic image with zero volume. + gfx::ImageSkia* mic_mask_; // Gradient mask used by the volume indicator. }; SpeechRecognitionBubbleImages::SpeechRecognitionBubbleImages() { - mic_empty_ = ResourceBundle::GetSharedInstance().GetBitmapNamed( + mic_empty_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_SPEECH_INPUT_MIC_EMPTY); - mic_noise_ = ResourceBundle::GetSharedInstance().GetBitmapNamed( + mic_noise_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_SPEECH_INPUT_MIC_NOISE); - mic_full_ = ResourceBundle::GetSharedInstance().GetBitmapNamed( + mic_full_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_SPEECH_INPUT_MIC_FULL); - mic_mask_ = ResourceBundle::GetSharedInstance().GetBitmapNamed( + mic_mask_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_SPEECH_INPUT_MIC_MASK); // The sprite image consists of all the animation frames put together in one // horizontal/wide image. Each animation frame is square in shape within the // sprite. - SkBitmap* spinner_image = ResourceBundle::GetSharedInstance().GetBitmapNamed( - IDR_SPEECH_INPUT_SPINNER); + const SkBitmap* spinner_image = ResourceBundle::GetSharedInstance(). + GetImageSkiaNamed(IDR_SPEECH_INPUT_SPINNER)->bitmap(); int frame_size = spinner_image->height(); // When recording starts up, it may take a short while (few ms or even a @@ -85,11 +85,11 @@ SpeechRecognitionBubbleImages::SpeechRecognitionBubbleImages() { SkBitmap frame; spinner_image->extractSubset(&frame, src_rect); - // The bitmap created by extractSubset just points to the same pixels as + // The image created by extractSubset just points to the same pixels as // the original and adjusts rowBytes accordingly. However that doesn't // render properly and gets vertically squished in Linux due to a bug in // Skia. Until that gets fixed we work around by taking a real copy of it - // below as the copied bitmap has the correct rowBytes and renders fine. + // below as the copied image has the correct rowBytes and renders fine. SkBitmap frame_copy; frame.copyTo(&frame_copy, SkBitmap::kARGB_8888_Config); spinner_.push_back(frame_copy); @@ -199,7 +199,7 @@ void SpeechRecognitionBubbleBase::SetMessage(const string16& text) { } void SpeechRecognitionBubbleBase::DrawVolumeOverlay(SkCanvas* canvas, - const SkBitmap& bitmap, + const gfx::ImageSkia& image, float volume) { buffer_image_->eraseARGB(0, 0, 0, 0); @@ -213,7 +213,7 @@ void SpeechRecognitionBubbleBase::DrawVolumeOverlay(SkCanvas* canvas, (((1.0f - volume) * (width * (kVolumeSteps + 1))) - width) / kVolumeSteps; buffer_canvas.clipRect(SkRect::MakeLTRB(0, 0, SkIntToScalar(width) - clip_right, SkIntToScalar(height))); - buffer_canvas.drawBitmap(bitmap, 0, 0); + buffer_canvas.drawBitmap(image, 0, 0); buffer_canvas.restore(); SkPaint multiply_paint; multiply_paint.setXfermode(SkXfermode::Create(SkXfermode::kMultiply_Mode)); @@ -241,11 +241,11 @@ WebContents* SpeechRecognitionBubbleBase::GetWebContents() { return web_contents_; } -void SpeechRecognitionBubbleBase::SetImage(const SkBitmap& image) { - icon_image_.reset(new SkBitmap(image)); +void SpeechRecognitionBubbleBase::SetImage(const gfx::ImageSkia& image) { + icon_image_.reset(new gfx::ImageSkia(image)); UpdateImage(); } -SkBitmap SpeechRecognitionBubbleBase::icon_image() { - return (icon_image_ != NULL) ? *icon_image_ : SkBitmap(); +gfx::ImageSkia SpeechRecognitionBubbleBase::icon_image() { + return (icon_image_ != NULL) ? *icon_image_ : gfx::ImageSkia(); } diff --git a/chrome/browser/speech/speech_recognition_bubble.h b/chrome/browser/speech/speech_recognition_bubble.h index 2844122..ecb784b 100644 --- a/chrome/browser/speech/speech_recognition_bubble.h +++ b/chrome/browser/speech/speech_recognition_bubble.h @@ -21,6 +21,7 @@ class WebContents; namespace gfx { class Canvas; +class ImageSkia; class Rect; } @@ -156,22 +157,22 @@ class SpeechRecognitionBubbleBase : public SpeechRecognitionBubble { const string16& message_text() const { return message_text_; } - SkBitmap icon_image(); + gfx::ImageSkia icon_image(); private: void DoRecognizingAnimationStep(); void DoWarmingUpAnimationStep(); - void SetImage(const SkBitmap& image); + void SetImage(const gfx::ImageSkia& image); void DrawVolumeOverlay(SkCanvas* canvas, - const SkBitmap& bitmap, + const gfx::ImageSkia& image_skia, float volume); // Task factory used for animation timer. base::WeakPtrFactory<SpeechRecognitionBubbleBase> weak_factory_; int animation_step_; // Current index/step of the animation. - std::vector<SkBitmap> animation_frames_; - std::vector<SkBitmap> warming_up_frames_; + std::vector<gfx::ImageSkia> animation_frames_; + std::vector<gfx::ImageSkia> warming_up_frames_; DisplayMode display_mode_; string16 message_text_; // Text displayed in DISPLAY_MODE_MESSAGE @@ -182,7 +183,7 @@ class SpeechRecognitionBubbleBase : public SpeechRecognitionBubble { // WebContents in which this this bubble gets displayed. content::WebContents* web_contents_; // The current image displayed in the bubble's icon widget. - scoped_ptr<SkBitmap> icon_image_; + scoped_ptr<gfx::ImageSkia> icon_image_; }; // This typedef is to workaround the issue with certain versions of diff --git a/chrome/browser/speech/speech_recognition_bubble_controller_unittest.cc b/chrome/browser/speech/speech_recognition_bubble_controller_unittest.cc index f72d123..e2f1dd9 100644 --- a/chrome/browser/speech/speech_recognition_bubble_controller_unittest.cc +++ b/chrome/browser/speech/speech_recognition_bubble_controller_unittest.cc @@ -16,8 +16,6 @@ using content::BrowserThread; using content::WebContents; -class SkBitmap; - namespace speech { // A mock bubble class which fakes a focus change or recognition cancel by the diff --git a/chrome/browser/speech/speech_recognition_tray_icon_controller.cc b/chrome/browser/speech/speech_recognition_tray_icon_controller.cc index 35e8856..47dcce7 100644 --- a/chrome/browser/speech/speech_recognition_tray_icon_controller.cc +++ b/chrome/browser/speech/speech_recognition_tray_icon_controller.cc @@ -33,27 +33,28 @@ const int kVolumeSteps = 6; // notification icon and safely destroy them on exit. class NotificationTrayImages { public: - SkBitmap* mic_full() { return mic_full_; } - SkBitmap* mic_empty() { return mic_empty_; } - SkBitmap* balloon_icon() { return balloon_icon_; } + gfx::ImageSkia* mic_full() { return mic_full_; } + gfx::ImageSkia* mic_empty() { return mic_empty_; } + gfx::ImageSkia* balloon_icon() { return balloon_icon_; } private: // Private constructor to enforce singleton. friend struct base::DefaultLazyInstanceTraits<NotificationTrayImages>; NotificationTrayImages(); - // These bitmaps are owned by ResourceBundle and need not be destroyed. - SkBitmap* mic_full_; // Tray mic image with full volume. - SkBitmap* mic_empty_; // Tray mic image with zero volume. - SkBitmap* balloon_icon_; // High resolution mic for the notification balloon. + // These images are owned by ResourceBundle and need not be destroyed. + gfx::ImageSkia* mic_full_; // Tray mic image with full volume. + gfx::ImageSkia* mic_empty_; // Tray mic image with zero volume. + // High resolution mic for the notification balloon. + gfx::ImageSkia* balloon_icon_; }; NotificationTrayImages::NotificationTrayImages() { - mic_empty_ = ResourceBundle::GetSharedInstance().GetBitmapNamed( + mic_empty_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_SPEECH_INPUT_TRAY_MIC_EMPTY); - mic_full_ = ResourceBundle::GetSharedInstance().GetBitmapNamed( + mic_full_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_SPEECH_INPUT_TRAY_MIC_FULL); - balloon_icon_ = ResourceBundle::GetSharedInstance().GetBitmapNamed( + balloon_icon_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_SPEECH_INPUT_TRAY_BALLOON_ICON); } @@ -165,7 +166,7 @@ void SpeechRecognitionTrayIconController::Initialize() { void SpeechRecognitionTrayIconController::DrawVolume( SkCanvas* canvas, - const SkBitmap& bitmap, + const gfx::ImageSkia& image, float volume) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); buffer_image_->eraseARGB(0, 0, 0, 0); @@ -179,7 +180,7 @@ void SpeechRecognitionTrayIconController::DrawVolume( kVolumeSteps; buffer_canvas.clipRect(SkRect::MakeLTRB(0, clip_top, SkIntToScalar(width), SkIntToScalar(height))); - buffer_canvas.drawBitmap(bitmap, 0, 0); + buffer_canvas.drawBitmap(image, 0, 0); canvas->drawBitmap(*buffer_image_.get(), 0, 0); } diff --git a/chrome/browser/speech/speech_recognition_tray_icon_controller.h b/chrome/browser/speech/speech_recognition_tray_icon_controller.h index f17ef0b..a73d981 100644 --- a/chrome/browser/speech/speech_recognition_tray_icon_controller.h +++ b/chrome/browser/speech/speech_recognition_tray_icon_controller.h @@ -15,6 +15,10 @@ class SkBitmap; class SkCanvas; class StatusIcon; +namespace gfx { +class ImageSkia; +} + // Manages the tray icon for speech recognition. class SpeechRecognitionTrayIconController : public base::RefCountedThreadSafe<SpeechRecognitionTrayIconController> { @@ -30,7 +34,7 @@ class SpeechRecognitionTrayIconController virtual ~SpeechRecognitionTrayIconController(); void Initialize(); - void DrawVolume(SkCanvas* canvas, const SkBitmap& bitmap, float volume); + void DrawVolume(SkCanvas* canvas, const gfx::ImageSkia& image, float volume); void ShowNotificationBalloon(const string16& text); scoped_ptr<SkBitmap> mic_image_; diff --git a/chrome/browser/status_icons/desktop_notification_balloon.cc b/chrome/browser/status_icons/desktop_notification_balloon.cc index a3fc825..70d46ee 100644 --- a/chrome/browser/status_icons/desktop_notification_balloon.cc +++ b/chrome/browser/status_icons/desktop_notification_balloon.cc @@ -15,6 +15,7 @@ #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/webui/web_ui_util.h" #include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/image/image_skia.h" namespace { @@ -72,7 +73,7 @@ void DesktopNotificationBalloon::DisplayBalloon(const SkBitmap& icon, const string16& contents) { GURL icon_url; if (!icon.empty()) - icon_url = GURL(web_ui_util::GetImageDataUrl(icon)); + icon_url = GURL(web_ui_util::GetImageDataUrl(gfx::ImageSkia(icon))); GURL content_url(DesktopNotificationService::CreateDataUrl( icon_url, title, contents, WebKit::WebTextDirectionDefault)); diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc index 6d021c4..d916567 100644 --- a/chrome/browser/task_manager/task_manager.cc +++ b/chrome/browser/task_manager/task_manager.cc @@ -39,10 +39,10 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/ui_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/base/text/bytes_formatting.h" +#include "ui/gfx/image/image_skia.h" #include "unicode/coll.h" using content::BrowserThread; @@ -306,14 +306,14 @@ bool TaskManagerModel::IsBackgroundResource(int index) const { return resources_[index]->IsBackground(); } -SkBitmap TaskManagerModel::GetResourceIcon(int index) const { +gfx::ImageSkia TaskManagerModel::GetResourceIcon(int index) const { CHECK_LT(index, ResourceCount()); - SkBitmap icon = resources_[index]->GetIcon(); + gfx::ImageSkia icon = resources_[index]->GetIcon(); if (!icon.isNull()) return icon; - static SkBitmap* default_icon = ResourceBundle::GetSharedInstance(). - GetBitmapNamed(IDR_DEFAULT_FAVICON); + static gfx::ImageSkia* default_icon = ResourceBundle::GetSharedInstance(). + GetImageSkiaNamed(IDR_DEFAULT_FAVICON); return *default_icon; } diff --git a/chrome/browser/task_manager/task_manager.h b/chrome/browser/task_manager/task_manager.h index d118ba8..b7cd68a 100644 --- a/chrome/browser/task_manager/task_manager.h +++ b/chrome/browser/task_manager/task_manager.h @@ -21,7 +21,6 @@ #include "chrome/browser/renderer_host/web_cache_manager.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" -class SkBitmap; class TabContents; typedef TabContents TabContentsWrapper; class TaskManagerModel; @@ -34,6 +33,10 @@ namespace extensions { class Extension; } +namespace gfx { +class ImageSkia; +} + namespace net { class URLRequest; } @@ -71,7 +74,7 @@ class TaskManager { virtual string16 GetTitle() const = 0; virtual string16 GetProfileName() const = 0; - virtual SkBitmap GetIcon() const = 0; + virtual gfx::ImageSkia GetIcon() const = 0; virtual base::ProcessHandle GetProcess() const = 0; virtual int GetUniqueChildProcessId() const = 0; virtual Type GetType() const = 0; @@ -372,7 +375,7 @@ class TaskManagerModel : public base::RefCountedThreadSafe<TaskManagerModel> { bool IsBackgroundResource(int index) const; // Returns icon to be used for resource (for example a favicon). - SkBitmap GetResourceIcon(int index) const; + gfx::ImageSkia GetResourceIcon(int index) const; // Returns the group range of resource. GroupRange GetGroupRangeForResource(int index) const; diff --git a/chrome/browser/task_manager/task_manager_notification_resource_provider.cc b/chrome/browser/task_manager/task_manager_notification_resource_provider.cc index 8b0f11f..22783fe 100644 --- a/chrome/browser/task_manager/task_manager_notification_resource_provider.cc +++ b/chrome/browser/task_manager/task_manager_notification_resource_provider.cc @@ -8,9 +8,9 @@ #include "base/stl_util.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/debugger/devtools_window.h" +#include "chrome/browser/notifications/balloon.h" #include "chrome/browser/notifications/balloon_collection.h" #include "chrome/browser/notifications/balloon_host.h" -#include "chrome/browser/notifications/balloon.h" #include "chrome/browser/notifications/notification_ui_manager.h" #include "chrome/common/chrome_notification_types.h" #include "content/public/browser/notification_service.h" @@ -20,22 +20,22 @@ #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.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" //////////////////////////////////////////////////////////////////////////////// // TaskManagerNotificationResource class //////////////////////////////////////////////////////////////////////////////// -SkBitmap* TaskManagerNotificationResource::default_icon_ = NULL; +gfx::ImageSkia* TaskManagerNotificationResource::default_icon_ = NULL; TaskManagerNotificationResource::TaskManagerNotificationResource( BalloonHost* balloon_host) : balloon_host_(balloon_host) { if (!default_icon_) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN); + default_icon_ = rb.GetImageSkiaNamed(IDR_PLUGIN); } process_handle_ = balloon_host_->web_contents()->GetRenderProcessHost()->GetHandle(); @@ -57,7 +57,7 @@ string16 TaskManagerNotificationResource::GetProfileName() const { return string16(); } -SkBitmap TaskManagerNotificationResource::GetIcon() const { +gfx::ImageSkia TaskManagerNotificationResource::GetIcon() const { return *default_icon_; } diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc index b5358c3..09da980 100644 --- a/chrome/browser/task_manager/task_manager_resource_providers.cc +++ b/chrome/browser/task_manager/task_manager_resource_providers.cc @@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/file_version_info.h" #include "base/i18n/rtl.h" +#include "base/memory/scoped_ptr.h" #include "base/process_util.h" #include "base/stl_util.h" #include "base/string_util.h" @@ -58,6 +59,7 @@ #include "third_party/sqlite/sqlite3.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image/image_skia.h" #include "v8/include/v8.h" #if defined(OS_MACOSX) @@ -222,7 +224,7 @@ bool TaskManagerRendererResource::SupportNetworkUsage() const { //////////////////////////////////////////////////////////////////////////////// // static -SkBitmap* TaskManagerTabContentsResource::prerender_icon_ = NULL; +gfx::ImageSkia* TaskManagerTabContentsResource::prerender_icon_ = NULL; TaskManagerTabContentsResource::TaskManagerTabContentsResource( TabContentsWrapper* tab_contents) @@ -233,7 +235,7 @@ TaskManagerTabContentsResource::TaskManagerTabContentsResource( is_instant_preview_(false) { if (!prerender_icon_) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - prerender_icon_ = rb.GetBitmapNamed(IDR_PRERENDER); + prerender_icon_ = rb.GetImageSkiaNamed(IDR_PRERENDER); } for (BrowserList::const_iterator i = BrowserList::begin(); i != BrowserList::end(); ++i) { @@ -322,7 +324,7 @@ string16 TaskManagerTabContentsResource::GetProfileName() const { return cache.GetNameOfProfileAtIndex(index); } -SkBitmap TaskManagerTabContentsResource::GetIcon() const { +gfx::ImageSkia TaskManagerTabContentsResource::GetIcon() const { if (IsPrerendering()) return *prerender_icon_; return tab_contents_->favicon_tab_helper()->GetFavicon(); @@ -528,7 +530,7 @@ void TaskManagerTabContentsResourceProvider::Observe(int type, // TaskManagerBackgroundContentsResource class //////////////////////////////////////////////////////////////////////////////// -SkBitmap* TaskManagerBackgroundContentsResource::default_icon_ = NULL; +gfx::ImageSkia* TaskManagerBackgroundContentsResource::default_icon_ = NULL; // TODO(atwilson): http://crbug.com/116893 // HACK: if the process handle is invalid, we use the current process's handle. @@ -549,7 +551,7 @@ TaskManagerBackgroundContentsResource::TaskManagerBackgroundContentsResource( // TODO(atwilson): Use the favicon when that's available. if (!default_icon_) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN); + default_icon_ = rb.GetImageSkiaNamed(IDR_PLUGIN); } // Ensure that the string has the appropriate direction markers (see comment // in TaskManagerTabContentsResource::GetTitle()). @@ -576,7 +578,7 @@ string16 TaskManagerBackgroundContentsResource::GetProfileName() const { return string16(); } -SkBitmap TaskManagerBackgroundContentsResource::GetIcon() const { +gfx::ImageSkia TaskManagerBackgroundContentsResource::GetIcon() const { return *default_icon_; } @@ -785,7 +787,7 @@ void TaskManagerBackgroundContentsResourceProvider::Observe( //////////////////////////////////////////////////////////////////////////////// // TaskManagerChildProcessResource class //////////////////////////////////////////////////////////////////////////////// -SkBitmap* TaskManagerChildProcessResource::default_icon_ = NULL; +gfx::ImageSkia* TaskManagerChildProcessResource::default_icon_ = NULL; TaskManagerChildProcessResource::TaskManagerChildProcessResource( content::ProcessType type, @@ -802,7 +804,7 @@ TaskManagerChildProcessResource::TaskManagerChildProcessResource( pid_ = base::GetProcId(handle); if (!default_icon_) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN); + default_icon_ = rb.GetImageSkiaNamed(IDR_PLUGIN); // TODO(jabdelmalek): use different icon for web workers. } } @@ -822,7 +824,7 @@ string16 TaskManagerChildProcessResource::GetProfileName() const { return string16(); } -SkBitmap TaskManagerChildProcessResource::GetIcon() const { +gfx::ImageSkia TaskManagerChildProcessResource::GetIcon() const { return *default_icon_; } @@ -1108,14 +1110,14 @@ void TaskManagerChildProcessResourceProvider::ChildProcessDataRetreived( // TaskManagerExtensionProcessResource class //////////////////////////////////////////////////////////////////////////////// -SkBitmap* TaskManagerExtensionProcessResource::default_icon_ = NULL; +gfx::ImageSkia* TaskManagerExtensionProcessResource::default_icon_ = NULL; TaskManagerExtensionProcessResource::TaskManagerExtensionProcessResource( content::RenderViewHost* render_view_host) : render_view_host_(render_view_host) { if (!default_icon_) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN); + default_icon_ = rb.GetImageSkiaNamed(IDR_PLUGIN); } process_handle_ = render_view_host_->GetProcess()->GetHandle(); unique_process_id_ = render_view_host->GetProcess()->GetID(); @@ -1150,7 +1152,7 @@ string16 TaskManagerExtensionProcessResource::GetProfileName() const { return cache.GetNameOfProfileAtIndex(index); } -SkBitmap TaskManagerExtensionProcessResource::GetIcon() const { +gfx::ImageSkia TaskManagerExtensionProcessResource::GetIcon() const { return *default_icon_; } @@ -1366,7 +1368,7 @@ void TaskManagerExtensionProcessResourceProvider::RemoveFromTaskManager( // TaskManagerBrowserProcessResource class //////////////////////////////////////////////////////////////////////////////// -SkBitmap* TaskManagerBrowserProcessResource::default_icon_ = NULL; +gfx::ImageSkia* TaskManagerBrowserProcessResource::default_icon_ = NULL; TaskManagerBrowserProcessResource::TaskManagerBrowserProcessResource() : title_() { @@ -1377,19 +1379,20 @@ TaskManagerBrowserProcessResource::TaskManagerBrowserProcessResource() if (!default_icon_) { HICON icon = GetAppIcon(); if (icon) { - default_icon_ = IconUtil::CreateSkBitmapFromHICON(icon); + scoped_ptr<SkBitmap> bitmap(IconUtil::CreateSkBitmapFromHICON(icon)); + default_icon_ = new gfx::ImageSkia(*bitmap); } } #elif defined(OS_POSIX) && !defined(OS_MACOSX) if (!default_icon_) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - default_icon_ = rb.GetBitmapNamed(IDR_PRODUCT_LOGO_16); + default_icon_ = rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_16); } #elif defined(OS_MACOSX) if (!default_icon_) { // IDR_PRODUCT_LOGO_16 doesn't quite look like chrome/mac's icns icon. Load // the real app icon (requires a nsimage->skbitmap->nsimage conversion :-(). - default_icon_ = new SkBitmap(gfx::AppplicationIconAtSize(16)); + default_icon_ = new gfx::ImageSkia(gfx::AppplicationIconAtSize(16)); } #else // TODO(port): Port icon code. @@ -1413,7 +1416,7 @@ string16 TaskManagerBrowserProcessResource::GetProfileName() const { return string16(); } -SkBitmap TaskManagerBrowserProcessResource::GetIcon() const { +gfx::ImageSkia TaskManagerBrowserProcessResource::GetIcon() const { return *default_icon_; } diff --git a/chrome/browser/task_manager/task_manager_resource_providers.h b/chrome/browser/task_manager/task_manager_resource_providers.h index affe440..b9f80a7 100644 --- a/chrome/browser/task_manager/task_manager_resource_providers.h +++ b/chrome/browser/task_manager/task_manager_resource_providers.h @@ -114,7 +114,7 @@ class TaskManagerTabContentsResource : public TaskManagerRendererResource { virtual Type GetType() const OVERRIDE; virtual string16 GetTitle() const OVERRIDE; virtual string16 GetProfileName() const OVERRIDE; - virtual SkBitmap GetIcon() const OVERRIDE; + virtual gfx::ImageSkia GetIcon() const OVERRIDE; virtual TabContentsWrapper* GetTabContents() const OVERRIDE; virtual const extensions::Extension* GetExtension() const OVERRIDE; @@ -124,7 +124,7 @@ class TaskManagerTabContentsResource : public TaskManagerRendererResource { // Returns true if contains content rendered by an extension. bool HostsExtension() const; - static SkBitmap* prerender_icon_; + static gfx::ImageSkia* prerender_icon_; TabContentsWrapper* tab_contents_; bool is_instant_preview_; @@ -184,7 +184,7 @@ class TaskManagerBackgroundContentsResource // TaskManager::Resource methods: virtual string16 GetTitle() const OVERRIDE; virtual string16 GetProfileName() const OVERRIDE; - virtual SkBitmap GetIcon() const OVERRIDE; + virtual gfx::ImageSkia GetIcon() const OVERRIDE; virtual bool IsBackground() const OVERRIDE; const string16& application_name() const { return application_name_; } @@ -196,7 +196,7 @@ class TaskManagerBackgroundContentsResource // The icon painted for BackgroundContents. // TODO(atwilson): Use the favicon when there's a way to get the favicon for // BackgroundContents. - static SkBitmap* default_icon_; + static gfx::ImageSkia* default_icon_; DISALLOW_COPY_AND_ASSIGN(TaskManagerBackgroundContentsResource); }; @@ -257,7 +257,7 @@ class TaskManagerChildProcessResource : public TaskManager::Resource { // TaskManager::Resource methods: virtual string16 GetTitle() const OVERRIDE; virtual string16 GetProfileName() const OVERRIDE; - virtual SkBitmap GetIcon() const OVERRIDE; + virtual gfx::ImageSkia GetIcon() const OVERRIDE; virtual base::ProcessHandle GetProcess() const OVERRIDE; virtual int GetUniqueChildProcessId() const OVERRIDE; virtual Type GetType() const OVERRIDE; @@ -283,7 +283,7 @@ class TaskManagerChildProcessResource : public TaskManager::Resource { // The icon painted for the child processs. // TODO(jcampan): we should have plugin specific icons for well-known // plugins. - static SkBitmap* default_icon_; + static gfx::ImageSkia* default_icon_; DISALLOW_COPY_AND_ASSIGN(TaskManagerChildProcessResource); }; @@ -354,7 +354,7 @@ class TaskManagerExtensionProcessResource : public TaskManager::Resource { // TaskManager::Resource methods: virtual string16 GetTitle() const OVERRIDE; virtual string16 GetProfileName() const OVERRIDE; - virtual SkBitmap GetIcon() const OVERRIDE; + virtual gfx::ImageSkia GetIcon() const OVERRIDE; virtual base::ProcessHandle GetProcess() const OVERRIDE; virtual int GetUniqueChildProcessId() const OVERRIDE; virtual Type GetType() const OVERRIDE; @@ -372,7 +372,7 @@ class TaskManagerExtensionProcessResource : public TaskManager::Resource { private: // The icon painted for the extension process. - static SkBitmap* default_icon_; + static gfx::ImageSkia* default_icon_; content::RenderViewHost* render_view_host_; @@ -437,7 +437,7 @@ class TaskManagerNotificationResource : public TaskManager::Resource { // TaskManager::Resource interface virtual string16 GetTitle() const OVERRIDE; virtual string16 GetProfileName() const OVERRIDE; - virtual SkBitmap GetIcon() const OVERRIDE; + virtual gfx::ImageSkia GetIcon() const OVERRIDE; virtual base::ProcessHandle GetProcess() const OVERRIDE; virtual int GetUniqueChildProcessId() const OVERRIDE; virtual Type GetType() const OVERRIDE; @@ -448,7 +448,7 @@ class TaskManagerNotificationResource : public TaskManager::Resource { private: // The icon painted for notifications. . - static SkBitmap* default_icon_; + static gfx::ImageSkia* default_icon_; // Non-owned pointer to the balloon host. BalloonHost* balloon_host_; @@ -509,7 +509,7 @@ class TaskManagerBrowserProcessResource : public TaskManager::Resource { // TaskManager::Resource methods: virtual string16 GetTitle() const OVERRIDE; virtual string16 GetProfileName() const OVERRIDE; - virtual SkBitmap GetIcon() const OVERRIDE; + virtual gfx::ImageSkia GetIcon() const OVERRIDE; virtual base::ProcessHandle GetProcess() const OVERRIDE; virtual int GetUniqueChildProcessId() const OVERRIDE; virtual Type GetType() const OVERRIDE; @@ -528,7 +528,7 @@ class TaskManagerBrowserProcessResource : public TaskManager::Resource { base::ProcessHandle process_; mutable string16 title_; - static SkBitmap* default_icon_; + static gfx::ImageSkia* default_icon_; DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResource); }; diff --git a/chrome/browser/task_manager/task_manager_unittest.cc b/chrome/browser/task_manager/task_manager_unittest.cc index c5e286d..c313db6 100644 --- a/chrome/browser/task_manager/task_manager_unittest.cc +++ b/chrome/browser/task_manager/task_manager_unittest.cc @@ -12,8 +12,8 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/gfx/image/image_skia.h" namespace { @@ -36,7 +36,7 @@ class TestResource : public TaskManager::Resource { virtual string16 GetProfileName() const OVERRIDE { return ASCIIToUTF16("test profile"); } - virtual SkBitmap GetIcon() const { return SkBitmap(); } + virtual gfx::ImageSkia GetIcon() const { return gfx::ImageSkia(); } virtual base::ProcessHandle GetProcess() const { return base::GetCurrentProcessHandle(); } diff --git a/chrome/browser/task_manager/task_manager_worker_resource_provider.cc b/chrome/browser/task_manager/task_manager_worker_resource_provider.cc index 1102174..0b72af4 100644 --- a/chrome/browser/task_manager/task_manager_worker_resource_provider.cc +++ b/chrome/browser/task_manager/task_manager_worker_resource_provider.cc @@ -19,9 +19,9 @@ #include "content/public/browser/worker_service.h" #include "grit/generated_resources.h" #include "grit/theme_resources_standard.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" using content::BrowserThread; using content::DevToolsAgentHost; @@ -50,7 +50,7 @@ class TaskManagerSharedWorkerResource : public TaskManager::Resource { // TaskManager::Resource methods: virtual string16 GetTitle() const OVERRIDE; virtual string16 GetProfileName() const OVERRIDE; - virtual SkBitmap GetIcon() const OVERRIDE; + virtual gfx::ImageSkia GetIcon() const OVERRIDE; virtual base::ProcessHandle GetProcess() const OVERRIDE; virtual int GetUniqueChildProcessId() const OVERRIDE; virtual Type GetType() const OVERRIDE; @@ -65,12 +65,12 @@ class TaskManagerSharedWorkerResource : public TaskManager::Resource { string16 title_; base::ProcessHandle handle_; - static SkBitmap* default_icon_; + static gfx::ImageSkia* default_icon_; DISALLOW_COPY_AND_ASSIGN(TaskManagerSharedWorkerResource); }; -SkBitmap* TaskManagerSharedWorkerResource::default_icon_ = NULL; +gfx::ImageSkia* TaskManagerSharedWorkerResource::default_icon_ = NULL; TaskManagerSharedWorkerResource::TaskManagerSharedWorkerResource( const GURL& url, @@ -107,10 +107,10 @@ string16 TaskManagerSharedWorkerResource::GetProfileName() const { return string16(); } -SkBitmap TaskManagerSharedWorkerResource::GetIcon() const { +gfx::ImageSkia TaskManagerSharedWorkerResource::GetIcon() const { if (!default_icon_) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN); + default_icon_ = rb.GetImageSkiaNamed(IDR_PLUGIN); // TODO(jabdelmalek): use different icon for web workers. } return *default_icon_; diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view_unittest.mm index 7ed17ba..897b74a 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view_unittest.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view_unittest.mm @@ -178,11 +178,12 @@ TEST_F(BookmarkBarToolbarViewTest, DisplayAsDetachedBarWithBgImage) { .WillRepeatedly(SetAlignLeft()); // Create a dummy bitmap full of not-red to blit with. - SkBitmap fake_bg; - fake_bg.setConfig(SkBitmap::kARGB_8888_Config, 800, 800); - fake_bg.allocPixels(); - fake_bg.eraseColor(SK_ColorGREEN); - EXPECT_CALL(provider, GetBitmapNamed(IDR_THEME_NTP_BACKGROUND)) + SkBitmap fake_bg_bitmap; + fake_bg_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 800, 800); + fake_bg_bitmap.allocPixels(); + fake_bg_bitmap.eraseColor(SK_ColorGREEN); + gfx::ImageSkia fake_bg(fake_bg_bitmap); + EXPECT_CALL(provider, GetImageSkiaNamed(IDR_THEME_NTP_BACKGROUND)) .WillRepeatedly(Return(&fake_bg)); [controller_.get() setThemeProvider:&provider]; diff --git a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h index ea71fe0..de78a12 100644 --- a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h +++ b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -50,7 +50,7 @@ class CollectedCookiesMac : public ConstrainedWindowMacDelegateCustomSheet, // Controller for the collected cookies dialog. This class stores an internal // copy of the CookiesTreeModel but with Cocoa-converted values (NSStrings and -// NSImages instead of std::strings and SkBitmaps). Doing this allows us to use +// NSImages instead of std::strings and ImageSkias). Doing this allows us to use // bindings for the interface. Changes are pushed to this internal model via a // very thin bridge (see cookies_window_controller.h). @interface CollectedCookiesWindowController : NSWindowController diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.h b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.h index 9cab254..0ac16b0 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.h +++ b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.h @@ -13,7 +13,7 @@ #include "base/memory/scoped_ptr.h" #include "base/string16.h" #include "chrome/browser/extensions/extension_install_ui.h" -#include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/image/image_skia.h" class Profile; diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm index 504edb9..809c575 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm @@ -30,7 +30,7 @@ using extensions::BundleInstaller; @interface ExtensionInstallDialogController () - (BOOL)isBundleInstall; - (BOOL)isInlineInstall; -- (void)appendRatingStar:(const SkBitmap*)skiaImage; +- (void)appendRatingStar:(const gfx::ImageSkia*)skiaImage; @end namespace { @@ -66,7 +66,7 @@ void OffsetControlVerticallyToFitContent(NSControl* control, [control setFrameOrigin:origin]; } -void AppendRatingStarsShim(const SkBitmap* skiaImage, void* data) { +void AppendRatingStarsShim(const gfx::ImageSkia* skiaImage, void* data) { ExtensionInstallDialogController* controller = static_cast<ExtensionInstallDialogController*>(data); [controller appendRatingStar:skiaImage]; @@ -297,7 +297,7 @@ void AppendRatingStarsShim(const SkBitmap* skiaImage, void* data) { return prompt_->type() == ExtensionInstallUI::INLINE_INSTALL_PROMPT; } -- (void)appendRatingStar:(const SkBitmap*)skiaImage { +- (void)appendRatingStar:(const gfx::ImageSkia*)skiaImage { NSImage* image = gfx::SkBitmapToNSImageWithColorSpace( *skiaImage, base::mac::GetSystemColorSpace()); NSRect frame = NSMakeRect(0, 0, skiaImage->width(), skiaImage->height()); diff --git a/chrome/browser/ui/cocoa/infobars/mock_confirm_infobar_delegate.cc b/chrome/browser/ui/cocoa/infobars/mock_confirm_infobar_delegate.cc index 11577fc..a73b325 100644 --- a/chrome/browser/ui/cocoa/infobars/mock_confirm_infobar_delegate.cc +++ b/chrome/browser/ui/cocoa/infobars/mock_confirm_infobar_delegate.cc @@ -1,11 +1,10 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/ui/cocoa/infobars/mock_confirm_infobar_delegate.h" #include "base/utf_string_conversions.h" -#include "third_party/skia/include/core/SkBitmap.h" const char MockConfirmInfoBarDelegate::kMessage[] = "MockConfirmInfoBarMessage"; diff --git a/chrome/browser/ui/cocoa/infobars/mock_link_infobar_delegate.cc b/chrome/browser/ui/cocoa/infobars/mock_link_infobar_delegate.cc index f0070d0..7fe8f89 100644 --- a/chrome/browser/ui/cocoa/infobars/mock_link_infobar_delegate.cc +++ b/chrome/browser/ui/cocoa/infobars/mock_link_infobar_delegate.cc @@ -1,11 +1,10 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/ui/cocoa/infobars/mock_link_infobar_delegate.h" #include "base/utf_string_conversions.h" -#include "third_party/skia/include/core/SkBitmap.h" const char MockLinkInfoBarDelegate::kMessage[] = "MockLinkInfoBarMessage "; const char MockLinkInfoBarDelegate::kLink[] = "http://dev.chromium.org"; diff --git a/chrome/browser/ui/cocoa/table_row_nsimage_cache.h b/chrome/browser/ui/cocoa/table_row_nsimage_cache.h index f6713fe..377b639 100644 --- a/chrome/browser/ui/cocoa/table_row_nsimage_cache.h +++ b/chrome/browser/ui/cocoa/table_row_nsimage_cache.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,7 +10,9 @@ #include "base/memory/scoped_nsobject.h" -class SkBitmap; +namespace gfx { +class ImageSkia; +} // There are several dialogs that display tabular data with one SkBitmap // per row. This class converts these SkBitmaps to NSImages on demand, and @@ -24,7 +26,7 @@ class TableRowNSImageCache { virtual int RowCount() const = 0; // Returns the icon of the |row|th row. - virtual SkBitmap GetIcon(int row) const = 0; + virtual gfx::ImageSkia GetIcon(int row) const = 0; protected: virtual ~Table() {} @@ -53,4 +55,3 @@ class TableRowNSImageCache { }; #endif // CHROME_BROWSER_UI_COCOA_TABLE_ROW_NSIMAGE_CACHE_H_ - diff --git a/chrome/browser/ui/cocoa/table_row_nsimage_cache.mm b/chrome/browser/ui/cocoa/table_row_nsimage_cache.mm index ff36a50..4a97811 100644 --- a/chrome/browser/ui/cocoa/table_row_nsimage_cache.mm +++ b/chrome/browser/ui/cocoa/table_row_nsimage_cache.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,7 +6,7 @@ #include "base/logging.h" #include "skia/ext/skia_utils_mac.h" -#include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/image/image_skia.h" TableRowNSImageCache::TableRowNSImageCache(Table* model) : model_(model), @@ -66,7 +66,7 @@ NSImage* TableRowNSImageCache::GetImageForRow(int row) { DCHECK_LT(row, static_cast<int>([icon_images_ count])); NSImage* image = static_cast<NSImage*>([icon_images_ pointerAtIndex:row]); if (!image) { - const SkBitmap bitmap_icon = + const gfx::ImageSkia bitmap_icon = model_->GetIcon(row); // This means GetIcon() will get called until it returns a non-empty bitmap. // Empty bitmaps are intentionally not cached. diff --git a/chrome/browser/ui/cocoa/table_row_nsimage_cache_unittest.mm b/chrome/browser/ui/cocoa/table_row_nsimage_cache_unittest.mm index ecca71e..8c60a6f 100644 --- a/chrome/browser/ui/cocoa/table_row_nsimage_cache_unittest.mm +++ b/chrome/browser/ui/cocoa/table_row_nsimage_cache_unittest.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/image/image_skia.h" namespace { @@ -20,8 +21,8 @@ class TestTable : public TableRowNSImageCache::Table { virtual int RowCount() const { return rows_.size(); } - virtual SkBitmap GetIcon(int index) const { - return rows_[index]; + virtual gfx::ImageSkia GetIcon(int index) const { + return gfx::ImageSkia(rows_[index]); } private: diff --git a/chrome/browser/ui/cocoa/task_manager_mac.h b/chrome/browser/ui/cocoa/task_manager_mac.h index 067e14e..bd83c13 100644 --- a/chrome/browser/ui/cocoa/task_manager_mac.h +++ b/chrome/browser/ui/cocoa/task_manager_mac.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,9 +15,12 @@ #include "chrome/browser/ui/cocoa/table_row_nsimage_cache.h" @class WindowSizeAutosaver; -class SkBitmap; class TaskManagerMac; +namespace gfx { +class ImageSkia; +} + // This class is responsible for loading the task manager window and for // managing it. @interface TaskManagerWindowController : @@ -85,7 +88,7 @@ class TaskManagerMac : public TaskManagerModelObserver, // TableRowNSImageCache::Table virtual int RowCount() const OVERRIDE; - virtual SkBitmap GetIcon(int r) const OVERRIDE; + virtual gfx::ImageSkia GetIcon(int r) const OVERRIDE; // Creates the task manager if it doesn't exist; otherwise, it activates the // existing task manager window. Highlights background resources if diff --git a/chrome/browser/ui/cocoa/task_manager_mac.mm b/chrome/browser/ui/cocoa/task_manager_mac.mm index cc31e27..94d3d3d 100644 --- a/chrome/browser/ui/cocoa/task_manager_mac.mm +++ b/chrome/browser/ui/cocoa/task_manager_mac.mm @@ -16,6 +16,7 @@ #include "grit/generated_resources.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/l10n/l10n_util_mac.h" +#include "ui/gfx/image/image_skia.h" namespace { @@ -624,7 +625,7 @@ int TaskManagerMac::RowCount() const { return model_->ResourceCount(); } -SkBitmap TaskManagerMac::GetIcon(int r) const { +gfx::ImageSkia TaskManagerMac::GetIcon(int r) const { return model_->GetResourceIcon(r); } diff --git a/chrome/browser/ui/cocoa/task_manager_mac_unittest.mm b/chrome/browser/ui/cocoa/task_manager_mac_unittest.mm index 0728257..8d3b8f3 100644 --- a/chrome/browser/ui/cocoa/task_manager_mac_unittest.mm +++ b/chrome/browser/ui/cocoa/task_manager_mac_unittest.mm @@ -13,7 +13,7 @@ #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" #include "testing/platform_test.h" -#include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/image/image_skia.h" namespace { @@ -22,7 +22,7 @@ class TestResource : public TaskManager::Resource { TestResource(const string16& title, pid_t pid) : title_(title), pid_(pid) {} virtual string16 GetTitle() const OVERRIDE { return title_; } virtual string16 GetProfileName() const OVERRIDE { return string16(); } - virtual SkBitmap GetIcon() const OVERRIDE { return SkBitmap(); } + virtual gfx::ImageSkia GetIcon() const OVERRIDE { return gfx::ImageSkia(); } virtual base::ProcessHandle GetProcess() const OVERRIDE { return pid_; } virtual int GetUniqueChildProcessId() const OVERRIDE { // In reality the unique child process ID is not the actual process ID, diff --git a/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc b/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc index 865e3cc..49caddb 100644 --- a/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc +++ b/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc @@ -40,7 +40,7 @@ const int kExtensionsPadding = kPermissionsPadding; const double kRatingTextSize = 12.1; // 12.1px = 9pt @ 96dpi // Adds a Skia image as an icon control to the given container. -void AddResourceIcon(const SkBitmap* icon, void* data) { +void AddResourceIcon(const gfx::ImageSkia* icon, void* data) { GtkWidget* container = static_cast<GtkWidget*>(data); GdkPixbuf* icon_pixbuf = gfx::GdkPixbufFromSkBitmap(*icon); GtkWidget* icon_widget = gtk_image_new_from_pixbuf(icon_pixbuf); diff --git a/chrome/browser/ui/gtk/speech_recognition_bubble_gtk.cc b/chrome/browser/ui/gtk/speech_recognition_bubble_gtk.cc index 5161ac7..4099503 100644 --- a/chrome/browser/ui/gtk/speech_recognition_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/speech_recognition_bubble_gtk.cc @@ -252,8 +252,8 @@ void SpeechRecognitionBubbleGtk::UpdateLayout() { gtk_widget_get_child_requisition(cancel_button_, &cancel_size); GtkRequisition label_size; gtk_widget_get_child_requisition(label_, &label_size); - SkBitmap* volume = ResourceBundle::GetSharedInstance().GetBitmapNamed( - IDR_SPEECH_INPUT_MIC_EMPTY); + gfx::ImageSkia* volume = ResourceBundle::GetSharedInstance(). + GetImageSkiaNamed(IDR_SPEECH_INPUT_MIC_EMPTY); int desired_width = std::max(volume->width(), cancel_size.width) + kIconHorizontalPadding * 2; int desired_height = volume->height() + label_size.height + @@ -274,7 +274,7 @@ void SpeechRecognitionBubbleGtk::UpdateLayout() { } void SpeechRecognitionBubbleGtk::UpdateImage() { - SkBitmap image = icon_image(); + gfx::ImageSkia image = icon_image(); if (image.isNull() || !bubble_) return; diff --git a/chrome/browser/ui/search_engines/template_url_table_model.cc b/chrome/browser/ui/search_engines/template_url_table_model.cc index 662c910c..280f386 100644 --- a/chrome/browser/ui/search_engines/template_url_table_model.cc +++ b/chrome/browser/ui/search_engines/template_url_table_model.cc @@ -32,7 +32,7 @@ static const int kOtherGroupID = 1; // ModelEntry also tracks state information about the URL. // Icon used while loading, or if a specific favicon can't be found. -static SkBitmap* default_icon = NULL; +static gfx::ImageSkia* default_icon = NULL; class ModelEntry { public: @@ -42,7 +42,7 @@ class ModelEntry { model_(model) { if (!default_icon) { default_icon = ResourceBundle::GetSharedInstance(). - GetBitmapNamed(IDR_DEFAULT_FAVICON); + GetImageSkiaNamed(IDR_DEFAULT_FAVICON); } } diff --git a/chrome/browser/ui/search_engines/template_url_table_model.h b/chrome/browser/ui/search_engines/template_url_table_model.h index 78dcb43..5af66d4 100644 --- a/chrome/browser/ui/search_engines/template_url_table_model.h +++ b/chrome/browser/ui/search_engines/template_url_table_model.h @@ -15,7 +15,6 @@ #include "ui/base/models/table_model.h" class ModelEntry; -class SkBitmap; class TemplateURL; class TemplateURLService; diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.cc b/chrome/browser/ui/toolbar/wrench_menu_model.cc index 6862298..a49787b 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_model.cc +++ b/chrome/browser/ui/toolbar/wrench_menu_model.cc @@ -46,12 +46,12 @@ #include "grit/chromium_strings.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/layout.h" #include "ui/base/models/button_menu_item_model.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image.h" +#include "ui/gfx/image/image_skia.h" #if defined(TOOLKIT_GTK) #include <gtk/gtk.h> @@ -494,7 +494,7 @@ void WrenchMenuModel::Build() { #if defined(OS_WIN) SetIcon(GetIndexOfCommandId(IDC_VIEW_INCOMPATIBILITIES), *ui::ResourceBundle::GetSharedInstance(). - GetBitmapNamed(IDR_CONFLICT_MENU)); + GetImageSkiaNamed(IDR_CONFLICT_MENU)); #endif if (!is_touch_menu) { @@ -503,7 +503,7 @@ void WrenchMenuModel::Build() { if (browser_defaults::kShowHelpMenuItemIcon) { ui::ResourceBundle& rb = ResourceBundle::GetSharedInstance(); SetIcon(GetIndexOfCommandId(IDC_HELP_PAGE), - *rb.GetBitmapNamed(IDR_HELP_MENU)); + *rb.GetImageSkiaNamed(IDR_HELP_MENU)); } } @@ -535,7 +535,7 @@ void WrenchMenuModel::AddGlobalErrorMenuItems() { if (icon_id) { gfx::Image& image = rb.GetImageNamed(icon_id); SetIcon(GetIndexOfCommandId(error->MenuItemCommandID()), - *image.ToSkBitmap()); + *image.ToImageSkia()); } } } diff --git a/chrome/browser/ui/views/about_chrome_view.cc b/chrome/browser/ui/views/about_chrome_view.cc index bd4c96d..8108e9b 100644 --- a/chrome/browser/ui/views/about_chrome_view.cc +++ b/chrome/browser/ui/views/about_chrome_view.cc @@ -148,15 +148,16 @@ void AboutChromeView::Init() { throbber_->set_owned_by_client(); throbber_->SetVisible(false); - SkBitmap* success_image = rb.GetBitmapNamed(IDR_UPDATE_UPTODATE); + gfx::ImageSkia* success_image = rb.GetImageSkiaNamed(IDR_UPDATE_UPTODATE); success_indicator_.SetImage(*success_image); success_indicator_.set_owned_by_client(); - SkBitmap* update_available_image = rb.GetBitmapNamed(IDR_UPDATE_AVAILABLE); + gfx::ImageSkia* update_available_image = rb.GetImageSkiaNamed( + IDR_UPDATE_AVAILABLE); update_available_indicator_.SetImage(*update_available_image); update_available_indicator_.set_owned_by_client(); - SkBitmap* timeout_image = rb.GetBitmapNamed(IDR_UPDATE_FAIL); + gfx::ImageSkia* timeout_image = rb.GetImageSkiaNamed(IDR_UPDATE_FAIL); timeout_indicator_.SetImage(*timeout_image); timeout_indicator_.set_owned_by_client(); @@ -164,12 +165,12 @@ void AboutChromeView::Init() { update_label_.set_owned_by_client(); // Regular view controls we draw by ourself. First, we add the background - // image for the dialog. We have two different background bitmaps, one for - // LTR UIs and one for RTL UIs. We load the correct bitmap based on the UI + // image for the dialog. We have two different background images, one for + // LTR UIs and one for RTL UIs. We load the correct image based on the UI // layout of the view. about_dlg_background_logo_ = new views::ImageView(); - SkBitmap* about_background_logo = rb.GetBitmapNamed(base::i18n::IsRTL() ? - IDR_ABOUT_BACKGROUND_RTL : IDR_ABOUT_BACKGROUND); + gfx::ImageSkia* about_background_logo = rb.GetImageSkiaNamed( + base::i18n::IsRTL() ? IDR_ABOUT_BACKGROUND_RTL : IDR_ABOUT_BACKGROUND); about_dlg_background_logo_->SetImage(*about_background_logo); AddChildView(about_dlg_background_logo_); @@ -425,8 +426,8 @@ void AboutChromeView::OnPaint(gfx::Canvas* canvas) { // Draw the background image color (and the separator) across the dialog. // This will become the background for the logo image at the top of the // dialog. - SkBitmap* background = ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( - IDR_ABOUT_BACKGROUND_COLOR); + gfx::ImageSkia* background = ui::ResourceBundle::GetSharedInstance(). + GetImageSkiaNamed(IDR_ABOUT_BACKGROUND_COLOR); canvas->TileImageInt(*background, 0, 0, dialog_dimensions_.width(), background->height()); diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc index 9a6c508..46f50f2 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc +++ b/chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc @@ -20,11 +20,11 @@ #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/native_theme/native_theme.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/text/text_elider.h" #include "ui/gfx/canvas.h" #include "ui/gfx/color_utils.h" -#include "ui/base/native_theme/native_theme.h" namespace { @@ -117,7 +117,8 @@ AutocompleteResultView::AutocompleteResultView( animation_(new ui::SlideAnimation(this))) { CHECK_GE(model_index, 0); if (default_icon_size_ == 0) { - default_icon_size_ = ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( + default_icon_size_ = + ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( AutocompleteMatch::TypeToIcon(AutocompleteMatch::URL_WHAT_YOU_TYPED))-> width(); } diff --git a/chrome/browser/ui/views/avatar_menu_bubble_view.cc b/chrome/browser/ui/views/avatar_menu_bubble_view.cc index fbcf0e0..f78fdb2 100644 --- a/chrome/browser/ui/views/avatar_menu_bubble_view.cc +++ b/chrome/browser/ui/views/avatar_menu_bubble_view.cc @@ -163,7 +163,7 @@ class ProfileItemView : public views::CustomButton, const AvatarMenuModel::Item& item() { return item_; } private: - static SkBitmap GetBadgedIcon(const SkBitmap& icon); + static gfx::ImageSkia GetBadgedIcon(const gfx::ImageSkia& icon); bool IsHighlighted(); @@ -180,9 +180,9 @@ ProfileItemView::ProfileItemView(const AvatarMenuModel::Item& item, : views::CustomButton(switch_profile_listener), item_(item) { image_view_ = new ProfileImageView(); - SkBitmap profile_icon = *item_.icon.ToSkBitmap(); + gfx::ImageSkia profile_icon = *item_.icon.ToImageSkia(); if (item_.active) { - SkBitmap badged_icon(GetBadgedIcon(profile_icon)); + gfx::ImageSkia badged_icon(GetBadgedIcon(profile_icon)); image_view_->SetImage(badged_icon); } else { image_view_->SetImage(profile_icon); @@ -241,7 +241,7 @@ void ProfileItemView::Layout() { icon_rect.set_size(image_view_->GetPreferredSize()); icon_rect.set_y((height() - icon_rect.height()) / 2); } else { - const SkBitmap& icon = image_view_->GetImage(); + const gfx::ImageSkia& icon = image_view_->GetImage(); icon_rect = GetCenteredAndScaledRect(icon.width(), icon.height(), 0, 0, profiles::kAvatarIconWidth, height()); } @@ -312,12 +312,13 @@ void ProfileItemView::OnFocusStateChanged(bool has_focus) { } // static -SkBitmap ProfileItemView::GetBadgedIcon(const SkBitmap& icon) { +gfx::ImageSkia ProfileItemView::GetBadgedIcon(const gfx::ImageSkia& icon) { gfx::Rect icon_rect = GetCenteredAndScaledRect(icon.width(), icon.height(), 0, 0, profiles::kAvatarIconWidth, kItemHeight); ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - const SkBitmap* badge = rb.GetImageNamed(IDR_PROFILE_SELECTED).ToSkBitmap(); + const gfx::ImageSkia* badge = rb.GetImageNamed( + IDR_PROFILE_SELECTED).ToImageSkia(); const float kBadgeOverlapRatioX = 1.0f / 5.0f; int width = icon_rect.width() + badge->width() * kBadgeOverlapRatioX; const float kBadgeOverlapRatioY = 1.0f / 3.0f; diff --git a/chrome/browser/ui/views/avatar_menu_button.cc b/chrome/browser/ui/views/avatar_menu_button.cc index 532f795..154c97f 100644 --- a/chrome/browser/ui/views/avatar_menu_button.cc +++ b/chrome/browser/ui/views/avatar_menu_button.cc @@ -69,7 +69,7 @@ void DrawTaskBarDecoration(gfx::NativeWindow window, const gfx::Image* image) { profiles::kAvatarIconWidth - x * 2, profiles::kAvatarIconHeight)); source_bitmap = &squarer_bitmap; } else { - // The bitmaps size has changed. Resize what we have. + // The image's size has changed. Resize what we have. source_bitmap = bitmap; } // Since the target size is so small, we use our best resizer. Never pass @@ -108,7 +108,7 @@ void AvatarMenuButton::OnPaint(gfx::Canvas* canvas) { if (old_height_ != height() || button_icon_.isNull()) { old_height_ = height(); button_icon_ = *profiles::GetAvatarIconForTitleBar( - *icon_, is_gaia_picture_, width(), height()).ToSkBitmap(); + *icon_, is_gaia_picture_, width(), height()).ToImageSkia(); } // Scale the image to fit the width of the button. @@ -141,7 +141,7 @@ bool AvatarMenuButton::HitTest(const gfx::Point& point) const { void AvatarMenuButton::SetAvatarIcon(const gfx::Image& icon, bool is_gaia_picture) { icon_.reset(new gfx::Image(icon)); - button_icon_ = SkBitmap(); + button_icon_ = gfx::ImageSkia(); is_gaia_picture_ = is_gaia_picture; SchedulePaint(); } diff --git a/chrome/browser/ui/views/avatar_menu_button.h b/chrome/browser/ui/views/avatar_menu_button.h index dbd8ffe..502cbb7 100644 --- a/chrome/browser/ui/views/avatar_menu_button.h +++ b/chrome/browser/ui/views/avatar_menu_button.h @@ -60,7 +60,7 @@ class AvatarMenuButton : public views::MenuButton, // Use a scoped ptr because gfx::Image doesn't have a default constructor. scoped_ptr<gfx::Image> icon_; - SkBitmap button_icon_; + gfx::ImageSkia button_icon_; bool is_gaia_picture_; int old_height_; diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc index 2c1c0c1..b23a163 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc @@ -94,10 +94,10 @@ const char BookmarkBarView::kViewClassName[] = static const int kButtonPadding = 0; // Icon to display when one isn't found for the page. -static SkBitmap* kDefaultFavicon = NULL; +static gfx::ImageSkia* kDefaultFavicon = NULL; // Icon used for folders. -static SkBitmap* kFolderIcon = NULL; +static gfx::ImageSkia* kFolderIcon = NULL; // Offset for where the menu is shown relative to the bottom of the // BookmarkBarView. @@ -358,11 +358,11 @@ const int BookmarkBarView::kNewtabVerticalPadding = 12; // static bool BookmarkBarView::testing_ = false; -// Returns the bitmap to use for starred folders. -static const SkBitmap& GetFolderIcon() { +// Returns the image to use for starred folders. +static const gfx::ImageSkia& GetFolderIcon() { if (!kFolderIcon) { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - kFolderIcon = rb.GetBitmapNamed(IDR_BOOKMARK_BAR_FOLDER); + kFolderIcon = rb.GetImageSkiaNamed(IDR_BOOKMARK_BAR_FOLDER); } return *kFolderIcon; } @@ -1120,7 +1120,7 @@ void BookmarkBarView::Init() { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); if (!kDefaultFavicon) - kDefaultFavicon = rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); + kDefaultFavicon = rb.GetImageSkiaNamed(IDR_DEFAULT_FAVICON); // Child views are traversed in the order they are added. Make sure the order // they are added matches the visual order. @@ -1195,7 +1195,7 @@ MenuButton* BookmarkBarView::CreateOtherBookmarkedButton() { MenuButton* BookmarkBarView::CreateOverflowButton() { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); MenuButton* button = new OverFlowButton(this); - button->SetIcon(*rb.GetBitmapNamed(IDR_BOOKMARK_BAR_CHEVRONS)); + button->SetIcon(*rb.GetImageSkiaNamed(IDR_BOOKMARK_BAR_CHEVRONS)); // The overflow button's image contains an arrow and therefore it is a // direction sensitive image and we need to flip it if the UI layout is diff --git a/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc b/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc index 371c6e9..882479c 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc @@ -436,7 +436,7 @@ void BookmarkMenuDelegate::BuildMenuForPermanentNode( int id = *next_menu_id; (*next_menu_id)++; ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - SkBitmap* folder_icon = rb.GetBitmapNamed(IDR_BOOKMARK_BAR_FOLDER); + gfx::ImageSkia* folder_icon = rb.GetImageSkiaNamed(IDR_BOOKMARK_BAR_FOLDER); MenuItemView* submenu = menu->AppendSubMenuWithIcon( id, node->GetTitle(), *folder_icon); BuildMenu(node, 0, submenu, next_menu_id); @@ -455,14 +455,16 @@ void BookmarkMenuDelegate::BuildMenu(const BookmarkNode* parent, (*next_menu_id)++; if (node->is_url()) { - SkBitmap icon = profile_->GetBookmarkModel()->GetFavicon(node); + gfx::ImageSkia icon = gfx::ImageSkia( + profile_->GetBookmarkModel()->GetFavicon(node)); if (icon.width() == 0) { - icon = *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); + icon = *rb.GetImageSkiaNamed(IDR_DEFAULT_FAVICON); } menu->AppendMenuItemWithIcon(id, node->GetTitle(), icon); node_to_menu_id_map_[node] = id; } else if (node->is_folder()) { - SkBitmap* folder_icon = rb.GetBitmapNamed(IDR_BOOKMARK_BAR_FOLDER); + gfx::ImageSkia* folder_icon = + rb.GetImageSkiaNamed(IDR_BOOKMARK_BAR_FOLDER); MenuItemView* submenu = menu->AppendSubMenuWithIcon( id, node->GetTitle(), *folder_icon); node_to_menu_id_map_[node] = id; diff --git a/chrome/browser/ui/views/constrained_window_views.cc b/chrome/browser/ui/views/constrained_window_views.cc index 0bb36ff..7f23ba6 100644 --- a/chrome/browser/ui/views/constrained_window_views.cc +++ b/chrome/browser/ui/views/constrained_window_views.cc @@ -61,7 +61,7 @@ namespace views { class ClientView; } -// An enumeration of bitmap resources used by this window. +// An enumeration of image resources used by this window. enum { FRAME_PART_IMAGE_FIRST = 0, // Must be first. @@ -291,7 +291,7 @@ ConstrainedWindowFrameView::ConstrainedWindowFrameView( InitWindowResources(); // Constrained windows always use the custom frame - they just have a - // different set of bitmaps. + // different set of images. container->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM); ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); diff --git a/chrome/browser/ui/views/detachable_toolbar_view.cc b/chrome/browser/ui/views/detachable_toolbar_view.cc index 026b7ea..c0a0e47 100644 --- a/chrome/browser/ui/views/detachable_toolbar_view.cc +++ b/chrome/browser/ui/views/detachable_toolbar_view.cc @@ -7,10 +7,10 @@ #include "chrome/browser/themes/theme_service.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkShader.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" +#include "ui/gfx/image/image_skia.h" #include "ui/gfx/skia_util.h" #include "ui/views/window/non_client_view.h" @@ -30,17 +30,18 @@ void DetachableToolbarView::PaintBackgroundAttachedMode( ui::ThemeProvider* tp = view->GetThemeProvider(); canvas->FillRect(view->GetLocalBounds(), tp->GetColor(ThemeService::COLOR_TOOLBAR)); - canvas->TileImageInt(*tp->GetBitmapNamed(IDR_THEME_TOOLBAR), + canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR), background_origin.x(), background_origin.y(), 0, 0, view->width(), view->height()); #if defined(USE_ASH) // Ash provides additional lightening at the edges of the toolbar. - SkBitmap* toolbar_left = tp->GetBitmapNamed(IDR_TOOLBAR_SHADE_LEFT); + gfx::ImageSkia* toolbar_left = tp->GetImageSkiaNamed(IDR_TOOLBAR_SHADE_LEFT); canvas->TileImageInt(*toolbar_left, 0, 0, 0, 0, toolbar_left->width(), view->height()); - SkBitmap* toolbar_right = tp->GetBitmapNamed(IDR_TOOLBAR_SHADE_RIGHT); + gfx::ImageSkia* toolbar_right = + tp->GetImageSkiaNamed(IDR_TOOLBAR_SHADE_RIGHT); canvas->TileImageInt(*toolbar_right, 0, 0, view->width() - toolbar_right->width(), 0, diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc index d0894f6..1dba4ef 100644 --- a/chrome/browser/ui/views/download/download_item_view.cc +++ b/chrome/browser/ui/views/download/download_item_view.cc @@ -109,75 +109,75 @@ DownloadItemView::DownloadItemView(DownloadItem* download, ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); BodyImageSet normal_body_image_set = { - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_LEFT_TOP), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_LEFT_MIDDLE), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_LEFT_BOTTOM), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_CENTER_TOP), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_CENTER_MIDDLE), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_CENTER_BOTTOM), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_RIGHT_TOP), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_RIGHT_MIDDLE), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_RIGHT_BOTTOM) + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_LEFT_TOP), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_LEFT_MIDDLE), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_LEFT_BOTTOM), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_CENTER_TOP), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_CENTER_MIDDLE), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_CENTER_BOTTOM), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_RIGHT_TOP), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_RIGHT_MIDDLE), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_RIGHT_BOTTOM) }; normal_body_image_set_ = normal_body_image_set; DropDownImageSet normal_drop_down_image_set = { - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_MENU_TOP), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_MENU_MIDDLE), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_MENU_BOTTOM) + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_MENU_TOP), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_MENU_MIDDLE), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_MENU_BOTTOM) }; normal_drop_down_image_set_ = normal_drop_down_image_set; BodyImageSet hot_body_image_set = { - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_LEFT_TOP_H), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_LEFT_MIDDLE_H), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_LEFT_BOTTOM_H), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_CENTER_TOP_H), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_CENTER_MIDDLE_H), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_CENTER_BOTTOM_H), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_RIGHT_TOP_H), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_RIGHT_MIDDLE_H), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_RIGHT_BOTTOM_H) + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_LEFT_TOP_H), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_LEFT_MIDDLE_H), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_LEFT_BOTTOM_H), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_CENTER_TOP_H), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_CENTER_MIDDLE_H), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_CENTER_BOTTOM_H), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_RIGHT_TOP_H), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_RIGHT_MIDDLE_H), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_RIGHT_BOTTOM_H) }; hot_body_image_set_ = hot_body_image_set; DropDownImageSet hot_drop_down_image_set = { - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_MENU_TOP_H), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_MENU_MIDDLE_H), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_MENU_BOTTOM_H) + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_MENU_TOP_H), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_MENU_MIDDLE_H), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_MENU_BOTTOM_H) }; hot_drop_down_image_set_ = hot_drop_down_image_set; BodyImageSet pushed_body_image_set = { - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_LEFT_TOP_P), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_LEFT_MIDDLE_P), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_LEFT_BOTTOM_P), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_CENTER_TOP_P), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_CENTER_MIDDLE_P), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_CENTER_BOTTOM_P), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_RIGHT_TOP_P), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_RIGHT_MIDDLE_P), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_RIGHT_BOTTOM_P) + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_LEFT_TOP_P), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_LEFT_MIDDLE_P), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_LEFT_BOTTOM_P), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_CENTER_TOP_P), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_CENTER_MIDDLE_P), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_CENTER_BOTTOM_P), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_RIGHT_TOP_P), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_RIGHT_MIDDLE_P), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_RIGHT_BOTTOM_P) }; pushed_body_image_set_ = pushed_body_image_set; DropDownImageSet pushed_drop_down_image_set = { - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_MENU_TOP_P), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_MENU_MIDDLE_P), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_MENU_BOTTOM_P) + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_MENU_TOP_P), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_MENU_MIDDLE_P), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_MENU_BOTTOM_P) }; pushed_drop_down_image_set_ = pushed_drop_down_image_set; BodyImageSet dangerous_mode_body_image_set = { - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_LEFT_TOP), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_LEFT_MIDDLE), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_LEFT_BOTTOM), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_CENTER_TOP), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_CENTER_MIDDLE), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_CENTER_BOTTOM), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_RIGHT_TOP_NO_DD), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_RIGHT_MIDDLE_NO_DD), - rb.GetBitmapNamed(IDR_DOWNLOAD_BUTTON_RIGHT_BOTTOM_NO_DD) + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_LEFT_TOP), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_LEFT_MIDDLE), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_LEFT_BOTTOM), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_CENTER_TOP), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_CENTER_MIDDLE), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_CENTER_BOTTOM), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_RIGHT_TOP_NO_DD), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_RIGHT_MIDDLE_NO_DD), + rb.GetImageSkiaNamed(IDR_DOWNLOAD_BUTTON_RIGHT_BOTTOM_NO_DD) }; dangerous_mode_body_image_set_ = dangerous_mode_body_image_set; @@ -738,20 +738,20 @@ void DownloadItemView::OnPaint(gfx::Canvas* canvas) { canvas->Translate(gfx::Point(width(), 0)); canvas->Scale(-1, 1); } - PaintBitmaps(canvas, - body_image_set->top_left, body_image_set->left, - body_image_set->bottom_left, - x, box_y_, box_height_, body_image_set->top_left->width()); + PaintImages(canvas, + body_image_set->top_left, body_image_set->left, + body_image_set->bottom_left, + x, box_y_, box_height_, body_image_set->top_left->width()); x += body_image_set->top_left->width(); - PaintBitmaps(canvas, - body_image_set->top, body_image_set->center, - body_image_set->bottom, - x, box_y_, box_height_, center_width); + PaintImages(canvas, + body_image_set->top, body_image_set->center, + body_image_set->bottom, + x, box_y_, box_height_, center_width); x += center_width; - PaintBitmaps(canvas, - body_image_set->top_right, body_image_set->right, - body_image_set->bottom_right, - x, box_y_, box_height_, body_image_set->top_right->width()); + PaintImages(canvas, + body_image_set->top_right, body_image_set->right, + body_image_set->bottom_right, + x, box_y_, box_height_, body_image_set->top_right->width()); // Overlay our body hot state. Warning dialogs don't display body a hot state. if (!IsShowingWarningDialog() && @@ -761,21 +761,21 @@ void DownloadItemView::OnPaint(gfx::Canvas* canvas) { canvas->sk_canvas()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); int x = kLeftPadding; - PaintBitmaps(canvas, - hot_body_image_set_.top_left, hot_body_image_set_.left, - hot_body_image_set_.bottom_left, - x, box_y_, box_height_, hot_body_image_set_.top_left->width()); + PaintImages(canvas, + hot_body_image_set_.top_left, hot_body_image_set_.left, + hot_body_image_set_.bottom_left, + x, box_y_, box_height_, hot_body_image_set_.top_left->width()); x += body_image_set->top_left->width(); - PaintBitmaps(canvas, - hot_body_image_set_.top, hot_body_image_set_.center, - hot_body_image_set_.bottom, - x, box_y_, box_height_, center_width); + PaintImages(canvas, + hot_body_image_set_.top, hot_body_image_set_.center, + hot_body_image_set_.bottom, + x, box_y_, box_height_, center_width); x += center_width; - PaintBitmaps(canvas, - hot_body_image_set_.top_right, hot_body_image_set_.right, - hot_body_image_set_.bottom_right, - x, box_y_, box_height_, - hot_body_image_set_.top_right->width()); + PaintImages(canvas, + hot_body_image_set_.top_right, hot_body_image_set_.right, + hot_body_image_set_.bottom_right, + x, box_y_, box_height_, + hot_body_image_set_.top_right->width()); canvas->Restore(); } @@ -783,10 +783,10 @@ void DownloadItemView::OnPaint(gfx::Canvas* canvas) { // Paint the drop-down. if (drop_down_image_set) { - PaintBitmaps(canvas, - drop_down_image_set->top, drop_down_image_set->center, - drop_down_image_set->bottom, - x, box_y_, box_height_, drop_down_image_set->top->width()); + PaintImages(canvas, + drop_down_image_set->top, drop_down_image_set->center, + drop_down_image_set->bottom, + x, box_y_, box_height_, drop_down_image_set->top->width()); // Overlay our drop-down hot state. if (drop_hover_animation_->GetCurrentValue() > 0) { @@ -794,10 +794,10 @@ void DownloadItemView::OnPaint(gfx::Canvas* canvas) { static_cast<int>(drop_hover_animation_->GetCurrentValue() * 255)); canvas->sk_canvas()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); - PaintBitmaps(canvas, - drop_down_image_set->top, drop_down_image_set->center, - drop_down_image_set->bottom, - x, box_y_, box_height_, drop_down_image_set->top->width()); + PaintImages(canvas, + drop_down_image_set->top, drop_down_image_set->center, + drop_down_image_set->bottom, + x, box_y_, box_height_, drop_down_image_set->top->width()); canvas->Restore(); } @@ -849,11 +849,11 @@ void DownloadItemView::OnPaint(gfx::Canvas* canvas) { IconManager* im = g_browser_process->icon_manager(); gfx::Image* image = im->LookupIcon(download_->GetUserVerifiedFilePath(), IconLoader::SMALL); - const SkBitmap* icon = NULL; + const gfx::ImageSkia* icon = NULL; if (IsShowingWarningDialog()) icon = warning_icon_; else if (image) - icon = image->ToSkBitmap(); + icon = image->ToImageSkia(); // We count on the fact that the icon manager will cache the icons and if one // is available, it will be cached here. We *don't* want to request the icon @@ -933,26 +933,26 @@ void DownloadItemView::LoadIconIfItemPathChanged() { // Load an icon for the file type we're downloading, and animate any in progress // download state. -void DownloadItemView::PaintBitmaps(gfx::Canvas* canvas, - const SkBitmap* top_bitmap, - const SkBitmap* center_bitmap, - const SkBitmap* bottom_bitmap, - int x, int y, int height, int width) { - int middle_height = height - top_bitmap->height() - bottom_bitmap->height(); +void DownloadItemView::PaintImages(gfx::Canvas* canvas, + const gfx::ImageSkia* top_image, + const gfx::ImageSkia* center_image, + const gfx::ImageSkia* bottom_image, + int x, int y, int height, int width) { + int middle_height = height - top_image->height() - bottom_image->height(); // Draw the top. - canvas->DrawBitmapInt(*top_bitmap, - 0, 0, top_bitmap->width(), top_bitmap->height(), - x, y, width, top_bitmap->height(), false); - y += top_bitmap->height(); + canvas->DrawBitmapInt(*top_image, + 0, 0, top_image->width(), top_image->height(), + x, y, width, top_image->height(), false); + y += top_image->height(); // Draw the center. - canvas->DrawBitmapInt(*center_bitmap, - 0, 0, center_bitmap->width(), center_bitmap->height(), + canvas->DrawBitmapInt(*center_image, + 0, 0, center_image->width(), center_image->height(), x, y, width, middle_height, false); y += middle_height; // Draw the bottom. - canvas->DrawBitmapInt(*bottom_bitmap, - 0, 0, bottom_bitmap->width(), bottom_bitmap->height(), - x, y, width, bottom_bitmap->height(), false); + canvas->DrawBitmapInt(*bottom_image, + 0, 0, bottom_image->width(), bottom_image->height(), + x, y, width, bottom_image->height(), false); } void DownloadItemView::SetState(State body_state, State drop_down_state) { @@ -1033,10 +1033,10 @@ void DownloadItemView::ShowWarningDialog() { // The dangerous download label text and icon are different under // different cases. if (mode_ == MALICIOUS_MODE) { - warning_icon_ = rb.GetBitmapNamed(IDR_SAFEBROWSING_WARNING); + warning_icon_ = rb.GetImageSkiaNamed(IDR_SAFEBROWSING_WARNING); } else { // The download file has dangerous file type (e.g.: an executable). - warning_icon_ = rb.GetBitmapNamed(IDR_WARNING); + warning_icon_ = rb.GetImageSkiaNamed(IDR_WARNING); } string16 dangerous_label = model_->GetWarningText(font_, kTextWidth); dangerous_download_label_ = new views::Label(dangerous_label); diff --git a/chrome/browser/ui/views/download/download_item_view.h b/chrome/browser/ui/views/download/download_item_view.h index 387ab47..342f538 100644 --- a/chrome/browser/ui/views/download/download_item_view.h +++ b/chrome/browser/ui/views/download/download_item_view.h @@ -37,11 +37,11 @@ class BaseDownloadItemModel; class DownloadShelfView; -class SkBitmap; class DownloadShelfContextMenuView; namespace gfx { class Image; +class ImageSkia; } namespace ui { @@ -120,22 +120,22 @@ class DownloadItemView : public views::ButtonListener, // The image set associated with the part containing the icon and text. struct BodyImageSet { - SkBitmap* top_left; - SkBitmap* left; - SkBitmap* bottom_left; - SkBitmap* top; - SkBitmap* center; - SkBitmap* bottom; - SkBitmap* top_right; - SkBitmap* right; - SkBitmap* bottom_right; + gfx::ImageSkia* top_left; + gfx::ImageSkia* left; + gfx::ImageSkia* bottom_left; + gfx::ImageSkia* top; + gfx::ImageSkia* center; + gfx::ImageSkia* bottom; + gfx::ImageSkia* top_right; + gfx::ImageSkia* right; + gfx::ImageSkia* bottom_right; }; // The image set associated with the drop-down button on the right. struct DropDownImageSet { - SkBitmap* top; - SkBitmap* center; - SkBitmap* bottom; + gfx::ImageSkia* top; + gfx::ImageSkia* center; + gfx::ImageSkia* bottom; }; void OpenDownload(); @@ -143,12 +143,12 @@ class DownloadItemView : public views::ButtonListener, void LoadIcon(); void LoadIconIfItemPathChanged(); - // Convenience method to paint the 3 vertical bitmaps (bottom, middle, top) + // Convenience method to paint the 3 vertical images (bottom, middle, top) // that form the background. - void PaintBitmaps(gfx::Canvas* canvas, - const SkBitmap* top_bitmap, - const SkBitmap* center_bitmap, - const SkBitmap* bottom_bitmap, + void PaintImages(gfx::Canvas* canvas, + const gfx::ImageSkia* top_image, + const gfx::ImageSkia* center_image, + const gfx::ImageSkia* bottom_image, int x, int y, int height, @@ -208,7 +208,7 @@ class DownloadItemView : public views::ButtonListener, DropDownImageSet pushed_drop_down_image_set_; // The warning icon showns for dangerous downloads. - const SkBitmap* warning_icon_; + const gfx::ImageSkia* warning_icon_; // The model we query for display information content::DownloadItem* download_; diff --git a/chrome/browser/ui/views/dropdown_bar_view.cc b/chrome/browser/ui/views/dropdown_bar_view.cc index 42e1f3b..4ef555b 100644 --- a/chrome/browser/ui/views/dropdown_bar_view.cc +++ b/chrome/browser/ui/views/dropdown_bar_view.cc @@ -63,7 +63,7 @@ void DropdownBackground::Paint(gfx::Canvas* canvas, views::View* view) const { origin = browser_view_->OffsetPointForToolbarBackgroundImage(origin); ui::ThemeProvider* tp = view->GetThemeProvider(); - SkBitmap background = *tp->GetBitmapNamed(IDR_THEME_TOOLBAR); + gfx::ImageSkia background = *tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR); int left_edge_width = left_alpha_mask_->width(); int right_edge_width = right_alpha_mask_->width(); @@ -129,11 +129,11 @@ void DropdownBarView::SetBackground(const gfx::ImageSkia* left_alpha_mask, right_alpha_mask)); } -void DropdownBarView::SetBorder(int left_border_bitmap_id, - int middle_border_bitmap_id, - int right_border_bitmap_id) { - int border_bitmap_ids[3] = {left_border_bitmap_id, middle_border_bitmap_id, - right_border_bitmap_id}; +void DropdownBarView::SetBorder(int left_border_image_id, + int middle_border_image_id, + int right_border_image_id) { + int border_image_ids[3] = {left_border_image_id, middle_border_image_id, + right_border_image_id}; set_border(views::Border::CreateBorderPainter( - new views::HorizontalPainter(border_bitmap_ids))); + new views::HorizontalPainter(border_image_ids))); } diff --git a/chrome/browser/ui/views/dropdown_bar_view.h b/chrome/browser/ui/views/dropdown_bar_view.h index a8b7c01..25257a0 100644 --- a/chrome/browser/ui/views/dropdown_bar_view.h +++ b/chrome/browser/ui/views/dropdown_bar_view.h @@ -43,8 +43,8 @@ class DropdownBarView : public views::AccessiblePaneView, void SetBackground(const gfx::ImageSkia* left_alpha_mask, const gfx::ImageSkia* right_alpha_mask); - void SetBorder(int left_border_bitmap_id, int middle_border_bitmap_id, - int right_border_bitmap_id); + void SetBorder(int left_border_image_id, int middle_border_image_id, + int right_border_image_id); private: // The dropdown bar host that controls this view. diff --git a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc index 6b348bd..9b51512 100644 --- a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc +++ b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc @@ -62,7 +62,7 @@ const int kHeadingFontSizeDelta = 1; const int kRatingFontSizeDelta = -1; -void AddResourceIcon(const SkBitmap* skia_image, void* data) { +void AddResourceIcon(const gfx::ImageSkia* skia_image, void* data) { views::View* parent = static_cast<views::View*>(data); views::ImageView* image_view = new views::ImageView(); image_view->SetImage(*skia_image); @@ -184,13 +184,13 @@ ExtensionInstallDialogView::ExtensionInstallDialogView( if (!is_bundle_install()) { // Scale down to icon size, but allow smaller icons (don't scale up). - const SkBitmap* bitmap = prompt.icon().ToSkBitmap(); - gfx::Size size(bitmap->width(), bitmap->height()); + const gfx::ImageSkia* image = prompt.icon().ToImageSkia(); + gfx::Size size(image->width(), image->height()); if (size.width() > kIconSize || size.height() > kIconSize) size = gfx::Size(kIconSize, kIconSize); views::ImageView* icon = new views::ImageView(); icon->SetImageSize(size); - icon->SetImage(*bitmap); + icon->SetImage(*image); icon->SetHorizontalAlignment(views::ImageView::CENTER); icon->SetVerticalAlignment(views::ImageView::CENTER); int icon_row_span = 1; diff --git a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc index 75d0fed..0da9d4a 100644 --- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc +++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc @@ -81,7 +81,7 @@ class ExtensionUninstallDialogDelegateView : public views::DialogDelegateView { ExtensionUninstallDialogDelegateView( ExtensionUninstallDialogViews* dialog_view, const extensions::Extension* extension, - SkBitmap* icon); + gfx::ImageSkia* icon); virtual ~ExtensionUninstallDialogDelegateView(); // Called when the ExtensionUninstallDialog has been destroyed to make sure @@ -157,7 +157,7 @@ void ExtensionUninstallDialogViews::ExtensionUninstallCanceled() { ExtensionUninstallDialogDelegateView::ExtensionUninstallDialogDelegateView( ExtensionUninstallDialogViews* dialog_view, const extensions::Extension* extension, - SkBitmap* icon) + gfx::ImageSkia* icon) : dialog_(dialog_view) { // Scale down to icon size, but allow smaller icons (don't scale up). gfx::Size size(icon->width(), icon->height()); diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc index 34695e0..dd92b6c 100644 --- a/chrome/browser/ui/views/find_bar_view.cc +++ b/chrome/browser/ui/views/find_bar_view.cc @@ -147,11 +147,12 @@ FindBarView::FindBarView(FindBarHost* host) SetBorder(IDR_FIND_DIALOG_LEFT, IDR_FIND_DIALOG_MIDDLE, IDR_FIND_DIALOG_RIGHT); - preferred_height_ = rb.GetBitmapNamed(IDR_FIND_DIALOG_MIDDLE)->height(); + preferred_height_ = rb.GetImageSkiaNamed(IDR_FIND_DIALOG_MIDDLE)->height(); // Background images for the Find edit box. - text_box_background_ = rb.GetBitmapNamed(IDR_FIND_BOX_BACKGROUND); - text_box_background_left_ = rb.GetBitmapNamed(IDR_FIND_BOX_BACKGROUND_LEFT); + text_box_background_ = rb.GetImageSkiaNamed(IDR_FIND_BOX_BACKGROUND); + text_box_background_left_ = + rb.GetImageSkiaNamed(IDR_FIND_BOX_BACKGROUND_LEFT); EnableCanvasFlippingForRTLUI(true); } diff --git a/chrome/browser/ui/views/find_bar_view.h b/chrome/browser/ui/views/find_bar_view.h index 5ccfedb..fcc704f 100644 --- a/chrome/browser/ui/views/find_bar_view.h +++ b/chrome/browser/ui/views/find_bar_view.h @@ -140,10 +140,10 @@ class FindBarView : public DropdownBarView, // The background image for the Find text box, which we draw behind the Find // box to provide the Chrome look to the edge of the text box. - const SkBitmap* text_box_background_; + const gfx::ImageSkia* text_box_background_; // The rounded edge on the left side of the Find text box. - const SkBitmap* text_box_background_left_; + const gfx::ImageSkia* text_box_background_left_; DISALLOW_COPY_AND_ASSIGN(FindBarView); }; diff --git a/chrome/browser/ui/views/infobars/extension_infobar.cc b/chrome/browser/ui/views/infobars/extension_infobar.cc index 646ec46..0811dd7 100644 --- a/chrome/browser/ui/views/infobars/extension_infobar.cc +++ b/chrome/browser/ui/views/infobars/extension_infobar.cc @@ -108,18 +108,19 @@ void ExtensionInfoBar::OnImageLoaded(const gfx::Image& image, if (!GetDelegate()) return; // The delegate can go away while we asynchronously load images. - const SkBitmap* icon = NULL; + const gfx::ImageSkia* icon = NULL; // Fall back on the default extension icon on failure. ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); if (image.IsEmpty()) - icon = rb.GetImageNamed(IDR_EXTENSIONS_SECTION).ToSkBitmap(); + icon = rb.GetImageNamed(IDR_EXTENSIONS_SECTION).ToImageSkia(); else - icon = image.ToSkBitmap(); + icon = image.ToImageSkia(); - const SkBitmap* drop_image = rb.GetImageNamed(IDR_APP_DROPARROW).ToSkBitmap(); + const gfx::ImageSkia* drop_image = + rb.GetImageNamed(IDR_APP_DROPARROW).ToImageSkia(); int image_size = ExtensionIconSet::EXTENSION_ICON_BITTY; - // The margin between the extension icon and the drop-down arrow bitmap. + // The margin between the extension icon and the drop-down arrow image. static const int kDropArrowLeftMargin = 3; scoped_ptr<gfx::Canvas> canvas(new gfx::Canvas( gfx::Size(image_size + kDropArrowLeftMargin + drop_image->width(), diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc index 2df74e6..540180c 100644 --- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc +++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc @@ -58,8 +58,8 @@ void IconLabelBubbleView::SetLabel(const string16& label) { label_->SetText(label); } -void IconLabelBubbleView::SetImage(const SkBitmap& bitmap) { - image_->SetImage(bitmap); +void IconLabelBubbleView::SetImage(const gfx::ImageSkia& image_skia) { + image_->SetImage(image_skia); } void IconLabelBubbleView::OnPaint(gfx::Canvas* canvas) { @@ -92,7 +92,7 @@ gfx::Size IconLabelBubbleView::GetNonLabelSize() const { int IconLabelBubbleView::GetPreLabelWidth() const { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); return GetBubbleOuterPadding() + - rb.GetBitmapNamed(IDR_OMNIBOX_SEARCH)->width() + + rb.GetImageSkiaNamed(IDR_OMNIBOX_SEARCH)->width() + LocationBarView::GetItemPadding(); } diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h index 0764c85..55f03f1 100644 --- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h +++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h @@ -16,14 +16,14 @@ namespace gfx { class Canvas; class Font; +class ImageSkia; } + namespace views { class ImageView; class Label; } -class SkBitmap; - // View used to draw a bubble to the left of the address, containing an icon and // a label. We use this as a base for the classes that handle the EV bubble and // tab-to-search UI. @@ -36,7 +36,7 @@ class IconLabelBubbleView : public views::View { void SetFont(const gfx::Font& font); void SetLabel(const string16& label); - void SetImage(const SkBitmap& bitmap); + void SetImage(const gfx::ImageSkia& image); void set_is_extension_icon(bool is_extension_icon) { is_extension_icon_ = is_extension_icon; } diff --git a/chrome/browser/ui/views/location_bar/keyword_hint_view.cc b/chrome/browser/ui/views/location_bar/keyword_hint_view.cc index d514f94..686cc62 100644 --- a/chrome/browser/ui/views/location_bar/keyword_hint_view.cc +++ b/chrome/browser/ui/views/location_bar/keyword_hint_view.cc @@ -15,25 +15,25 @@ #include "chrome/browser/ui/views/location_bar/location_bar_view.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/gfx/canvas.h" +#include "ui/gfx/image/image_skia.h" #include "ui/views/controls/label.h" // Amount of space to offset the tab image from the top of the view by. static const int kTabImageYOffset = 4; // The tab key image. -static const SkBitmap* kTabButtonBitmap = NULL; +static const gfx::ImageSkia* kTabButtonImage = NULL; KeywordHintView::KeywordHintView(Profile* profile) : profile_(profile) { leading_label_ = CreateLabel(); trailing_label_ = CreateLabel(); - if (!kTabButtonBitmap) { + if (!kTabButtonImage) { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - kTabButtonBitmap = rb.GetBitmapNamed(IDR_LOCATION_BAR_KEYWORD_HINT_TAB); + kTabButtonImage = rb.GetImageSkiaNamed(IDR_LOCATION_BAR_KEYWORD_HINT_TAB); } } @@ -85,10 +85,10 @@ void KeywordHintView::OnPaint(gfx::Canvas* canvas) { // is right-to-left. gfx::Rect tab_button_bounds(image_x, kTabImageYOffset, - kTabButtonBitmap->width(), - kTabButtonBitmap->height()); + kTabButtonImage->width(), + kTabButtonImage->height()); tab_button_bounds.set_x(GetMirroredXForRect(tab_button_bounds)); - canvas->DrawBitmapInt(*kTabButtonBitmap, + canvas->DrawBitmapInt(*kTabButtonImage, tab_button_bounds.x(), tab_button_bounds.y()); } @@ -98,7 +98,7 @@ gfx::Size KeywordHintView::GetPreferredSize() { // added this should check baselines. gfx::Size prefsize = leading_label_->GetPreferredSize(); int width = prefsize.width(); - width += kTabButtonBitmap->width(); + width += kTabButtonImage->width(); prefsize = trailing_label_->GetPreferredSize(); width += prefsize.width(); return gfx::Size(width, prefsize.height()); @@ -107,12 +107,12 @@ gfx::Size KeywordHintView::GetPreferredSize() { gfx::Size KeywordHintView::GetMinimumSize() { // TODO(sky): currently height doesn't matter, once baseline support is // added this should check baselines. - return gfx::Size(kTabButtonBitmap->width(), 0); + return gfx::Size(kTabButtonImage->width(), 0); } void KeywordHintView::Layout() { // TODO(sky): baseline layout. - bool show_labels = (width() != kTabButtonBitmap->width()); + bool show_labels = (width() != kTabButtonImage->width()); leading_label_->SetVisible(show_labels); trailing_label_->SetVisible(show_labels); @@ -123,7 +123,7 @@ void KeywordHintView::Layout() { pref = leading_label_->GetPreferredSize(); leading_label_->SetBounds(x, 0, pref.width(), height()); - x += pref.width() + kTabButtonBitmap->width(); + x += pref.width() + kTabButtonImage->width(); pref = trailing_label_->GetPreferredSize(); trailing_label_->SetBounds(x, 0, pref.width(), height()); } diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index 0a5408f..96b3072 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -160,7 +160,7 @@ LocationBarView::LocationBarView(Profile* profile, painter_.reset( views::Painter::CreateImagePainter( *ui::ResourceBundle::GetSharedInstance().GetImageNamed( - IDR_LOCATION_BAR_BORDER).ToSkBitmap(), + IDR_LOCATION_BAR_BORDER).ToImageSkia(), gfx::Insets(kBorderRoundCornerHeight, kBorderRoundCornerWidth, kBorderRoundCornerHeight, kBorderRoundCornerWidth), true)); @@ -518,7 +518,7 @@ bool LocationBarView::IsLocationEntryFocusableInRootView() const { } gfx::Size LocationBarView::GetPreferredSize() { - return gfx::Size(0, GetThemeProvider()->GetBitmapNamed(mode_ == POPUP ? + return gfx::Size(0, GetThemeProvider()->GetImageSkiaNamed(mode_ == POPUP ? IDR_LOCATIONBG_POPUPMODE_CENTER : IDR_LOCATIONBG_C)->height()); } @@ -781,7 +781,7 @@ void LocationBarView::OnPaint(gfx::Canvas* canvas) { if (painter_.get()) { painter_->Paint(canvas, size()); } else if (mode_ == POPUP) { - canvas->TileImageInt(*GetThemeProvider()->GetBitmapNamed( + canvas->TileImageInt(*GetThemeProvider()->GetImageSkiaNamed( IDR_LOCATIONBG_POPUPMODE_CENTER), 0, 0, 0, 0, width(), height()); } // When used in the app launcher, don't draw a border, the LocationBarView has diff --git a/chrome/browser/ui/views/menu_item_view_test.cc b/chrome/browser/ui/views/menu_item_view_test.cc index 352f27f..d2f6c19 100644 --- a/chrome/browser/ui/views/menu_item_view_test.cc +++ b/chrome/browser/ui/views/menu_item_view_test.cc @@ -215,7 +215,7 @@ class MenuItemViewTestInsert : public MenuItemViewTestBase { inserted_item_ = menu_->AddMenuItemAt(INSERT_INDEX, 1000, ASCIIToUTF16("inserted item"), - SkBitmap(), + gfx::ImageSkia(), views::MenuItemView::NORMAL); ASSERT_TRUE(inserted_item_); menu_->ChildrenChanged(); @@ -325,7 +325,7 @@ class MenuItemViewTestInsertWithSubmenu : public MenuItemViewTestBase { inserted_item_ = menu_->AddMenuItemAt(INSERT_INDEX, 1000, ASCIIToUTF16("inserted item"), - SkBitmap(), + gfx::ImageSkia(), views::MenuItemView::NORMAL); ASSERT_TRUE(inserted_item_); menu_->ChildrenChanged(); diff --git a/chrome/browser/ui/views/notifications/balloon_view.cc b/chrome/browser/ui/views/notifications/balloon_view.cc index 9644487..dc97e9b 100644 --- a/chrome/browser/ui/views/notifications/balloon_view.cc +++ b/chrome/browser/ui/views/notifications/balloon_view.cc @@ -390,9 +390,11 @@ void BalloonViewImpl::Show(Balloon* balloon) { rb.GetImageSkiaNamed(IDR_TAB_CLOSE), rb.GetImageSkiaNamed(IDR_TAB_CLOSE_MASK)); - options_menu_button_->SetIcon(*rb.GetBitmapNamed(IDR_BALLOON_WRENCH)); - options_menu_button_->SetHoverIcon(*rb.GetBitmapNamed(IDR_BALLOON_WRENCH_H)); - options_menu_button_->SetPushedIcon(*rb.GetBitmapNamed(IDR_BALLOON_WRENCH_P)); + options_menu_button_->SetIcon(*rb.GetImageSkiaNamed(IDR_BALLOON_WRENCH)); + options_menu_button_->SetHoverIcon( + *rb.GetImageSkiaNamed(IDR_BALLOON_WRENCH_H)); + options_menu_button_->SetPushedIcon(*rb.GetImageSkiaNamed( + IDR_BALLOON_WRENCH_P)); options_menu_button_->set_alignment(views::TextButton::ALIGN_CENTER); options_menu_button_->set_border(NULL); options_menu_button_->SetBoundsRect(GetOptionsButtonBounds()); diff --git a/chrome/browser/ui/views/page_info_bubble_view.cc b/chrome/browser/ui/views/page_info_bubble_view.cc index 5456668..c4e0bc7 100644 --- a/chrome/browser/ui/views/page_info_bubble_view.cc +++ b/chrome/browser/ui/views/page_info_bubble_view.cc @@ -55,7 +55,7 @@ class Section : public views::View, public: Section(PageInfoBubbleView* owner, const PageInfoModel::SectionInfo& section_info, - const SkBitmap* status_icon, + const gfx::ImageSkia* status_icon, bool show_cert); virtual ~Section(); @@ -191,7 +191,8 @@ void PageInfoBubbleView::LayoutSections() { if (count == 1 && info.type == PageInfoModel::SECTION_INFO_INTERNAL_PAGE) only_internal_section = true; layout->StartRow(0, 0); - const SkBitmap* icon = model_.GetIconImage(info.icon_id)->ToSkBitmap(); + const gfx::ImageSkia* icon = model_.GetIconImage( + info.icon_id)->ToImageSkia(); Section* section = new Section(this, info, icon, cert_id_ > 0); if (info.type == PageInfoModel::SECTION_INFO_FIRST_VISIT) { // This section is animated into view, so we need to set the height of it @@ -239,7 +240,8 @@ gfx::Size PageInfoBubbleView::GetPreferredSize() { int count = model_.GetSectionCount(); for (int i = 0; i < count; ++i) { PageInfoModel::SectionInfo info = model_.GetSectionInfo(i); - const SkBitmap* icon = model_.GetIconImage(info.icon_id)->ToSkBitmap(); + const gfx::ImageSkia* icon = model_.GetIconImage( + info.icon_id)->ToImageSkia(); Section section(this, info, icon, cert_id_ > 0); size.Enlarge(0, section.GetHeightForWidth(size.width())); } @@ -313,7 +315,7 @@ void PageInfoBubbleView::AnimationProgressed(const ui::Animation* animation) { Section::Section(PageInfoBubbleView* owner, const PageInfoModel::SectionInfo& section_info, - const SkBitmap* state_icon, + const gfx::ImageSkia* state_icon, bool show_cert) : owner_(owner), info_(section_info), diff --git a/chrome/browser/ui/views/speech_recognition_bubble_views.cc b/chrome/browser/ui/views/speech_recognition_bubble_views.cc index 913b4ea..1a6f738 100644 --- a/chrome/browser/ui/views/speech_recognition_bubble_views.cc +++ b/chrome/browser/ui/views/speech_recognition_bubble_views.cc @@ -51,8 +51,8 @@ class SpeechRecognitionBubbleView void UpdateLayout(SpeechRecognitionBubbleBase::DisplayMode mode, const string16& message_text, - const SkBitmap& image); - void SetImage(const SkBitmap& image); + const gfx::ImageSkia& image); + void SetImage(const gfx::ImageSkia& image); // views::BubbleDelegateView methods. virtual void OnWidgetActivationChanged(views::Widget* widget, @@ -109,7 +109,7 @@ SpeechRecognitionBubbleView::SpeechRecognitionBubbleView( cancel_(NULL), mic_settings_(NULL), display_mode_(SpeechRecognitionBubbleBase::DISPLAY_MODE_WARM_UP), - kIconLayoutMinWidth(ResourceBundle::GetSharedInstance().GetBitmapNamed( + kIconLayoutMinWidth(ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_SPEECH_INPUT_MIC_EMPTY)->width()) { // The bubble lifetime is managed by its controller; closing on escape or // explicitly closing on deactivation will cause unexpected behavior. @@ -175,7 +175,7 @@ void SpeechRecognitionBubbleView::Init() { void SpeechRecognitionBubbleView::UpdateLayout( SpeechRecognitionBubbleBase::DisplayMode mode, const string16& message_text, - const SkBitmap& image) { + const gfx::ImageSkia& image) { display_mode_ = mode; bool is_message = (mode == SpeechRecognitionBubbleBase::DISPLAY_MODE_MESSAGE); icon_->SetVisible(!is_message); @@ -210,7 +210,7 @@ void SpeechRecognitionBubbleView::UpdateLayout( SizeToContents(); } -void SpeechRecognitionBubbleView::SetImage(const SkBitmap& image) { +void SpeechRecognitionBubbleView::SetImage(const gfx::ImageSkia& image) { icon_->SetImage(image); } diff --git a/chrome/browser/ui/views/tab_icon_view.cc b/chrome/browser/ui/views/tab_icon_view.cc index 748b3aa..800a163 100644 --- a/chrome/browser/ui/views/tab_icon_view.cc +++ b/chrome/browser/ui/views/tab_icon_view.cc @@ -11,6 +11,7 @@ #include "base/file_util.h" #include "base/logging.h" +#include "base/memory/scoped_ptr.h" #include "chrome/app/chrome_command_ids.h" #include "grit/theme_resources.h" #include "grit/ui_resources.h" @@ -26,7 +27,7 @@ #endif static bool g_initialized = false; -static SkBitmap* g_default_favicon = NULL; +static gfx::ImageSkia* g_default_favicon = NULL; // static void TabIconView::InitializeIfNeeded() { @@ -37,12 +38,13 @@ void TabIconView::InitializeIfNeeded() { // The default window icon is the application icon, not the default // favicon. HICON app_icon = GetAppIcon(); - g_default_favicon = - IconUtil::CreateSkBitmapFromHICON(app_icon, gfx::Size(16, 16)); + scoped_ptr<SkBitmap> bitmap( + IconUtil::CreateSkBitmapFromHICON(app_icon, gfx::Size(16, 16))); + g_default_favicon = new gfx::ImageSkia(*bitmap); DestroyIcon(app_icon); #else ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - g_default_favicon = rb.GetBitmapNamed(IDR_PRODUCT_LOGO_16); + g_default_favicon = rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_16); #endif } } @@ -63,8 +65,8 @@ void TabIconView::Update() { static int throbber_frame_count = 0; if (!initialized) { initialized = true; - SkBitmap throbber( - *ui::ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_THROBBER)); + gfx::ImageSkia throbber(*ui::ResourceBundle::GetSharedInstance(). + GetImageSkiaNamed(IDR_THROBBER)); throbber_frame_count = throbber.width() / throbber.height(); } @@ -90,19 +92,19 @@ void TabIconView::Update() { } void TabIconView::PaintThrobber(gfx::Canvas* canvas) { - SkBitmap throbber(*GetThemeProvider()->GetBitmapNamed( + gfx::ImageSkia throbber(*GetThemeProvider()->GetImageSkiaNamed( is_light_ ? IDR_THROBBER_LIGHT : IDR_THROBBER)); int image_size = throbber.height(); PaintIcon(canvas, throbber, throbber_frame_ * image_size, 0, image_size, image_size, false); } -void TabIconView::PaintFavicon(gfx::Canvas* canvas, const SkBitmap& bitmap) { - PaintIcon(canvas, bitmap, 0, 0, bitmap.width(), bitmap.height(), true); +void TabIconView::PaintFavicon(gfx::Canvas* canvas, const SkBitmap& image) { + PaintIcon(canvas, image, 0, 0, image.width(), image.height(), true); } void TabIconView::PaintIcon(gfx::Canvas* canvas, - const SkBitmap& bitmap, + const gfx::ImageSkia& image, int src_x, int src_y, int src_w, @@ -128,7 +130,7 @@ void TabIconView::PaintIcon(gfx::Canvas* canvas, int dest_h = static_cast<int>(float_src_h * scale); // Center the scaled image. - canvas->DrawBitmapInt(bitmap, src_x, src_y, src_w, src_h, + canvas->DrawBitmapInt(image, src_x, src_y, src_w, src_h, (width() - dest_w) / 2, (height() - dest_h) / 2, dest_w, dest_h, filter); } diff --git a/chrome/browser/ui/views/tab_icon_view.h b/chrome/browser/ui/views/tab_icon_view.h index ffbc8c5..b807790 100644 --- a/chrome/browser/ui/views/tab_icon_view.h +++ b/chrome/browser/ui/views/tab_icon_view.h @@ -9,6 +9,8 @@ #include "base/compiler_specific.h" #include "ui/views/view.h" +class SkBitmap; + namespace gfx { class ImageSkia; } @@ -49,7 +51,7 @@ class TabIconView : public views::View { void PaintThrobber(gfx::Canvas* canvas); void PaintFavicon(gfx::Canvas* canvas, const SkBitmap& bitmap); void PaintIcon(gfx::Canvas* canvas, - const SkBitmap& bitmap, + const gfx::ImageSkia& image, int src_x, int src_y, int src_w, diff --git a/chrome/browser/ui/views/tabs/base_tab.cc b/chrome/browser/ui/views/tabs/base_tab.cc index 7f87bae..34d7dca 100644 --- a/chrome/browser/ui/views/tabs/base_tab.cc +++ b/chrome/browser/ui/views/tabs/base_tab.cc @@ -93,7 +93,7 @@ namespace { // Draws the icon image at the center of |bounds|. void DrawIconCenter(gfx::Canvas* canvas, - const SkBitmap& image, + const gfx::ImageSkia& image, int image_offset, int icon_width, int icon_height, @@ -422,10 +422,11 @@ void BaseTab::AdvanceLoadingAnimation(TabRendererData::NetworkState old_state, if (!initialized) { initialized = true; ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - SkBitmap loading_animation(*rb.GetBitmapNamed(IDR_THROBBER)); + gfx::ImageSkia loading_animation(*rb.GetImageSkiaNamed(IDR_THROBBER)); loading_animation_frame_count = loading_animation.width() / loading_animation.height(); - SkBitmap waiting_animation(*rb.GetBitmapNamed(IDR_THROBBER_WAITING)); + gfx::ImageSkia waiting_animation(*rb.GetImageSkiaNamed( + IDR_THROBBER_WAITING)); waiting_animation_frame_count = waiting_animation.width() / waiting_animation.height(); waiting_to_loading_frame_count_ratio = @@ -460,7 +461,7 @@ void BaseTab::PaintIcon(gfx::Canvas* canvas) { if (data().network_state != TabRendererData::NETWORK_STATE_NONE) { ui::ThemeProvider* tp = GetThemeProvider(); - SkBitmap frames(*tp->GetBitmapNamed( + gfx::ImageSkia frames(*tp->GetImageSkiaNamed( (data().network_state == TabRendererData::NETWORK_STATE_WAITING) ? IDR_THROBBER_WAITING : IDR_THROBBER)); @@ -473,7 +474,7 @@ void BaseTab::PaintIcon(gfx::Canvas* canvas) { canvas->ClipRect(GetLocalBounds()); if (should_display_crashed_favicon_) { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - SkBitmap crashed_favicon(*rb.GetBitmapNamed(IDR_SAD_FAVICON)); + gfx::ImageSkia crashed_favicon(*rb.GetImageSkiaNamed(IDR_SAD_FAVICON)); bounds.set_y(bounds.y() + favicon_hiding_offset_); DrawIconCenter(canvas, crashed_favicon, 0, crashed_favicon.width(), diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc index 2056aac..4e0cfd1 100644 --- a/chrome/browser/ui/views/tabs/tab.cc +++ b/chrome/browser/ui/views/tabs/tab.cc @@ -262,7 +262,7 @@ gfx::Size Tab::GetBasicMinimumUnselectedSize() { gfx::Size minimum_size; minimum_size.set_width(left_padding() + right_padding()); - // Since we use bitmap images, the real minimum height of the image is + // Since we use image images, the real minimum height of the image is // defined most accurately by the height of the end cap images. minimum_size.set_height(tab_active_.image_l->height()); return minimum_size; @@ -518,7 +518,7 @@ void Tab::PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas) { gfx::Canvas background_canvas(size(), false); PaintInactiveTabBackground(&background_canvas); - SkBitmap background_image = background_canvas.ExtractBitmap(); + gfx::ImageSkia background_image = background_canvas.ExtractBitmap(); // Draw a radial gradient to hover_canvas. gfx::Canvas hover_canvas(size(), false); @@ -547,7 +547,7 @@ void Tab::PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas) { paint); // Draw the radial gradient clipped to the background into hover_image. - SkBitmap hover_image = SkBitmapOperations::CreateMaskedBitmap( + gfx::ImageSkia hover_image = SkBitmapOperations::CreateMaskedBitmap( hover_canvas.ExtractBitmap(), background_image); // Draw the tab background to the canvas. @@ -577,7 +577,7 @@ void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas) { IDR_THEME_TAB_BACKGROUND; } - SkBitmap* tab_bg = GetThemeProvider()->GetBitmapNamed(tab_id); + gfx::ImageSkia* tab_bg = GetThemeProvider()->GetImageSkiaNamed(tab_id); TabImage* tab_image = &tab_active_; TabImage* tab_inactive_image = &tab_inactive_; @@ -589,16 +589,16 @@ void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas) { int bg_offset_y = GetThemeProvider()->HasCustomImage(tab_id) ? 0 : background_offset_.y(); - // We need a gfx::Canvas object to be able to extract the bitmap from. + // We need a gfx::Canvas object to be able to extract the image from. // We draw everything to this canvas and then output it to the canvas // parameter in addition to using it to mask the hover glow if needed. gfx::Canvas background_canvas(size(), false); // Draw left edge. Don't draw over the toolbar, as we're not the foreground // tab. - SkBitmap tab_l = SkBitmapOperations::CreateTiledBitmap( + gfx::ImageSkia tab_l = SkBitmapOperations::CreateTiledBitmap( *tab_bg, offset, bg_offset_y, tab_image->l_width, height()); - SkBitmap theme_l = + gfx::ImageSkia theme_l = SkBitmapOperations::CreateMaskedBitmap(tab_l, *alpha->image_l); background_canvas.DrawBitmapInt(theme_l, 0, 0, theme_l.width(), theme_l.height() - kToolbarOverlap, @@ -606,10 +606,10 @@ void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas) { false); // Draw right edge. Again, don't draw over the toolbar. - SkBitmap tab_r = SkBitmapOperations::CreateTiledBitmap(*tab_bg, + gfx::ImageSkia tab_r = SkBitmapOperations::CreateTiledBitmap(*tab_bg, offset + width() - tab_image->r_width, bg_offset_y, tab_image->r_width, height()); - SkBitmap theme_r = + gfx::ImageSkia theme_r = SkBitmapOperations::CreateMaskedBitmap(tab_r, *alpha->image_r); background_canvas.DrawBitmapInt(theme_r, 0, 0, theme_r.width(), theme_r.height() - kToolbarOverlap, @@ -650,22 +650,23 @@ void Tab::PaintActiveTabBackground(gfx::Canvas* canvas) { ui::ThemeProvider* tp = GetThemeProvider(); DCHECK(tp) << "Unable to get theme provider"; - SkBitmap* tab_bg = GetThemeProvider()->GetBitmapNamed(IDR_THEME_TOOLBAR); + gfx::ImageSkia* tab_bg = + GetThemeProvider()->GetImageSkiaNamed(IDR_THEME_TOOLBAR); TabImage* tab_image = &tab_active_; TabImage* alpha = &tab_alpha_; // Draw left edge. - SkBitmap tab_l = SkBitmapOperations::CreateTiledBitmap( + gfx::ImageSkia tab_l = SkBitmapOperations::CreateTiledBitmap( *tab_bg, offset, 0, tab_image->l_width, height()); - SkBitmap theme_l = + gfx::ImageSkia theme_l = SkBitmapOperations::CreateMaskedBitmap(tab_l, *alpha->image_l); canvas->DrawBitmapInt(theme_l, 0, 0); // Draw right edge. - SkBitmap tab_r = SkBitmapOperations::CreateTiledBitmap(*tab_bg, + gfx::ImageSkia tab_r = SkBitmapOperations::CreateTiledBitmap(*tab_bg, offset + width() - tab_image->r_width, 0, tab_image->r_width, height()); - SkBitmap theme_r = + gfx::ImageSkia theme_r = SkBitmapOperations::CreateMaskedBitmap(tab_r, *alpha->image_r); canvas->DrawBitmapInt(theme_r, width() - tab_image->r_width, 0); @@ -746,18 +747,18 @@ void Tab::LoadTabImages() { // We're not letting people override tab images just yet. ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - tab_alpha_.image_l = rb.GetBitmapNamed(IDR_TAB_ALPHA_LEFT); - tab_alpha_.image_r = rb.GetBitmapNamed(IDR_TAB_ALPHA_RIGHT); + tab_alpha_.image_l = rb.GetImageSkiaNamed(IDR_TAB_ALPHA_LEFT); + tab_alpha_.image_r = rb.GetImageSkiaNamed(IDR_TAB_ALPHA_RIGHT); - tab_active_.image_l = rb.GetBitmapNamed(IDR_TAB_ACTIVE_LEFT); - tab_active_.image_c = rb.GetBitmapNamed(IDR_TAB_ACTIVE_CENTER); - tab_active_.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT); + tab_active_.image_l = rb.GetImageSkiaNamed(IDR_TAB_ACTIVE_LEFT); + tab_active_.image_c = rb.GetImageSkiaNamed(IDR_TAB_ACTIVE_CENTER); + tab_active_.image_r = rb.GetImageSkiaNamed(IDR_TAB_ACTIVE_RIGHT); tab_active_.l_width = tab_active_.image_l->width(); tab_active_.r_width = tab_active_.image_r->width(); - tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); - tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); - tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); + tab_inactive_.image_l = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_LEFT); + tab_inactive_.image_c = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_CENTER); + tab_inactive_.image_r = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_RIGHT); tab_inactive_.l_width = tab_inactive_.image_l->width(); tab_inactive_.r_width = tab_inactive_.image_r->width(); } diff --git a/chrome/browser/ui/views/tabs/tab.h b/chrome/browser/ui/views/tabs/tab.h index 15f5831..85787fc 100644 --- a/chrome/browser/ui/views/tabs/tab.h +++ b/chrome/browser/ui/views/tabs/tab.h @@ -117,9 +117,9 @@ class Tab : public BaseTab { scoped_ptr<ui::MultiAnimation> mini_title_animation_; struct TabImage { - SkBitmap* image_l; - SkBitmap* image_c; - SkBitmap* image_r; + gfx::ImageSkia* image_l; + gfx::ImageSkia* image_c; + gfx::ImageSkia* image_r; int l_width; int r_width; int y_offset; diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller.cc b/chrome/browser/ui/views/tabs/tab_drag_controller.cc index c3e7ea9..dce441c 100644 --- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc +++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc @@ -31,13 +31,13 @@ #include "content/public/browser/user_metrics.h" #include "content/public/browser/web_contents.h" #include "grit/theme_resources.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/animation/animation.h" #include "ui/base/animation/animation_delegate.h" #include "ui/base/animation/slide_animation.h" #include "ui/base/events.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" +#include "ui/gfx/image/image_skia.h" #include "ui/gfx/screen.h" #include "ui/views/events/event.h" #include "ui/views/widget/root_view.h" @@ -106,8 +106,8 @@ class DockView : public views::View { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - SkBitmap* high_icon = rb.GetBitmapNamed(IDR_DOCK_HIGH); - SkBitmap* wide_icon = rb.GetBitmapNamed(IDR_DOCK_WIDE); + gfx::ImageSkia* high_icon = rb.GetImageSkiaNamed(IDR_DOCK_HIGH); + gfx::ImageSkia* wide_icon = rb.GetImageSkiaNamed(IDR_DOCK_WIDE); canvas->Save(); bool rtl_ui = base::i18n::IsRTL(); @@ -126,8 +126,8 @@ class DockView : public views::View { canvas->DrawBitmapInt(*high_icon, x_of_active_tab, (height() - high_icon->height()) / 2); if (type_ == DockInfo::LEFT_OF_WINDOW) { - DrawBitmapWithAlpha(canvas, *high_icon, x_of_inactive_tab, - (height() - high_icon->height()) / 2); + DrawImageWithAlpha(canvas, *high_icon, x_of_inactive_tab, + (height() - high_icon->height()) / 2); } break; @@ -139,8 +139,8 @@ class DockView : public views::View { canvas->DrawBitmapInt(*high_icon, x_of_active_tab, (height() - high_icon->height()) / 2); if (type_ == DockInfo::RIGHT_OF_WINDOW) { - DrawBitmapWithAlpha(canvas, *high_icon, x_of_inactive_tab, - (height() - high_icon->height()) / 2); + DrawImageWithAlpha(canvas, *high_icon, x_of_inactive_tab, + (height() - high_icon->height()) / 2); } break; @@ -150,7 +150,7 @@ class DockView : public views::View { break; case DockInfo::MAXIMIZE: { - SkBitmap* max_icon = rb.GetBitmapNamed(IDR_DOCK_MAX); + gfx::ImageSkia* max_icon = rb.GetImageSkiaNamed(IDR_DOCK_MAX); canvas->DrawBitmapInt(*max_icon, (width() - max_icon->width()) / 2, (height() - max_icon->height()) / 2); break; @@ -161,7 +161,7 @@ class DockView : public views::View { canvas->DrawBitmapInt(*wide_icon, (width() - wide_icon->width()) / 2, height() / 2 + kTabSpacing / 2); if (type_ == DockInfo::BOTTOM_OF_WINDOW) { - DrawBitmapWithAlpha(canvas, *wide_icon, + DrawImageWithAlpha(canvas, *wide_icon, (width() - wide_icon->width()) / 2, height() / 2 - kTabSpacing / 2 - wide_icon->height()); } @@ -175,8 +175,8 @@ class DockView : public views::View { } private: - void DrawBitmapWithAlpha(gfx::Canvas* canvas, const SkBitmap& image, - int x, int y) { + void DrawImageWithAlpha(gfx::Canvas* canvas, const gfx::ImageSkia& image, + int x, int y) { SkPaint paint; paint.setAlpha(128); canvas->DrawBitmapInt(image, x, y, paint); diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index 9b09e1e..610db93 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc @@ -32,13 +32,13 @@ #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/layout.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" #include "ui/gfx/path.h" #include "ui/gfx/screen.h" #include "ui/gfx/size.h" #include "ui/gfx/skbitmap_operations.h" -#include "ui/base/layout.h" #include "ui/views/controls/image_view.h" #include "ui/views/mouse_watcher_view_host.h" #include "ui/views/view_model_utils.h" @@ -324,10 +324,10 @@ void NewTabButton::GetHitTestMask(gfx::Path* path) const { SkScalar w = SkIntToScalar(width()); - // These values are defined by the shape of the new tab bitmap. Should that - // bitmap ever change, these values will need to be updated. They're so + // These values are defined by the shape of the new tab image. Should that + // image ever change, these values will need to be updated. They're so // custom it's not really worth defining constants for. - // These values are correct for regular and USE_ASH versions of the bitmap. + // These values are correct for regular and USE_ASH versions of the image. path->moveTo(0, 1); path->lineTo(w - 7, 1); path->lineTo(w - 4, 4); @@ -353,8 +353,8 @@ void NewTabButton::OnMouseReleased(const views::MouseEvent& event) { #endif void NewTabButton::OnPaint(gfx::Canvas* canvas) { - SkBitmap bitmap = GetBitmap(); - canvas->DrawBitmapInt(bitmap, 0, height() - bitmap.height()); + SkBitmap image = GetBitmap(); + canvas->DrawBitmapInt(image, 0, height() - image.height()); } bool NewTabButton::ShouldUseNativeFrame() const { @@ -386,14 +386,16 @@ SkBitmap NewTabButton::GetBackgroundBitmap( break; } - SkBitmap* mask = GetThemeProvider()->GetBitmapNamed(IDR_NEWTAB_BUTTON_MASK); + gfx::ImageSkia* mask = + GetThemeProvider()->GetImageSkiaNamed(IDR_NEWTAB_BUTTON_MASK); int height = mask->height(); int width = mask->width(); gfx::Canvas canvas(gfx::Size(width, height), false); // For custom images the background starts at the top of the tab strip. // Otherwise the background starts at the top of the frame. - SkBitmap* background = GetThemeProvider()->GetBitmapNamed(background_id); + gfx::ImageSkia* background = + GetThemeProvider()->GetImageSkiaNamed(background_id); int offset_y = GetThemeProvider()->HasCustomImage(background_id) ? 0 : background_offset_.y(); canvas.TileImageInt(*background, GetMirroredX() + background_offset_.x(), @@ -418,7 +420,7 @@ SkBitmap NewTabButton::GetBitmapForState( views::CustomButton::ButtonState state) const { int overlay_id = state == views::CustomButton::BS_PUSHED ? IDR_NEWTAB_BUTTON_P : IDR_NEWTAB_BUTTON; - SkBitmap* overlay = GetThemeProvider()->GetBitmapNamed(overlay_id); + gfx::ImageSkia* overlay = GetThemeProvider()->GetImageSkiaNamed(overlay_id); gfx::Canvas canvas(gfx::Size(overlay->width(), overlay->height()), false); canvas.DrawBitmapInt(GetBackgroundBitmap(state), 0, 0); diff --git a/chrome/browser/ui/views/theme_background.cc b/chrome/browser/ui/views/theme_background.cc index 52f3f1d..6cb8404 100644 --- a/chrome/browser/ui/views/theme_background.cc +++ b/chrome/browser/ui/views/theme_background.cc @@ -21,25 +21,25 @@ ThemeBackground::ThemeBackground(BrowserView* browser_view) } void ThemeBackground::Paint(gfx::Canvas* canvas, views::View* view) const { - SkBitmap* background; + gfx::ImageSkia* background; // Never theme app and popup windows. if (!browser_view_->IsBrowserTypeNormal()) { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); if (browser_view_->IsActive()) - background = rb.GetBitmapNamed(IDR_FRAME); + background = rb.GetImageSkiaNamed(IDR_FRAME); else - background = rb.GetBitmapNamed(IDR_THEME_FRAME_INACTIVE); + background = rb.GetImageSkiaNamed(IDR_THEME_FRAME_INACTIVE); } else { Profile* profile = browser_view_->browser()->profile(); ui::ThemeProvider* theme = ThemeServiceFactory::GetForProfile(profile); if (browser_view_->IsActive()) { - background = theme->GetBitmapNamed( + background = theme->GetImageSkiaNamed( profile->IsOffTheRecord() ? IDR_THEME_FRAME_INCOGNITO : IDR_THEME_FRAME); } else { - background = theme->GetBitmapNamed( + background = theme->GetImageSkiaNamed( profile->IsOffTheRecord() ? IDR_THEME_FRAME_INCOGNITO_INACTIVE : IDR_THEME_FRAME_INACTIVE); } diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc index 8c9a979..b53dab9 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -80,7 +80,7 @@ const int kPopupBottomSpacingGlass = 1; // corner of the wrench menu). const int kBadgeTopMargin = 2; -SkBitmap* kPopupBackgroundEdge = NULL; +gfx::ImageSkia* kPopupBackgroundEdge = NULL; // The omnibox border has some additional shadow, so we use less vertical // spacing than ToolbarView::kVertSpacing. @@ -137,7 +137,7 @@ ToolbarView::ToolbarView(Browser* browser) if (!kPopupBackgroundEdge) { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - kPopupBackgroundEdge = rb.GetBitmapNamed(IDR_LOCATIONBG_POPUPMODE_EDGE); + kPopupBackgroundEdge = rb.GetImageSkiaNamed(IDR_LOCATIONBG_POPUPMODE_EDGE); } registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, @@ -275,7 +275,8 @@ void ToolbarView::RemoveMenuListener(views::MenuListener* listener) { menu_listeners_.RemoveObserver(listener); } -SkBitmap ToolbarView::GetAppMenuIcon(views::CustomButton::ButtonState state) { +gfx::ImageSkia ToolbarView::GetAppMenuIcon( + views::CustomButton::ButtonState state) { ui::ThemeProvider* tp = GetThemeProvider(); int id = 0; @@ -285,7 +286,7 @@ SkBitmap ToolbarView::GetAppMenuIcon(views::CustomButton::ButtonState state) { case views::CustomButton::BS_PUSHED: id = IDR_TOOLS_P; break; default: NOTREACHED(); break; } - SkBitmap icon = *tp->GetBitmapNamed(id); + gfx::ImageSkia icon = *tp->GetImageSkiaNamed(id); #if defined(OS_WIN) // Keep track of whether we were showing the badge before, so we don't send @@ -307,24 +308,24 @@ SkBitmap ToolbarView::GetAppMenuIcon(views::CustomButton::ButtonState state) { // Draw the chrome app menu icon onto the canvas. scoped_ptr<gfx::Canvas> canvas(new gfx::Canvas(icon, false)); - SkBitmap badge; + gfx::ImageSkia badge; // Only one badge can be active at any given time. The Upgrade notification // is deemed most important, then the DLL conflict badge. if (ShouldShowUpgradeRecommended()) { - badge = *tp->GetBitmapNamed( + badge = *tp->GetImageSkiaNamed( UpgradeDetector::GetInstance()->GetIconResourceID( UpgradeDetector::UPGRADE_ICON_TYPE_BADGE)); } else if (ShouldShowIncompatibilityWarning()) { #if defined(OS_WIN) if (!was_showing) content::RecordAction(UserMetricsAction("ConflictBadge")); - badge = *tp->GetBitmapNamed(IDR_CONFLICT_BADGE); + badge = *tp->GetImageSkiaNamed(IDR_CONFLICT_BADGE); incompatibility_badge_showing = true; #else NOTREACHED(); #endif } else if (error_badge_id) { - badge = *tp->GetBitmapNamed(error_badge_id); + badge = *tp->GetImageSkiaNamed(error_badge_id); } else { NOTREACHED(); } @@ -541,10 +542,10 @@ gfx::Size ToolbarView::GetPreferredSize() { browser_actions_->GetPreferredSize().width() + app_menu_->GetPreferredSize().width() + kRightEdgeSpacing; - CR_DEFINE_STATIC_LOCAL(SkBitmap, normal_background, ()); + CR_DEFINE_STATIC_LOCAL(gfx::ImageSkia, normal_background, ()); if (normal_background.isNull()) { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - normal_background = *rb.GetBitmapNamed(IDR_CONTENT_TOP_CENTER); + normal_background = *rb.GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER); } return gfx::Size(min_width, diff --git a/chrome/browser/ui/views/toolbar_view.h b/chrome/browser/ui/views/toolbar_view.h index d77f4e1..d3e67bc 100644 --- a/chrome/browser/ui/views/toolbar_view.h +++ b/chrome/browser/ui/views/toolbar_view.h @@ -69,9 +69,9 @@ class ToolbarView : public views::AccessiblePaneView, // Remove a menu listener. void RemoveMenuListener(views::MenuListener* listener); - // Gets a bitmap with the icon for the app menu and any overlaid notification + // Gets an image with the icon for the app menu and any overlaid notification // badge. - SkBitmap GetAppMenuIcon(views::CustomButton::ButtonState state); + gfx::ImageSkia GetAppMenuIcon(views::CustomButton::ButtonState state); virtual bool GetAcceleratorInfo(int id, ui::Accelerator* accel); @@ -182,7 +182,7 @@ class ToolbarView : public views::AccessiblePaneView, // Gets a badge for the wrench icon corresponding to the number of // unacknowledged background pages in the system. - SkBitmap GetBackgroundPageBadge(); + gfx::ImageSkia GetBackgroundPageBadge(); scoped_ptr<BackForwardMenuModel> back_menu_model_; scoped_ptr<BackForwardMenuModel> forward_menu_model_; diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc index 2f79470..df4118a 100644 --- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc +++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc @@ -212,7 +212,8 @@ void NTPLoginHandler::UpdateLogin() { const gfx::Image* image = cache.GetGAIAPictureOfProfileAtIndex(profile_index); if (image) - icon_url = web_ui_util::GetImageDataUrl(GetGAIAPictureForNTP(*image)); + icon_url = web_ui_util::GetImageDataUrl(gfx::ImageSkia( + GetGAIAPictureForNTP(*image))); } if (header.empty()) header = CreateSpanWithClass(UTF8ToUTF16(username), "profile-name"); diff --git a/chrome/browser/ui/webui/options2/browser_options_handler2.cc b/chrome/browser/ui/webui/options2/browser_options_handler2.cc index 511af7d..195f8a2 100644 --- a/chrome/browser/ui/webui/options2/browser_options_handler2.cc +++ b/chrome/browser/ui/webui/options2/browser_options_handler2.cc @@ -16,8 +16,8 @@ #include "base/stl_util.h" #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" -#include "base/values.h" #include "base/value_conversions.h" +#include "base/values.h" #include "chrome/browser/auto_launch_trial.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_page_zoom.h" @@ -87,7 +87,7 @@ #include "chrome/browser/chromeos/options/take_photo_dialog.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/webui/options2/chromeos/system_settings_provider2.h" -#include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/image/image_skia.h" #endif // defined(OS_CHROMEOS) #if defined(OS_WIN) @@ -912,7 +912,7 @@ scoped_ptr<ListValue> BrowserOptionsHandler::GetProfilesInfoList() { gfx::Image icon = profiles::GetAvatarIconForWebUI( cache.GetAvatarIconOfProfileAtIndex(i), true); profile_value->SetString("iconURL", - web_ui_util::GetImageDataUrl(*icon.ToSkBitmap())); + web_ui_util::GetImageDataUrl(*icon.ToImageSkia())); } else { size_t icon_index = cache.GetAvatarIconIndexOfProfileAtIndex(i); profile_value->SetString("iconURL", diff --git a/chrome/browser/ui/webui/options2/manage_profile_handler2.cc b/chrome/browser/ui/webui/options2/manage_profile_handler2.cc index ade3ca7..3ede790 100644 --- a/chrome/browser/ui/webui/options2/manage_profile_handler2.cc +++ b/chrome/browser/ui/webui/options2/manage_profile_handler2.cc @@ -108,7 +108,7 @@ void ManageProfileHandler::SendProfileIcons() { cache.GetGAIAPictureOfProfileAtIndex(profile_index); if (icon) { gfx::Image icon2 = profiles::GetAvatarIconForWebUI(*icon, true); - gaia_picture_url_ = web_ui_util::GetImageDataUrl(*icon2.ToSkBitmap()); + gaia_picture_url_ = web_ui_util::GetImageDataUrl(*icon2.ToImageSkia()); image_url_list.Append(Value::CreateStringValue(gaia_picture_url_)); } } @@ -268,7 +268,7 @@ void ManageProfileHandler::RequestProfileInfo(const ListValue* args) { gfx::Image icon = profiles::GetAvatarIconForWebUI( cache.GetAvatarIconOfProfileAtIndex(index), true); profile_value.SetString("iconURL", - web_ui_util::GetImageDataUrl(*icon.ToSkBitmap())); + web_ui_util::GetImageDataUrl(*icon.ToImageSkia())); } else { size_t icon_index = cache.GetAvatarIconIndexOfProfileAtIndex(index); profile_value.SetString("iconURL", diff --git a/chrome/browser/ui/webui/task_manager/task_manager_handler.cc b/chrome/browser/ui/webui/task_manager/task_manager_handler.cc index 8c3404b..35e0ce5 100644 --- a/chrome/browser/ui/webui/task_manager/task_manager_handler.cc +++ b/chrome/browser/ui/webui/task_manager/task_manager_handler.cc @@ -20,7 +20,7 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" -#include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/image/image_skia.h" #include "webkit/glue/webpreferences.h" namespace { diff --git a/chrome/browser/ui/webui/web_ui_util.cc b/chrome/browser/ui/webui/web_ui_util.cc index 46d2824..160ba0a 100644 --- a/chrome/browser/ui/webui/web_ui_util.cc +++ b/chrome/browser/ui/webui/web_ui_util.cc @@ -14,12 +14,13 @@ #include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/codec/png_codec.h" +#include "ui/gfx/image/image_skia.h" namespace web_ui_util { -std::string GetImageDataUrl(const SkBitmap& bitmap) { +std::string GetImageDataUrl(const gfx::ImageSkia& image) { std::vector<unsigned char> output; - gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &output); + gfx::PNGCodec::EncodeBGRASkBitmap(*image.bitmap(), false, &output); std::string str_url; str_url.insert(str_url.end(), output.begin(), output.end()); diff --git a/chrome/browser/ui/webui/web_ui_util.h b/chrome/browser/ui/webui/web_ui_util.h index 99a2b46..5a5e6d2 100644 --- a/chrome/browser/ui/webui/web_ui_util.h +++ b/chrome/browser/ui/webui/web_ui_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,13 +11,15 @@ #include "base/values.h" #include "webkit/glue/window_open_disposition.h" -class SkBitmap; +namespace gfx { +class ImageSkia; +} namespace web_ui_util { -// Convenience routine to convert SkBitmap object to data url +// Convenience routine to convert ImageSkia object to data url // so that it can be used in WebUI. -std::string GetImageDataUrl(const SkBitmap& bitmap); +std::string GetImageDataUrl(const gfx::ImageSkia& image); // Convenience routine to get data url that corresponds to given // resource_id as an image. This function does not check if the |