summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/launcher/tabbed_launcher_button.cc2
-rw-r--r--chrome/browser/chromeos/login/user_image_manager_impl.cc6
-rw-r--r--chrome/browser/extensions/api/downloads/downloads_api.cc3
-rw-r--r--chrome/browser/extensions/extension_icon_manager.cc2
-rw-r--r--chrome/browser/extensions/extension_uninstall_dialog.cc3
-rw-r--r--chrome/browser/notifications/desktop_notification_service.cc2
-rw-r--r--chrome/browser/profiles/profile_info_util.cc6
-rw-r--r--chrome/browser/speech/speech_recognition_tray_icon_controller.cc2
-rw-r--r--chrome/browser/ui/app_list/search_builder.cc2
-rw-r--r--chrome/browser/ui/ash/launcher/browser_launcher_item_controller.cc6
-rw-r--r--chrome/browser/ui/gtk/avatar_menu_item_gtk.cc4
-rw-r--r--chrome/browser/ui/gtk/download/download_item_gtk.cc2
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc6
-rw-r--r--chrome/browser/ui/views/create_application_shortcut_view.cc2
-rw-r--r--chrome/browser/ui/views/extensions/extension_installed_bubble.cc2
-rw-r--r--chrome/browser/ui/views/frame/browser_view.cc2
-rw-r--r--chrome/browser/ui/views/infobars/infobar_view.cc2
-rw-r--r--chrome/browser/ui/webui/chromeos/login/network_dropdown.cc4
-rw-r--r--chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc4
-rw-r--r--chrome/browser/ui/webui/ntp/ntp_login_handler.cc6
-rw-r--r--chrome/browser/ui/webui/options/autofill_options_handler.cc2
-rw-r--r--chrome/browser/ui/webui/options/browser_options_handler.cc3
-rw-r--r--chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc5
-rw-r--r--chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc2
-rw-r--r--chrome/browser/ui/webui/options/manage_profile_handler.cc2
-rw-r--r--chrome/browser/ui/webui/task_manager/task_manager_handler.cc2
-rw-r--r--chrome/browser/ui/webui/web_ui_util.cc8
-rw-r--r--chrome/browser/ui/webui/web_ui_util.h19
-rw-r--r--chrome/common/badge_util.cc2
-rw-r--r--content/browser/renderer_host/render_widget_host_view_win.cc4
-rw-r--r--content/browser/web_contents/web_contents_drag_win.cc10
-rw-r--r--content/browser/web_contents/web_contents_drag_win.h2
-rw-r--r--ui/gfx/image/image_skia.h4
-rw-r--r--ui/views/examples/table_example.cc2
34 files changed, 64 insertions, 71 deletions
diff --git a/ash/launcher/tabbed_launcher_button.cc b/ash/launcher/tabbed_launcher_button.cc
index cb33ca5..9ab491f 100644
--- a/ash/launcher/tabbed_launcher_button.cc
+++ b/ash/launcher/tabbed_launcher_button.cc
@@ -51,7 +51,7 @@ TabbedLauncherButton::IconView::~IconView() {
void TabbedLauncherButton::IconView::AnimationEnded(
const ui::Animation* animation) {
AnimationProgressed(animation);
- animating_image_ = SkBitmap();
+ animating_image_ = gfx::ImageSkia();
}
void TabbedLauncherButton::IconView::AnimationProgressed(
diff --git a/chrome/browser/chromeos/login/user_image_manager_impl.cc b/chrome/browser/chromeos/login/user_image_manager_impl.cc
index 5a7ca978..143ce9e 100644
--- a/chrome/browser/chromeos/login/user_image_manager_impl.cc
+++ b/chrome/browser/chromeos/login/user_image_manager_impl.cc
@@ -528,7 +528,7 @@ void UserImageManagerImpl::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::GetBitmapDataUrl(*downloaded_profile_image_.bitmap());
profile_image_url_ = logged_in_user->image_url();
}
}
@@ -635,8 +635,8 @@ void UserImageManagerImpl::OnProfileDownloadSuccess(
return;
// Check if this image is not the same as already downloaded.
- gfx::ImageSkia new_image(downloader->GetProfilePicture());
- std::string new_image_data_url = web_ui_util::GetImageDataUrl(new_image);
+ SkBitmap new_bitmap(downloader->GetProfilePicture());
+ std::string new_image_data_url = web_ui_util::GetBitmapDataUrl(new_bitmap);
if (!downloaded_profile_image_data_url_.empty() &&
new_image_data_url == downloaded_profile_image_data_url_)
return;
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc
index 5645a53..f33c1e1 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api.cc
@@ -51,6 +51,7 @@
#include "net/base/load_flags.h"
#include "net/http/http_util.h"
#include "net/url_request/url_request.h"
+#include "third_party/skia/include/core/SkBitmap.h"
using content::BrowserContext;
using content::BrowserThread;
@@ -265,7 +266,7 @@ void DownloadFileIconExtractorImpl::OnIconLoadComplete(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
std::string url;
if (icon)
- url = web_ui_util::GetImageDataUrl(*icon->ToImageSkia());
+ url = web_ui_util::GetBitmapDataUrl(icon->AsBitmap());
callback_.Run(url);
}
diff --git a/chrome/browser/extensions/extension_icon_manager.cc b/chrome/browser/extensions/extension_icon_manager.cc
index 381db4d..63250dc 100644
--- a/chrome/browser/extensions/extension_icon_manager.cc
+++ b/chrome/browser/extensions/extension_icon_manager.cc
@@ -32,7 +32,7 @@ static SkBitmap ApplyPadding(const SkBitmap& source,
ui::SCALE_FACTOR_100P,
false));
result->DrawImageInt(
- source,
+ gfx::ImageSkia(source),
0, 0, source.width(), source.height(),
padding.left(), padding.top(), source.width(), source.height(),
false);
diff --git a/chrome/browser/extensions/extension_uninstall_dialog.cc b/chrome/browser/extensions/extension_uninstall_dialog.cc
index d46e002..3eab19e 100644
--- a/chrome/browser/extensions/extension_uninstall_dialog.cc
+++ b/chrome/browser/extensions/extension_uninstall_dialog.cc
@@ -92,7 +92,8 @@ void ExtensionUninstallDialog::SetIcon(const gfx::Image& image) {
// than the one we need, it will be scaled down by the ui code.
// TODO(tbarzic): We should use IconImage here and load the required bitmap
// lazily.
- icon_ = GetDefaultIconBitmapForMaxScaleFactor(extension_->is_app());
+ icon_ = gfx::ImageSkia(
+ GetDefaultIconBitmapForMaxScaleFactor(extension_->is_app()));
} else {
icon_ = *image.ToImageSkia();
}
diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc
index bfac01a..d95ca9a 100644
--- a/chrome/browser/notifications/desktop_notification_service.cc
+++ b/chrome/browser/notifications/desktop_notification_service.cc
@@ -264,7 +264,7 @@ std::string DesktopNotificationService::AddIconNotification(
#else
GURL icon_url;
if (!icon.isNull())
- icon_url = GURL(web_ui_util::GetImageDataUrl(icon));
+ icon_url = GURL(web_ui_util::GetBitmapDataUrl(*icon.bitmap()));
return AddNotification(
origin_url, title, message, icon_url, replace_id, delegate, profile);
#endif
diff --git a/chrome/browser/profiles/profile_info_util.cc b/chrome/browser/profiles/profile_info_util.cc
index 196e01d..2795dd6 100644
--- a/chrome/browser/profiles/profile_info_util.cc
+++ b/chrome/browser/profiles/profile_info_util.cc
@@ -27,7 +27,7 @@ gfx::Image GetAvatarIconForMenu(const gfx::Image& image,
// Draw the icon centered on the canvas.
int x = (kAvatarIconWidth - length) / 2;
int y = (kAvatarIconHeight - length) / 2;
- canvas.DrawImageInt(bmp, x, y);
+ canvas.DrawImageInt(gfx::ImageSkia(bmp), x, y);
// Draw a gray border on the inside of the icon.
SkColor color = SkColorSetARGB(83, 0, 0, 0);
@@ -50,7 +50,7 @@ gfx::Image GetAvatarIconForWebUI(const gfx::Image& image,
// Draw the icon centered on the canvas.
int x = (kAvatarIconWidth - length) / 2;
int y = (kAvatarIconHeight - length) / 2;
- canvas.DrawImageInt(bmp, x, y);
+ canvas.DrawImageInt(gfx::ImageSkia(bmp), x, y);
return gfx::Image(gfx::ImageSkia(canvas.ExtractImageRep()));
}
@@ -74,7 +74,7 @@ gfx::Image GetAvatarIconForTitleBar(const gfx::Image& image,
int x2 = x1 + length;
int y1 = dst_height - length - 1;
int y2 = y1 + length;
- canvas.DrawImageInt(bmp, x1, y1);
+ canvas.DrawImageInt(gfx::ImageSkia(bmp), x1, y1);
// Give the icon an etched look by drawing a highlight on the bottom edge
// and a shadow on the remaining edges.
diff --git a/chrome/browser/speech/speech_recognition_tray_icon_controller.cc b/chrome/browser/speech/speech_recognition_tray_icon_controller.cc
index 26f978a..ddf7cf8 100644
--- a/chrome/browser/speech/speech_recognition_tray_icon_controller.cc
+++ b/chrome/browser/speech/speech_recognition_tray_icon_controller.cc
@@ -139,7 +139,7 @@ void SpeechRecognitionTrayIconController::SetVUMeterVolume(float volume) {
canvas.drawBitmap(*g_images.Get().mic_empty()->bitmap(), 0, 0);
DrawVolume(&canvas, *g_images.Get().mic_full(), volume);
- tray_icon_->SetImage(*mic_image_.get());
+ tray_icon_->SetImage(gfx::ImageSkia(*mic_image_.get()));
}
void SpeechRecognitionTrayIconController::Initialize() {
diff --git a/chrome/browser/ui/app_list/search_builder.cc b/chrome/browser/ui/app_list/search_builder.cc
index afa0647..24137a8 100644
--- a/chrome/browser/ui/app_list/search_builder.cc
+++ b/chrome/browser/ui/app_list/search_builder.cc
@@ -273,7 +273,7 @@ class ContactResult : public SearchBuilderResult,
virtual void OnImageDecoded(const ImageDecoder* decoder,
const SkBitmap& decoded_image) OVERRIDE {
DCHECK_EQ(decoder, photo_decoder_);
- SetIcon(decoded_image);
+ SetIcon(gfx::ImageSkia(decoded_image));
}
virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE {
diff --git a/chrome/browser/ui/ash/launcher/browser_launcher_item_controller.cc b/chrome/browser/ui/ash/launcher/browser_launcher_item_controller.cc
index 4c56827..67dfdee 100644
--- a/chrome/browser/ui/ash/launcher/browser_launcher_item_controller.cc
+++ b/chrome/browser/ui/ash/launcher/browser_launcher_item_controller.cc
@@ -210,7 +210,7 @@ void BrowserLauncherItemController::TabChangedAt(
if (item_index == -1)
return;
ash::LauncherItem item = launcher_model()->items()[item_index];
- item.image = SkBitmap();
+ item.image = gfx::ImageSkia();
launcher_model()->Set(item_index, item);
}
}
@@ -273,9 +273,9 @@ void BrowserLauncherItemController::UpdateLauncher(TabContents* tab) {
// Update the icon for extension panels.
extensions::TabHelper* extensions_tab_helper =
extensions::TabHelper::FromWebContents(tab->web_contents());
- SkBitmap new_image = favicon_loader_->GetFavicon();
+ gfx::ImageSkia new_image = gfx::ImageSkia(favicon_loader_->GetFavicon());
if (new_image.isNull() && extensions_tab_helper->GetExtensionAppIcon())
- new_image = *extensions_tab_helper->GetExtensionAppIcon();
+ new_image = gfx::ImageSkia(*extensions_tab_helper->GetExtensionAppIcon());
// Only update the icon if we have a new image, or none has been set yet.
// This avoids flickering to an empty image when a pinned app is opened.
if (!new_image.isNull())
diff --git a/chrome/browser/ui/gtk/avatar_menu_item_gtk.cc b/chrome/browser/ui/gtk/avatar_menu_item_gtk.cc
index 6df1261..0b66cad 100644
--- a/chrome/browser/ui/gtk/avatar_menu_item_gtk.cc
+++ b/chrome/browser/ui/gtk/avatar_menu_item_gtk.cc
@@ -206,8 +206,8 @@ void AvatarMenuItemGtk::Init(GtkThemeService* theme_service) {
gfx::Canvas canvas(avatar_image_rep, /* is_opaque */ true);
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- const SkBitmap* check_image = rb.GetImageNamed(
- IDR_PROFILE_SELECTED).ToSkBitmap();
+ const gfx::ImageSkia* check_image = rb.GetImageNamed(
+ IDR_PROFILE_SELECTED).ToImageSkia();
gfx::Rect check_rect(0, 0, check_image->width(), check_image->height());
int y = avatar_image->height() - check_image->height();
int x = avatar_image->width() - check_image->width() + kCheckMarkXOffset;
diff --git a/chrome/browser/ui/gtk/download/download_item_gtk.cc b/chrome/browser/ui/gtk/download/download_item_gtk.cc
index b10831c..b774deb 100644
--- a/chrome/browser/ui/gtk/download/download_item_gtk.cc
+++ b/chrome/browser/ui/gtk/download/download_item_gtk.cc
@@ -874,7 +874,7 @@ gboolean DownloadItemGtk::OnProgressAreaExpose(GtkWidget* widget,
// there is no need to use the chromium-specific default download item icon.
if (icon_small_) {
const int offset = download_util::kSmallProgressIconOffset;
- canvas.DrawImageInt(*icon_small_->ToSkBitmap(),
+ canvas.DrawImageInt(icon_small_->AsImageSkia(),
allocation.x + offset, allocation.y + offset);
}
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc b/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc
index 5282142..a7cea645 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc
@@ -332,8 +332,7 @@ void BookmarkMenuDelegate::BookmarkNodeFaviconChanged(
MenuItemView* menu_item = i->second->GetMenuItemByID(menu_pair->second);
if (menu_item) {
const gfx::Image& favicon = model->GetFavicon(node);
- menu_item->SetIcon(
- favicon.IsEmpty() ? SkBitmap() : *favicon.ToSkBitmap());
+ menu_item->SetIcon(favicon.AsImageSkia());
return;
}
}
@@ -343,8 +342,7 @@ void BookmarkMenuDelegate::BookmarkNodeFaviconChanged(
menu_pair->second);
if (menu_item) {
const gfx::Image& favicon = model->GetFavicon(node);
- menu_item->SetIcon(
- favicon.IsEmpty() ? SkBitmap() : *favicon.ToSkBitmap());
+ menu_item->SetIcon(favicon.AsImageSkia());
}
}
}
diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc
index 32f8b6e..026c862 100644
--- a/chrome/browser/ui/views/create_application_shortcut_view.cc
+++ b/chrome/browser/ui/views/create_application_shortcut_view.cc
@@ -93,7 +93,7 @@ void AppInfoView::Init(const string16& title_text,
const string16& description_text,
const SkBitmap& icon) {
icon_ = new views::ImageView();
- icon_->SetImage(icon);
+ icon_->SetImage(gfx::ImageSkia(icon));
icon_->SetImageSize(gfx::Size(kAppIconSize, kAppIconSize));
title_ = new views::Label(title_text);
diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc
index 57583f2..cd16e86 100644
--- a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc
+++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc
@@ -116,7 +116,7 @@ class InstalledBubbleContent : public views::View,
size = gfx::Size(kIconSize, kIconSize);
icon_ = new views::ImageView();
icon_->SetImageSize(size);
- icon_->SetImage(*icon);
+ icon_->SetImage(gfx::ImageSkia(*icon));
AddChildView(icon_);
// The Extension Installed bubble takes on various forms, depending on the
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 1f119ea..54f2ec6 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -1508,7 +1508,7 @@ gfx::ImageSkia BrowserView::GetWindowAppIcon() {
extensions::TabHelper* extensions_tab_helper =
contents ? extensions::TabHelper::FromWebContents(contents) : NULL;
if (extensions_tab_helper && extensions_tab_helper->GetExtensionAppIcon())
- return *extensions_tab_helper->GetExtensionAppIcon();
+ return gfx::ImageSkia(*extensions_tab_helper->GetExtensionAppIcon());
}
return GetWindowIcon();
diff --git a/chrome/browser/ui/views/infobars/infobar_view.cc b/chrome/browser/ui/views/infobars/infobar_view.cc
index 348afbc..9febf59 100644
--- a/chrome/browser/ui/views/infobars/infobar_view.cc
+++ b/chrome/browser/ui/views/infobars/infobar_view.cc
@@ -146,7 +146,7 @@ views::TextButton* InfoBarView::CreateTextButton(
icon_info.hIcon, gfx::Size(GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON))));
if (icon.get())
- text_button->SetIcon(*icon);
+ text_button->SetIcon(gfx::ImageSkia(*icon));
DestroyIcon(icon_info.hIcon);
}
}
diff --git a/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc b/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc
index c48b0bf..58fe399 100644
--- a/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc
+++ b/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc
@@ -89,7 +89,7 @@ base::ListValue* NetworkMenuWebUI::ConvertMenuModel(ui::MenuModel* model) {
if (model->GetIconAt(i, &icon)) {
SkBitmap icon_bitmap = icon.ToImageSkia()->GetRepresentation(
web_ui_->GetDeviceScaleFactor()).sk_bitmap();
- item->SetString("icon", web_ui_util::GetImageDataUrl(icon_bitmap));
+ item->SetString("icon", web_ui_util::GetBitmapDataUrl(icon_bitmap));
}
if (id >= 0) {
item->SetBoolean("enabled", model->IsEnabledAt(i));
@@ -166,7 +166,7 @@ void NetworkDropdown::SetNetworkIconAndText() {
web_ui_->GetDeviceScaleFactor()).sk_bitmap();
std::string icon_str =
icon_image.isNull() ?
- std::string() : web_ui_util::GetImageDataUrl(icon_bitmap);
+ std::string() : web_ui_util::GetBitmapDataUrl(icon_bitmap);
base::StringValue title(text);
base::StringValue icon(icon_str);
web_ui_->CallJavascriptFunction("cr.ui.DropDown.updateNetworkTitle",
diff --git a/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc
index 13af88e..60de8d3 100644
--- a/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc
@@ -167,7 +167,7 @@ void UserImageScreenHandler::RegisterMessages() {
}
void UserImageScreenHandler::AddProfileImage(const gfx::ImageSkia& image) {
- profile_picture_data_url_ = web_ui_util::GetImageDataUrl(image);
+ profile_picture_data_url_ = web_ui_util::GetBitmapDataUrl(*image.bitmap());
SendProfileImage(profile_picture_data_url_);
}
@@ -190,7 +190,7 @@ void UserImageScreenHandler::OnProfileImageAbsent() {
void UserImageScreenHandler::OnPhotoAccepted(const gfx::ImageSkia& photo) {
user_photo_ = photo;
- user_photo_data_url_ = web_ui_util::GetImageDataUrl(user_photo_);
+ user_photo_data_url_ = web_ui_util::GetBitmapDataUrl(*user_photo_.bitmap());
selected_image_ = User::kExternalImageIndex;
base::StringValue data_url(user_photo_data_url_);
web_ui()->CallJavascriptFunction("oobe.UserImageScreen.setUserPhoto",
diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
index 5918e30..31e6c8a 100644
--- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
@@ -62,7 +62,7 @@ SkBitmap GetGAIAPictureForNTP(const gfx::Image& image) {
gfx::Canvas canvas(gfx::Size(kLength, kLength), ui::SCALE_FACTOR_100P,
false);
- canvas.DrawImageInt(bmp, 0, 0);
+ canvas.DrawImageInt(gfx::ImageSkia(bmp), 0, 0);
// Draw a gray border on the inside of the icon.
SkColor color = SkColorSetARGB(83, 0, 0, 0);
@@ -214,8 +214,8 @@ void NTPLoginHandler::UpdateLogin() {
const gfx::Image* image =
cache.GetGAIAPictureOfProfileAtIndex(profile_index);
if (image)
- icon_url = web_ui_util::GetImageDataUrl(gfx::ImageSkia(
- GetGAIAPictureForNTP(*image)));
+ icon_url = web_ui_util::GetBitmapDataUrl(
+ GetGAIAPictureForNTP(*image));
}
if (header.empty())
header = CreateSpanWithClass(UTF8ToUTF16(username), "profile-name");
diff --git a/chrome/browser/ui/webui/options/autofill_options_handler.cc b/chrome/browser/ui/webui/options/autofill_options_handler.cc
index f428555..d348cf7 100644
--- a/chrome/browser/ui/webui/options/autofill_options_handler.cc
+++ b/chrome/browser/ui/webui/options/autofill_options_handler.cc
@@ -431,7 +431,7 @@ void AutofillOptionsHandler::LoadAutofillData() {
entry->Append(new StringValue((*i)->Label()));
int res = CreditCardTypeToResourceID((*i)->type());
entry->Append(
- new StringValue(web_ui_util::GetImageDataUrlFromResource(res)));
+ new StringValue(web_ui_util::GetBitmapDataUrlFromResource(res)));
entry->Append(new StringValue(LocalizedCreditCardType((*i)->type())));
credit_cards.Append(entry);
}
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
index 5f074e8..4866267 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -74,6 +74,7 @@
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "grit/theme_resources.h"
+#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "ui/base/l10n/l10n_util.h"
@@ -937,7 +938,7 @@ scoped_ptr<ListValue> BrowserOptionsHandler::GetProfilesInfoList() {
gfx::Image icon = profiles::GetAvatarIconForWebUI(
cache.GetAvatarIconOfProfileAtIndex(i), true);
profile_value->SetString("iconURL",
- web_ui_util::GetImageDataUrl(*icon.ToImageSkia()));
+ web_ui_util::GetBitmapDataUrl(icon.AsBitmap()));
} else {
size_t icon_index = cache.GetAvatarIconIndexOfProfileAtIndex(i);
profile_value->SetString("iconURL",
diff --git a/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc
index 06ebe11..ae76dbb 100644
--- a/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc
@@ -248,7 +248,8 @@ void ChangePictureOptionsHandler::SendSelectedImage() {
case User::kExternalImageIndex: {
// User has image from camera/file, record it and add to the image list.
previous_image_ = user->image();
- previous_image_data_url_ = web_ui_util::GetImageDataUrl(previous_image_);
+ previous_image_data_url_ =
+ web_ui_util::GetBitmapDataUrl(*previous_image_.bitmap());
web_ui()->CallJavascriptFunction("ChangePictureOptions.setOldImage");
break;
}
@@ -276,7 +277,7 @@ void ChangePictureOptionsHandler::SendSelectedImage() {
void ChangePictureOptionsHandler::SendProfileImage(const gfx::ImageSkia& image,
bool should_select) {
- base::StringValue data_url(web_ui_util::GetImageDataUrl(image));
+ base::StringValue data_url(web_ui_util::GetBitmapDataUrl(*image.bitmap()));
base::FundamentalValue select(should_select);
web_ui()->CallJavascriptFunction("ChangePictureOptions.setProfileImage",
data_url, select);
diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
index fbce06b..11f15f1 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
@@ -266,7 +266,7 @@ class NetworkInfoDictionary {
}
void set_icon(const gfx::ImageSkia& icon) {
gfx::ImageSkiaRep image_rep = icon.GetRepresentation(icon_scale_factor_);
- icon_url_ = icon.isNull() ? "" : web_ui_util::GetImageDataUrl(
+ icon_url_ = icon.isNull() ? "" : web_ui_util::GetBitmapDataUrl(
image_rep.sk_bitmap());
}
void set_name(const std::string& name) {
diff --git a/chrome/browser/ui/webui/options/manage_profile_handler.cc b/chrome/browser/ui/webui/options/manage_profile_handler.cc
index 3eec24b..e2f796f 100644
--- a/chrome/browser/ui/webui/options/manage_profile_handler.cc
+++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc
@@ -123,7 +123,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.ToImageSkia());
+ gaia_picture_url_ = web_ui_util::GetBitmapDataUrl(icon2.AsBitmap());
image_url_list.Append(Value::CreateStringValue(gaia_picture_url_));
}
}
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 08ea4bb..f7b85cc 100644
--- a/chrome/browser/ui/webui/task_manager/task_manager_handler.cc
+++ b/chrome/browser/ui/webui/task_manager/task_manager_handler.cc
@@ -66,7 +66,7 @@ Value* CreateColumnValue(const TaskManagerModel* tm,
}
if (column_name == "icon") {
return Value::CreateStringValue(
- web_ui_util::GetImageDataUrl(tm->GetResourceIcon(i)));
+ web_ui_util::GetBitmapDataUrl(*tm->GetResourceIcon(i).bitmap()));
}
if (column_name == "title")
return Value::CreateStringValue(tm->GetResourceTitle(i));
diff --git a/chrome/browser/ui/webui/web_ui_util.cc b/chrome/browser/ui/webui/web_ui_util.cc
index 2d43279..2001090 100644
--- a/chrome/browser/ui/webui/web_ui_util.cc
+++ b/chrome/browser/ui/webui/web_ui_util.cc
@@ -35,11 +35,11 @@ const ScaleFactorMap kScaleFactorMap[] = {
namespace web_ui_util {
-std::string GetImageDataUrl(const gfx::ImageSkia& image) {
+std::string GetBitmapDataUrl(const SkBitmap& bitmap) {
TRACE_EVENT2("oobe", "GetImageDataUrl",
- "width", image.width(), "height", image.height());
+ "width", bitmap.width(), "height", bitmap.height());
std::vector<unsigned char> output;
- gfx::PNGCodec::EncodeBGRASkBitmap(*image.bitmap(), false, &output);
+ gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &output);
std::string str_url;
str_url.insert(str_url.end(), output.begin(), output.end());
@@ -48,7 +48,7 @@ std::string GetImageDataUrl(const gfx::ImageSkia& image) {
return str_url;
}
-std::string GetImageDataUrlFromResource(int res) {
+std::string GetBitmapDataUrlFromResource(int res) {
// Load resource icon and covert to base64 encoded data url
base::RefCountedStaticMemory* icon_data =
ResourceBundle::GetSharedInstance().LoadDataResourceBytes(res,
diff --git a/chrome/browser/ui/webui/web_ui_util.h b/chrome/browser/ui/webui/web_ui_util.h
index 342423f..ea9f649 100644
--- a/chrome/browser/ui/webui/web_ui_util.h
+++ b/chrome/browser/ui/webui/web_ui_util.h
@@ -13,24 +13,21 @@
#include "webkit/glue/window_open_disposition.h"
class GURL;
-
-namespace gfx {
-class ImageSkia;
-}
+class SkBitmap;
namespace web_ui_util {
-// Convenience routine to convert ImageSkia object to data url
+// Convenience routine to convert SkBitmap object to data url
// so that it can be used in WebUI.
-std::string GetImageDataUrl(const gfx::ImageSkia& image);
+std::string GetBitmapDataUrl(const SkBitmap& bitmap);
// Convenience routine to get data url that corresponds to given
-// resource_id as an image. This function does not check if the
-// resource for the |resource_id| is an image, therefore it is the
-// caller's responsibility to make sure the resource is indeed an
-// image. Returns empty string if a resource does not exist for given
+// resource_id as a bitmap. This function does not check if the
+// resource for the |resource_id| is a bitmap, therefore it is the
+// caller's responsibility to make sure the resource is indeed a
+// bitmap. Returns empty string if a resource does not exist for given
// |resource_id|.
-std::string GetImageDataUrlFromResource(int resource_id);
+std::string GetBitmapDataUrlFromResource(int resource_id);
// Extracts a disposition from click event arguments. |args| should contain
// an integer button and booleans alt key, ctrl key, meta key, and shift key
diff --git a/chrome/common/badge_util.cc b/chrome/common/badge_util.cc
index 42668e8..e33f8d4 100644
--- a/chrome/common/badge_util.cc
+++ b/chrome/common/badge_util.cc
@@ -86,7 +86,7 @@ SkBitmap DrawBadgeIconOverlay(const SkBitmap& icon,
// Render the badge bitmap and overlay into a canvas.
scoped_ptr<gfx::Canvas> canvas(new gfx::Canvas(
gfx::Size(badge_width, icon.height()), ui::SCALE_FACTOR_100P, false));
- canvas->DrawImageInt(icon, 0, 0);
+ canvas->DrawImageInt(gfx::ImageSkia(icon), 0, 0);
// Draw the text overlay centered horizontally and vertically. Skia expects
// us to specify the lower left coordinate of the text box, which is why we
diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc
index cf80df1..961010d 100644
--- a/content/browser/renderer_host/render_widget_host_view_win.cc
+++ b/content/browser/renderer_host/render_widget_host_view_win.cc
@@ -1431,7 +1431,9 @@ void RenderWidgetHostViewWin::DrawBackground(const RECT& dirty_rect,
canvas.Translate(gfx::Point().Subtract(dirty_area.origin()));
gfx::Rect dc_rect(dc->m_ps.rcPaint);
- canvas.TileImageInt(background_, 0, 0, dc_rect.width(), dc_rect.height());
+ // TODO(pkotwicz): Fix |background_| such that it is an ImageSkia.
+ canvas.TileImageInt(gfx::ImageSkia(background_),
+ 0, 0, dc_rect.width(), dc_rect.height());
skia::DrawToNativeContext(canvas.sk_canvas(), *dc, dirty_area.x(),
dirty_area.y(), NULL);
diff --git a/content/browser/web_contents/web_contents_drag_win.cc b/content/browser/web_contents/web_contents_drag_win.cc
index 85ef3eb..a513315 100644
--- a/content/browser/web_contents/web_contents_drag_win.cc
+++ b/content/browser/web_contents/web_contents_drag_win.cc
@@ -176,17 +176,11 @@ void WebContentsDragWin::StartDragging(const WebDropData& drop_data,
base::Thread::Options options;
options.message_loop_type = MessageLoop::TYPE_UI;
if (drag_drop_thread_->StartWithOptions(options)) {
- gfx::Display display =
- gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(
- web_contents_->GetNativeView());
- ui::ScaleFactor scale_factor = ui::GetScaleFactorFromScale(
- display.device_scale_factor());
drag_drop_thread_->message_loop()->PostTask(
FROM_HERE,
base::Bind(&WebContentsDragWin::StartBackgroundDragging, this,
drop_data, ops, page_url, page_encoding,
- image.GetRepresentation(scale_factor).sk_bitmap(),
- image_offset));
+ image, image_offset));
}
EnableBackgroundDraggingSupport(drag_drop_thread_->thread_id());
@@ -197,7 +191,7 @@ void WebContentsDragWin::StartBackgroundDragging(
WebDragOperationsMask ops,
const GURL& page_url,
const std::string& page_encoding,
- const SkBitmap& image,
+ const gfx::ImageSkia& image,
const gfx::Point& image_offset) {
drag_drop_thread_id_ = base::PlatformThread::CurrentId();
diff --git a/content/browser/web_contents/web_contents_drag_win.h b/content/browser/web_contents/web_contents_drag_win.h
index f60401c..73c65c1 100644
--- a/content/browser/web_contents/web_contents_drag_win.h
+++ b/content/browser/web_contents/web_contents_drag_win.h
@@ -83,7 +83,7 @@ class CONTENT_EXPORT WebContentsDragWin
WebKit::WebDragOperationsMask ops,
const GURL& page_url,
const std::string& page_encoding,
- const SkBitmap& image,
+ const gfx::ImageSkia& image,
const gfx::Point& image_offset);
// Called on UI thread.
void EndDragging();
diff --git a/ui/gfx/image/image_skia.h b/ui/gfx/image/image_skia.h
index 5221e31..023ccbe 100644
--- a/ui/gfx/image/image_skia.h
+++ b/ui/gfx/image/image_skia.h
@@ -52,9 +52,7 @@ class UI_EXPORT ImageSkia {
// Adds ref to passed in bitmap.
// DIP width and height are set based on scale factor of 1x.
- // TODO(pkotwicz): This is temporary till conversion to gfx::ImageSkia is
- // done.
- ImageSkia(const SkBitmap& bitmap);
+ explicit ImageSkia(const SkBitmap& bitmap);
explicit ImageSkia(const gfx::ImageSkiaRep& image_rep);
diff --git a/ui/views/examples/table_example.cc b/ui/views/examples/table_example.cc
index b7f84ff..c5ca6d6 100644
--- a/ui/views/examples/table_example.cc
+++ b/ui/views/examples/table_example.cc
@@ -114,7 +114,7 @@ string16 TableExample::GetText(int row, int column_id) {
}
gfx::ImageSkia TableExample::GetIcon(int row) {
- return row % 2 ? icon1_ : icon2_;
+ return row % 2 ? gfx::ImageSkia(icon1_) : gfx::ImageSkia(icon2_);
}
void TableExample::SetObserver(ui::TableModelObserver* observer) {}