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

Side by Side Diff: chrome/browser/ui/gtk/bookmarks/bookmark_sub_menu_model_gtk.cc

Issue 10824402: Convert ui::MenuModel to use gfx::Image instead of ImageSkia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another day, another rebase Created 8 years, 4 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_sub_menu_model_gtk.h" 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_sub_menu_model_gtk.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } else { 75 } else {
76 // Ironically the label will end up getting converted back to UTF8 later. 76 // Ironically the label will end up getting converted back to UTF8 later.
77 // We need to escape any Windows-style "&" characters since they will be 77 // We need to escape any Windows-style "&" characters since they will be
78 // converted in MenuGtk outside of our control here. 78 // converted in MenuGtk outside of our control here.
79 const string16 label = UTF8ToUTF16(ui::EscapeWindowsStyleAccelerators( 79 const string16 label = UTF8ToUTF16(ui::EscapeWindowsStyleAccelerators(
80 bookmark_utils::BuildMenuLabelFor(child))); 80 bookmark_utils::BuildMenuLabelFor(child)));
81 // No command id. We override ActivatedAt below to handle activations. 81 // No command id. We override ActivatedAt below to handle activations.
82 AddItem(kBookmarkItemCommandId, label); 82 AddItem(kBookmarkItemCommandId, label);
83 const gfx::Image& node_icon = model_->GetFavicon(child); 83 const gfx::Image& node_icon = model_->GetFavicon(child);
84 if (!node_icon.IsEmpty()) 84 if (!node_icon.IsEmpty())
85 SetIcon(GetItemCount() - 1, *node_icon.ToSkBitmap()); 85 SetIcon(GetItemCount() - 1, node_icon);
86 // TODO(mdm): set up an observer to watch for icon load events and set 86 // TODO(mdm): set up an observer to watch for icon load events and set
87 // the icons in response. 87 // the icons in response.
88 } 88 }
89 } 89 }
90 } 90 }
91 91
92 void BookmarkNodeMenuModel::AddSubMenuForNode(const BookmarkNode* node) { 92 void BookmarkNodeMenuModel::AddSubMenuForNode(const BookmarkNode* node) {
93 DCHECK(node->is_folder()); 93 DCHECK(node->is_folder());
94 // Ironically the label will end up getting converted back to UTF8 later. 94 // Ironically the label will end up getting converted back to UTF8 later.
95 // We need to escape any Windows-style "&" characters since they will be 95 // We need to escape any Windows-style "&" characters since they will be
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 bool BookmarkSubMenuModel::IsVisibleAt(int index) const { 222 bool BookmarkSubMenuModel::IsVisibleAt(int index) const {
223 // We don't want the delegate interfering with bookmark items. 223 // We don't want the delegate interfering with bookmark items.
224 return index >= fixed_items_ || SimpleMenuModel::IsVisibleAt(index); 224 return index >= fixed_items_ || SimpleMenuModel::IsVisibleAt(index);
225 } 225 }
226 226
227 // static 227 // static
228 bool BookmarkSubMenuModel::IsBookmarkItemCommandId(int command_id) { 228 bool BookmarkSubMenuModel::IsBookmarkItemCommandId(int command_id) {
229 return command_id == kBookmarkItemCommandId; 229 return command_id == kBookmarkItemCommandId;
230 } 230 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/toolbar/back_forward_menu_controller.mm ('k') | chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698