summaryrefslogtreecommitdiffstats
path: root/ui/base/models/simple_menu_model.cc
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-24 15:17:39 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-24 15:17:39 +0000
commit964e09d587e7e7135353ada8b430b034a9bef0bc (patch)
treefea4e8ad04d85e2832f41003087156bac1354e69 /ui/base/models/simple_menu_model.cc
parent5a3bdf5a67b78125b0e117aad5543cab1525a053 (diff)
downloadchromium_src-964e09d587e7e7135353ada8b430b034a9bef0bc.zip
chromium_src-964e09d587e7e7135353ada8b430b034a9bef0bc.tar.gz
chromium_src-964e09d587e7e7135353ada8b430b034a9bef0bc.tar.bz2
Converts ui/views/controls, ui/views/examples, ui/base/models to use gfx::ImageSkia
Converts all instances using an SkBitmap to use a gfx::ImageSkia instead Replaces method names, variables and comments which include "bitmap" to use "image" instead Sed script used for conversion: 1 # Modify comments. 2 /\/\// { 3 # Save line in hold buffer. 4 h 5 # Extract portion of line which represents comment 6 # and put that into pattern space. 7 s|.*//\(.*\)|\1| 8 # Perform changes. 9 s| SkBitmap| ImageSkia|g 10 s| a bitmap| an image|g 11 s| Bitmap| Image|g 12 s| bitmap| image|g 13 # Append hold buffer to pattern space, 14 G 15 # Put everything back together. 16 s|\(.*\)\n\(.*\)//.*|\2//\1| 17 } 18 19 # Modify code. 20 # 21 # Store in hold buffer [code part ]//[comment part(including //)]. 22 # Thus you would get 4 consecutive slashes if the line actually does 23 # have a comment. 24 # Extract portion of line which has code and put that into pattern space. 25 26 # Line has a comment. 27 /\/\// { 28 s|\(.*\)//\(.*\)|\1////\2| 29 h 30 s|\(.*\)//.*|\1| 31 } 32 # No comment on line 33 /\/\// !{ 34 s|\(.*\)|\1//| 35 h 36 s|\(.*\)//|\1| 37 } 38 39 # Perform Changes 40 41 # Delete calls. 42 /buildMipMap(false)/d 43 # Replace includes. 44 s|third_party/skia/include/core/SkBitmap\.h|ui/gfx/image/image_skia\.h|g 45 s|ToSkBitmap|ToImageSkia|g 46 s|GetBitmapNamed|GetImageSkiaNamed|g 47 # Rename variables of type SkBitmap to variables of type gfx::ImageSkia 48 # Try to avoid renaming function names and classes which have 'SkBitmap' 49 # in them. 50 s|SkBitmap\([ (*&>),]\)|gfx::ImageSkia\1|g 51 # Modify variable names. 52 s|_bitmap|_image|g 53 s|bitmap|image_skia|g 54 s|bmp|image_skia|g 55 # Rename functions and classes which have 'SkBitmap' in them to use 'ImageSkia' instead 56 s|SkBitmap|ImageSkia|g 57 s|Bitmap|Image|g 58 # Restore things we didn't mean to change. 59 # SkImageOperations 60 s|ImageSkiaOperations|SkBitmapOperations|g 61 s|SkBitmapOperations::Create\(.*\)Image(|SkBitmapOperations::Create\1Bitmap(|g 62 s|skimage_skia_operations|skbitmap_operations|g 63 # SkPaint 64 s|setFilterImage|setFilterBitmap|g 65 s|isFilterImage|isFilterBitmap|g 66 # gfx::Canvas 67 s|ExtractImage|ExtractBitmap|g 68 # We will want to rename this function after everything else has changed. 69 s|DrawImageInt|DrawBitmapInt|g 70 71 # Append hold buffer to pattern space. 72 # Pattern space will look like: [code part]\n[code part]//[comment part (includi ng //). 73 G 74 # Put everything back together. 75 s|\(.*\)\n\(.*\)//\(.*\)|\1\3| I modified the following files manually afterwards: 1 ash/wm/workspace/frame_maximize_button.cc 2 ash/wm/workspace/frame_maximize_button.h 3 chrome/browser/chromeos/login/helper.cc 4 chrome/browser/chromeos/status/network_menu.cc 5 chrome/browser/cookies_tree_model.cc 6 chrome/browser/cookies_tree_model.h 7 chrome/browser/ui/gtk/gtk_tree.cc 8 chrome/browser/ui/gtk/menu_gtk.cc 9 chrome/browser/ui/search_engines/template_url_table_model.cc 10 chrome/browser/ui/search_engines/template_url_table_model.h 11 chrome/browser/ui/toolbar/back_forward_menu_model.cc 12 chrome/browser/ui/toolbar/back_forward_menu_model.h 13 chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc 14 chrome/browser/ui/toolbar/wrench_menu_model.cc 15 chrome/browser/ui/toolbar/wrench_menu_model.h 16 chrome/browser/ui/views/hung_renderer_view.cc 17 chrome/browser/ui/views/infobars/infobar_button_border.cc 18 chrome/browser/ui/views/infobars/infobar_view.cc 19 chrome/browser/ui/views/task_manager_view.cc 20 chrome/browser/ui/views/web_intent_picker_views.cc 21 chrome/browser/ui/views/wrench_menu.cc 22 chrome/browser/ui/webui/chromeos/login/network_dropdown.cc 23 ui/views/controls/button/image_button.cc 24 ui/views/controls/button/image_button_unittest.cc 25 ui/views/controls/image_view.cc 26 ui/views/controls/image_view.h 27 ui/views/controls/scrollbar/bitmap_scroll_bar.cc 28 ui/views/controls/scrollbar/bitmap_scroll_bar.h 29 ui/views/controls/scrollbar/scroll_bar.h 30 ui/views/controls/table/table_view_win.cc 31 ui/views/controls/tree/tree_view_views.h 32 ui/views/controls/tree/tree_view_win.cc 33 ui/views/examples/table_example.cc 34 ui/views/view_unittest.cc Whitespace changes and changes in includes in: 1 ui/base/models/menu_model.h 2 ui/base/models/table_model.h 3 ui/base/models/tree_model.h 4 ui/views/controls/glow_hover_controller.h 5 ui/views/controls/menu/menu.h 6 ui/views/controls/menu/menu_config_views.cc 7 ui/views/controls/menu/native_menu_win.cc 8 ui/views/controls/message_box_view.h 9 ui/views/controls/table/table_view_views.cc 10 ui/views/controls/throbber.h 11 ui/views/examples/table_example.h TBR=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/10437006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138800 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/models/simple_menu_model.cc')
-rw-r--r--ui/base/models/simple_menu_model.cc40
1 files changed, 23 insertions, 17 deletions
diff --git a/ui/base/models/simple_menu_model.cc b/ui/base/models/simple_menu_model.cc
index be84356..3a38b0d 100644
--- a/ui/base/models/simple_menu_model.cc
+++ b/ui/base/models/simple_menu_model.cc
@@ -6,8 +6,8 @@
#include "base/bind.h"
#include "base/message_loop.h"
-#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/gfx/image/image_skia.h"
namespace ui {
@@ -16,7 +16,7 @@ const int kSeparatorId = -1;
struct SimpleMenuModel::Item {
int command_id;
string16 label;
- SkBitmap icon;
+ gfx::ImageSkia icon;
ItemType type;
int group_id;
MenuModel* submenu;
@@ -40,7 +40,7 @@ string16 SimpleMenuModel::Delegate::GetLabelForCommandId(int command_id) const {
}
bool SimpleMenuModel::Delegate::GetIconForCommandId(
- int command_id, SkBitmap* bitmap) const {
+ int command_id, gfx::ImageSkia* image_skia) const {
return false;
}
@@ -71,7 +71,8 @@ SimpleMenuModel::~SimpleMenuModel() {
}
void SimpleMenuModel::AddItem(int command_id, const string16& label) {
- Item item = { command_id, label, SkBitmap(), TYPE_COMMAND, -1, NULL, NULL };
+ Item item = { command_id, label, gfx::ImageSkia(), TYPE_COMMAND, -1, NULL,
+ NULL };
AppendItem(item);
}
@@ -80,13 +81,14 @@ void SimpleMenuModel::AddItemWithStringId(int command_id, int string_id) {
}
void SimpleMenuModel::AddSeparator() {
- Item item = { kSeparatorId, string16(), SkBitmap(), TYPE_SEPARATOR, -1,
+ Item item = { kSeparatorId, string16(), gfx::ImageSkia(), TYPE_SEPARATOR, -1,
NULL, NULL };
AppendItem(item);
}
void SimpleMenuModel::AddCheckItem(int command_id, const string16& label) {
- Item item = { command_id, label, SkBitmap(), TYPE_CHECK, -1, NULL, NULL };
+ Item item = { command_id, label, gfx::ImageSkia(), TYPE_CHECK, -1, NULL,
+ NULL };
AppendItem(item);
}
@@ -96,7 +98,7 @@ void SimpleMenuModel::AddCheckItemWithStringId(int command_id, int string_id) {
void SimpleMenuModel::AddRadioItem(int command_id, const string16& label,
int group_id) {
- Item item = { command_id, label, SkBitmap(), TYPE_RADIO, group_id, NULL,
+ Item item = { command_id, label, gfx::ImageSkia(), TYPE_RADIO, group_id, NULL,
NULL };
AppendItem(item);
}
@@ -108,14 +110,15 @@ void SimpleMenuModel::AddRadioItemWithStringId(int command_id, int string_id,
void SimpleMenuModel::AddButtonItem(int command_id,
ButtonMenuItemModel* model) {
- Item item = { command_id, string16(), SkBitmap(), TYPE_BUTTON_ITEM, -1, NULL,
- model };
+ Item item = { command_id, string16(), gfx::ImageSkia(), TYPE_BUTTON_ITEM, -1,
+ NULL, model };
AppendItem(item);
}
void SimpleMenuModel::AddSubMenu(int command_id, const string16& label,
MenuModel* model) {
- Item item = { command_id, label, SkBitmap(), TYPE_SUBMENU, -1, model, NULL };
+ Item item = { command_id, label, gfx::ImageSkia(), TYPE_SUBMENU, -1, model,
+ NULL };
AppendItem(item);
}
@@ -126,7 +129,8 @@ void SimpleMenuModel::AddSubMenuWithStringId(int command_id,
void SimpleMenuModel::InsertItemAt(
int index, int command_id, const string16& label) {
- Item item = { command_id, label, SkBitmap(), TYPE_COMMAND, -1, NULL, NULL };
+ Item item = { command_id, label, gfx::ImageSkia(), TYPE_COMMAND, -1, NULL,
+ NULL };
InsertItemAtIndex(item, index);
}
@@ -136,14 +140,15 @@ void SimpleMenuModel::InsertItemWithStringIdAt(
}
void SimpleMenuModel::InsertSeparatorAt(int index) {
- Item item = { kSeparatorId, string16(), SkBitmap(), TYPE_SEPARATOR, -1,
+ Item item = { kSeparatorId, string16(), gfx::ImageSkia(), TYPE_SEPARATOR, -1,
NULL, NULL };
InsertItemAtIndex(item, index);
}
void SimpleMenuModel::InsertCheckItemAt(
int index, int command_id, const string16& label) {
- Item item = { command_id, label, SkBitmap(), TYPE_CHECK, -1, NULL, NULL };
+ Item item = { command_id, label, gfx::ImageSkia(), TYPE_CHECK, -1, NULL,
+ NULL };
InsertItemAtIndex(item, index);
}
@@ -155,7 +160,7 @@ void SimpleMenuModel::InsertCheckItemWithStringIdAt(
void SimpleMenuModel::InsertRadioItemAt(
int index, int command_id, const string16& label, int group_id) {
- Item item = { command_id, label, SkBitmap(), TYPE_RADIO, group_id, NULL,
+ Item item = { command_id, label, gfx::ImageSkia(), TYPE_RADIO, group_id, NULL,
NULL };
InsertItemAtIndex(item, index);
}
@@ -168,7 +173,8 @@ void SimpleMenuModel::InsertRadioItemWithStringIdAt(
void SimpleMenuModel::InsertSubMenuAt(
int index, int command_id, const string16& label, MenuModel* model) {
- Item item = { command_id, label, SkBitmap(), TYPE_SUBMENU, -1, model, NULL };
+ Item item = { command_id, label, gfx::ImageSkia(), TYPE_SUBMENU, -1, model,
+ NULL };
InsertItemAtIndex(item, index);
}
@@ -178,7 +184,7 @@ void SimpleMenuModel::InsertSubMenuWithStringIdAt(
model);
}
-void SimpleMenuModel::SetIcon(int index, const SkBitmap& icon) {
+void SimpleMenuModel::SetIcon(int index, const gfx::ImageSkia& icon) {
items_[index].icon = icon;
}
@@ -253,7 +259,7 @@ int SimpleMenuModel::GetGroupIdAt(int index) const {
return items_.at(FlipIndex(index)).group_id;
}
-bool SimpleMenuModel::GetIconAt(int index, SkBitmap* icon) {
+bool SimpleMenuModel::GetIconAt(int index, gfx::ImageSkia* icon) {
if (IsItemDynamicAt(index))
return delegate_->GetIconForCommandId(GetCommandIdAt(index), icon);