| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_GTK_LIST_STORE_FAVICON_LOADER_H_ | 5 #ifndef CHROME_BROWSER_GTK_LIST_STORE_FAVICON_LOADER_H_ |
| 6 #define CHROME_BROWSER_GTK_LIST_STORE_FAVICON_LOADER_H_ | 6 #define CHROME_BROWSER_GTK_LIST_STORE_FAVICON_LOADER_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "chrome/browser/history/history.h" | 10 #include "chrome/browser/history/history.h" |
| 11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| 12 | 12 |
| 13 class Profile; | 13 class Profile; |
| 14 | 14 |
| 15 // Handles loading favicons into a GDK_TYPE_PIXBUF column of a GtkListStore. | 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 | 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. | 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 | 18 // Note: this implementation will be inefficient if the GtkListStore has a large |
| 19 // number of rows. | 19 // number of rows. |
| 20 class ListStoreFavIconLoader { | 20 class ListStoreFavIconLoader { |
| 21 public: | 21 public: |
| 22 ListStoreFavIconLoader(GtkListStore* list_store, | 22 ListStoreFavIconLoader(GtkListStore* list_store, |
| 23 gint favicon_col, | 23 gint favicon_col, |
| 24 gint favicon_handle_col, | 24 gint favicon_handle_col, |
| 25 Profile* profile, | 25 Profile* profile, |
| 26 CancelableRequestConsumer* consumer); | 26 CancelableRequestConsumer* consumer); |
| 27 | 27 |
| 28 ~ListStoreFavIconLoader(); |
| 29 |
| 28 // Start loading the favicon for |url| into the row |iter|. | 30 // Start loading the favicon for |url| into the row |iter|. |
| 29 void LoadFaviconForRow(const GURL& url, GtkTreeIter* iter); | 31 void LoadFaviconForRow(const GURL& url, GtkTreeIter* iter); |
| 30 | 32 |
| 31 private: | 33 private: |
| 32 // Find a row from the GetFavIconForURL handle. Returns true if the row was | 34 // Find a row from the GetFavIconForURL handle. Returns true if the row was |
| 33 // found. | 35 // found. |
| 34 bool GetRowByFavIconHandle(HistoryService::Handle handle, | 36 bool GetRowByFavIconHandle(HistoryService::Handle handle, |
| 35 GtkTreeIter* result_iter); | 37 GtkTreeIter* result_iter); |
| 36 | 38 |
| 37 // Callback from HistoryService:::GetFavIconForURL | 39 // Callback from HistoryService:::GetFavIconForURL |
| (...skipping 10 matching lines...) Expand all Loading... |
| 48 // The index of the G_TYPE_INT column used internally to track the | 50 // The index of the G_TYPE_INT column used internally to track the |
| 49 // HistoryService::Handle of each favicon request. | 51 // HistoryService::Handle of each favicon request. |
| 50 gint favicon_handle_col_; | 52 gint favicon_handle_col_; |
| 51 | 53 |
| 52 // The profile from which we will get the HistoryService. | 54 // The profile from which we will get the HistoryService. |
| 53 Profile* profile_; | 55 Profile* profile_; |
| 54 | 56 |
| 55 // Used in loading favicons. | 57 // Used in loading favicons. |
| 56 CancelableRequestConsumer* consumer_; | 58 CancelableRequestConsumer* consumer_; |
| 57 | 59 |
| 58 // Default icon to show when one can't be found for the URL. This is owned by | 60 // Default icon to show when one can't be found for the URL. |
| 59 // the ResourceBundle and we do not need to free it. | |
| 60 GdkPixbuf* default_favicon_; | 61 GdkPixbuf* default_favicon_; |
| 61 | 62 |
| 62 DISALLOW_COPY_AND_ASSIGN(ListStoreFavIconLoader); | 63 DISALLOW_COPY_AND_ASSIGN(ListStoreFavIconLoader); |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 #endif // CHROME_BROWSER_GTK_LIST_STORE_FAVICON_LOADER_H_ | 66 #endif // CHROME_BROWSER_GTK_LIST_STORE_FAVICON_LOADER_H_ |
| OLD | NEW |