Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2304)

Unified Diff: app/menus/simple_menu_model.cc

Issue 5697005: Change SimpleMenuModel on OSX to support dynamic icons (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update after merge Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « app/menus/simple_menu_model.h ('k') | chrome/browser/autocomplete/autocomplete_edit_view_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/menus/simple_menu_model.cc
diff --git a/app/menus/simple_menu_model.cc b/app/menus/simple_menu_model.cc
index b645b098305b6e3debbf74768b603f56693ba2b4..427bbf15d01bb164f72314c6d384f447ac336ef1 100644
--- a/app/menus/simple_menu_model.cc
+++ b/app/menus/simple_menu_model.cc
@@ -28,7 +28,7 @@ bool SimpleMenuModel::Delegate::IsCommandIdVisible(int command_id) const {
return true;
}
-bool SimpleMenuModel::Delegate::IsLabelForCommandIdDynamic(
+bool SimpleMenuModel::Delegate::IsItemForCommandIdDynamic(
int command_id) const {
return false;
}
@@ -37,6 +37,11 @@ string16 SimpleMenuModel::Delegate::GetLabelForCommandId(int command_id) const {
return string16();
}
+bool SimpleMenuModel::Delegate::GetIconForCommandId(
+ int command_id, SkBitmap* bitmap) const {
+ return false;
+}
+
void SimpleMenuModel::Delegate::CommandIdHighlighted(int command_id) {
}
@@ -201,14 +206,14 @@ int SimpleMenuModel::GetCommandIdAt(int index) const {
}
string16 SimpleMenuModel::GetLabelAt(int index) const {
- if (IsLabelDynamicAt(index))
+ if (IsItemDynamicAt(index))
return delegate_->GetLabelForCommandId(GetCommandIdAt(index));
return items_.at(FlipIndex(index)).label;
}
-bool SimpleMenuModel::IsLabelDynamicAt(int index) const {
+bool SimpleMenuModel::IsItemDynamicAt(int index) const {
if (delegate_)
- return delegate_->IsLabelForCommandIdDynamic(GetCommandIdAt(index));
+ return delegate_->IsItemForCommandIdDynamic(GetCommandIdAt(index));
return false;
}
@@ -235,6 +240,9 @@ int SimpleMenuModel::GetGroupIdAt(int index) const {
}
bool SimpleMenuModel::GetIconAt(int index, SkBitmap* icon) const {
+ if (IsItemDynamicAt(index))
+ return delegate_->GetIconForCommandId(GetCommandIdAt(index), icon);
+
if (items_[index].icon.isNull())
return false;
« no previous file with comments | « app/menus/simple_menu_model.h ('k') | chrome/browser/autocomplete/autocomplete_edit_view_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698