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

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

Issue 141035: Refactor the favicon loader out of gtk/options/general_page_gtk to gtk/list_store_favicon_loader, (Closed)
Patch Set: rebase Created 11 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
« no previous file with comments | « no previous file | chrome/browser/gtk/list_store_favicon_loader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_GTK_LIST_STORE_FAVICON_LOADER_H_
6 #define CHROME_BROWSER_GTK_LIST_STORE_FAVICON_LOADER_H_
7
8 #include <gtk/gtk.h>
9
10 #include "chrome/browser/history/history.h"
11 #include "googleurl/src/gurl.h"
12
13 class Profile;
14
15 // Handles loading favicons into a GDK_TYPE_PIXBUF column of a GtkListStore.
16 // The GtkListStore must also have a G_TYPE_INT column, passed as
17 // |favicon_handle_col|, which will be used internally by the loader.
18 // Note: this implementation will be inefficient if the GtkListStore has a large
19 // number of rows.
20 class ListStoreFavIconLoader {
21 public:
22 ListStoreFavIconLoader(GtkListStore* list_store,
23 gint favicon_col,
24 gint favicon_handle_col,
25 Profile* profile,
26 CancelableRequestConsumer* consumer);
27
28 // Start loading the favicon for |url| into the row |iter|.
29 void LoadFaviconForRow(const GURL& url, GtkTreeIter* iter);
30
31 private:
32 // Find a row from the GetFavIconForURL handle. Returns true if the row was
33 // found.
34 bool GetRowByFavIconHandle(HistoryService::Handle handle,
35 GtkTreeIter* result_iter);
36
37 // Callback from HistoryService:::GetFavIconForURL
38 void OnGotFavIcon(HistoryService::Handle handle, bool know_fav_icon,
39 scoped_refptr<RefCountedBytes> image_data, bool is_expired,
40 GURL icon_url);
41
42 // The list store we are loading favicons into.
43 GtkListStore* list_store_;
44
45 // The index of the GDK_TYPE_PIXBUF column to receive the favicons.
46 gint favicon_col_;
47
48 // The index of the G_TYPE_INT column used internally to track the
49 // HistoryService::Handle of each favicon request.
50 gint favicon_handle_col_;
51
52 // The profile from which we will get the HistoryService.
53 Profile* profile_;
54
55 // Used in loading favicons.
56 CancelableRequestConsumer* consumer_;
57
58 // Default icon to show when one can't be found for the URL. This is owned by
59 // the ResourceBundle and we do not need to free it.
60 GdkPixbuf* default_favicon_;
61
62 DISALLOW_COPY_AND_ASSIGN(ListStoreFavIconLoader);
63 };
64
65 #endif // CHROME_BROWSER_GTK_LIST_STORE_FAVICON_LOADER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/list_store_favicon_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698