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

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

Issue 10451102: fix a memory leak and add a suppression (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 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_tree_model.h" 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_tree_model.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/bookmarks/bookmark_model.h" 11 #include "chrome/browser/bookmarks/bookmark_model.h"
12 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" 12 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h"
13 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 13 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
14 #include "ui/gfx/image/image.h" 14 #include "ui/gfx/image/image.h"
15 15
16 namespace { 16 namespace {
17 17
18 const char* kCellRendererTextKey = "__CELL_RENDERER_TEXT__"; 18 const char* kCellRendererTextKey = "__CELL_RENDERER_TEXT__";
19 19
20 void AddSingleNodeToTreeStore(GtkTreeStore* store, const BookmarkNode* node, 20 void AddSingleNodeToTreeStore(GtkTreeStore* store, const BookmarkNode* node,
21 GtkTreeIter *iter, GtkTreeIter* parent) { 21 GtkTreeIter *iter, GtkTreeIter* parent) {
22 gtk_tree_store_append(store, iter, parent); 22 gtk_tree_store_append(store, iter, parent);
23 // It would be easy to show a different icon when the folder is open (as they 23 // It would be easy to show a different icon when the folder is open (as they
24 // do on Windows, for example), using pixbuf-expander-closed and 24 // do on Windows, for example), using pixbuf-expander-closed and
25 // pixbuf-expander-open. Unfortunately there is no GTK_STOCK_OPEN_DIRECTORY 25 // pixbuf-expander-open. Unfortunately there is no GTK_STOCK_OPEN_DIRECTORY
26 // (and indeed, Nautilus does not render an expanded directory any 26 // (and indeed, Nautilus does not render an expanded directory any
27 // differently). 27 // differently).
28 gtk_tree_store_set(store, iter, 28 gtk_tree_store_set(store, iter,
29 bookmark_utils::FOLDER_ICON, 29 bookmark_utils::FOLDER_ICON,
30 GtkThemeService::GetFolderIcon(true)->ToGdkPixbuf(), 30 GtkThemeService::GetFolderIcon(true).ToGdkPixbuf(),
31 bookmark_utils::FOLDER_NAME, 31 bookmark_utils::FOLDER_NAME,
32 UTF16ToUTF8(node->GetTitle()).c_str(), 32 UTF16ToUTF8(node->GetTitle()).c_str(),
33 bookmark_utils::ITEM_ID, node->id(), 33 bookmark_utils::ITEM_ID, node->id(),
34 // We don't want to use node->is_folder() because that would let the 34 // We don't want to use node->is_folder() because that would let the
35 // user edit "Bookmarks Bar" and "Other Bookmarks". 35 // user edit "Bookmarks Bar" and "Other Bookmarks".
36 bookmark_utils::IS_EDITABLE, node->type() == BookmarkNode::FOLDER, 36 bookmark_utils::IS_EDITABLE, node->type() == BookmarkNode::FOLDER,
37 -1); 37 -1);
38 } 38 }
39 39
40 // Helper function for CommitTreeStoreDifferencesBetween() which recursively 40 // Helper function for CommitTreeStoreDifferencesBetween() which recursively
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 ret_val = UTF8ToUTF16(utf8str); 238 ret_val = UTF8ToUTF16(utf8str);
239 g_value_unset(&value); 239 g_value_unset(&value);
240 } else { 240 } else {
241 NOTREACHED() << "Impossible type mismatch"; 241 NOTREACHED() << "Impossible type mismatch";
242 } 242 }
243 243
244 return ret_val; 244 return ret_val;
245 } 245 }
246 246
247 } // namespace bookmark_utils 247 } // namespace bookmark_utils
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc ('k') | chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698