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

Side by Side Diff: views/controls/menu/native_menu_gtk.cc

Issue 1075014: Linux: Fix some GdkPixbuf leaks. (Closed)
Patch Set: move BrowserThemeProvider comment to the public functions Created 10 years, 9 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
« no previous file with comments | « tools/heapcheck/suppressions.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "views/controls/menu/native_menu_gtk.h" 5 #include "views/controls/menu/native_menu_gtk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 break; 217 break;
218 case menus::MenuModel::TYPE_SUBMENU: 218 case menus::MenuModel::TYPE_SUBMENU:
219 case menus::MenuModel::TYPE_COMMAND: { 219 case menus::MenuModel::TYPE_COMMAND: {
220 SkBitmap icon; 220 SkBitmap icon;
221 // Create menu item with icon if icon exists. 221 // Create menu item with icon if icon exists.
222 if (model_->HasIcons() && model_->GetIconAt(index, &icon)) { 222 if (model_->HasIcons() && model_->GetIconAt(index, &icon)) {
223 menu_item = gtk_image_menu_item_new_with_mnemonic(label.c_str()); 223 menu_item = gtk_image_menu_item_new_with_mnemonic(label.c_str());
224 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&icon); 224 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&icon);
225 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item), 225 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item),
226 gtk_image_new_from_pixbuf(pixbuf)); 226 gtk_image_new_from_pixbuf(pixbuf));
227 g_object_unref(pixbuf);
227 } else { 228 } else {
228 menu_item = gtk_menu_item_new_with_mnemonic(label.c_str()); 229 menu_item = gtk_menu_item_new_with_mnemonic(label.c_str());
229 } 230 }
230 break; 231 break;
231 } 232 }
232 default: 233 default:
233 NOTREACHED(); 234 NOTREACHED();
234 break; 235 break;
235 } 236 }
236 237
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 414
414 //////////////////////////////////////////////////////////////////////////////// 415 ////////////////////////////////////////////////////////////////////////////////
415 // MenuWrapper, public: 416 // MenuWrapper, public:
416 417
417 // static 418 // static
418 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { 419 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) {
419 return new NativeMenuGtk(menu); 420 return new NativeMenuGtk(menu);
420 } 421 }
421 422
422 } // namespace views 423 } // namespace views
OLDNEW
« no previous file with comments | « tools/heapcheck/suppressions.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698