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

Side by Side Diff: chrome/browser/gtk/list_store_favicon_loader.cc

Issue 165194: GTK: Use stock icons for bookmark folder and default favicon.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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
« no previous file with comments | « chrome/browser/gtk/list_store_favicon_loader.h ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/gtk/list_store_favicon_loader.h" 5 #include "chrome/browser/gtk/list_store_favicon_loader.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/gfx/gtk_util.h" 8 #include "base/gfx/gtk_util.h"
9 #include "base/gfx/png_decoder.h" 9 #include "base/gfx/png_decoder.h"
10 #include "chrome/browser/gtk/bookmark_utils_gtk.h"
10 #include "chrome/browser/profile.h" 11 #include "chrome/browser/profile.h"
11 #include "grit/app_resources.h" 12 #include "grit/app_resources.h"
12 #include "third_party/skia/include/core/SkBitmap.h" 13 #include "third_party/skia/include/core/SkBitmap.h"
13 14
14 ListStoreFavIconLoader::ListStoreFavIconLoader( 15 ListStoreFavIconLoader::ListStoreFavIconLoader(
15 GtkListStore* list_store, gint favicon_col, gint favicon_handle_col, 16 GtkListStore* list_store, gint favicon_col, gint favicon_handle_col,
16 Profile* profile, CancelableRequestConsumer* consumer) 17 Profile* profile, CancelableRequestConsumer* consumer)
17 : list_store_(list_store), favicon_col_(favicon_col), 18 : list_store_(list_store), favicon_col_(favicon_col),
18 favicon_handle_col_(favicon_handle_col), profile_(profile), 19 favicon_handle_col_(favicon_handle_col), profile_(profile),
19 consumer_(consumer) { 20 consumer_(consumer),
20 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 21 default_favicon_(bookmark_utils::GetDefaultFavicon(true)) {
21 default_favicon_ = rb.GetPixbufNamed(IDR_DEFAULT_FAVICON); 22 }
23
24 ListStoreFavIconLoader::~ListStoreFavIconLoader() {
25 g_object_unref(default_favicon_);
22 } 26 }
23 27
24 void ListStoreFavIconLoader::LoadFaviconForRow(const GURL& url, 28 void ListStoreFavIconLoader::LoadFaviconForRow(const GURL& url,
25 GtkTreeIter* iter) { 29 GtkTreeIter* iter) {
26 HistoryService* history = 30 HistoryService* history =
27 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); 31 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
28 if (history) { 32 if (history) {
29 HistoryService::Handle handle = history->GetFavIconForURL( 33 HistoryService::Handle handle = history->GetFavIconForURL(
30 url, consumer_, 34 url, consumer_,
31 NewCallback(this, &ListStoreFavIconLoader::OnGotFavIcon)); 35 NewCallback(this, &ListStoreFavIconLoader::OnGotFavIcon));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 memcpy(icon.getPixels(), &decoded_data.front(), 81 memcpy(icon.getPixels(), &decoded_data.front(),
78 width * height * 4); 82 width * height * 4);
79 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&icon); 83 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&icon);
80 gtk_list_store_set(list_store_, &iter, 84 gtk_list_store_set(list_store_, &iter,
81 favicon_col_, pixbuf, 85 favicon_col_, pixbuf,
82 -1); 86 -1);
83 g_object_unref(pixbuf); 87 g_object_unref(pixbuf);
84 } 88 }
85 } 89 }
86 } 90 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/list_store_favicon_loader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698