| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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_OPTIONS_GENERAL_PAGE_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_OPTIONS_GENERAL_PAGE_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_OPTIONS_GENERAL_PAGE_GTK_H_ | 6 #define CHROME_BROWSER_GTK_OPTIONS_GENERAL_PAGE_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "chrome/browser/history/history.h" | 13 #include "chrome/browser/cancelable_request.h" |
| 14 #include "chrome/browser/options_page_base.h" | 14 #include "chrome/browser/options_page_base.h" |
| 15 #include "chrome/browser/search_engines/template_url_model.h" | 15 #include "chrome/browser/search_engines/template_url_model.h" |
| 16 #include "chrome/common/pref_member.h" | 16 #include "chrome/common/pref_member.h" |
| 17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 18 | 18 |
| 19 class Profile; | 19 class Profile; |
| 20 class ListStoreFavIconLoader; |
| 20 | 21 |
| 21 class GeneralPageGtk : public OptionsPageBase, | 22 class GeneralPageGtk : public OptionsPageBase, |
| 22 public TemplateURLModelObserver { | 23 public TemplateURLModelObserver { |
| 23 public: | 24 public: |
| 24 explicit GeneralPageGtk(Profile* profile); | 25 explicit GeneralPageGtk(Profile* profile); |
| 25 ~GeneralPageGtk(); | 26 ~GeneralPageGtk(); |
| 26 | 27 |
| 27 GtkWidget* get_page_widget() const { | 28 GtkWidget* get_page_widget() const { |
| 28 return page_; | 29 return page_; |
| 29 } | 30 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 41 | 42 |
| 42 // Saves the startup preference from the values in the ui | 43 // Saves the startup preference from the values in the ui |
| 43 void SaveStartupPref(); | 44 void SaveStartupPref(); |
| 44 | 45 |
| 45 // Fill the startup_custom_pages_model_ | 46 // Fill the startup_custom_pages_model_ |
| 46 void PopulateCustomUrlList(const std::vector<GURL>& urls); | 47 void PopulateCustomUrlList(const std::vector<GURL>& urls); |
| 47 | 48 |
| 48 // Fill a single row in the startup_custom_pages_model_ | 49 // Fill a single row in the startup_custom_pages_model_ |
| 49 void PopulateCustomUrlRow(const GURL& url, GtkTreeIter *iter); | 50 void PopulateCustomUrlRow(const GURL& url, GtkTreeIter *iter); |
| 50 | 51 |
| 51 // Find a row from the GetFavIconForURL handle. Returns true if the row was | |
| 52 // found. | |
| 53 bool GetRowByFavIconHandle(HistoryService::Handle handle, | |
| 54 GtkTreeIter* result_iter); | |
| 55 | |
| 56 // Callback from HistoryService:::GetFavIconForURL | |
| 57 void OnGotFavIcon(HistoryService::Handle handle, bool know_fav_icon, | |
| 58 scoped_refptr<RefCountedBytes> image_data, bool is_expired, | |
| 59 GURL icon_url); | |
| 60 | |
| 61 // Set the custom url list using the pages currently open | 52 // Set the custom url list using the pages currently open |
| 62 void SetCustomUrlListFromCurrentPages(); | 53 void SetCustomUrlListFromCurrentPages(); |
| 63 | 54 |
| 64 // Callback from UrlPickerDialogGtk, for adding custom urls manually. | 55 // Callback from UrlPickerDialogGtk, for adding custom urls manually. |
| 65 // If a single row in the list is selected, the new url will be inserted | 56 // If a single row in the list is selected, the new url will be inserted |
| 66 // before that row. Otherwise the new row will be added to the end. | 57 // before that row. Otherwise the new row will be added to the end. |
| 67 void OnAddCustomUrl(const GURL& url); | 58 void OnAddCustomUrl(const GURL& url); |
| 68 | 59 |
| 69 // Removes urls that are currently selected | 60 // Removes urls that are currently selected |
| 70 void RemoveSelectedCustomUrls(); | 61 void RemoveSelectedCustomUrls(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // Flag to ignore gtk callbacks while we are populating default search urls. | 165 // Flag to ignore gtk callbacks while we are populating default search urls. |
| 175 bool default_search_initializing_; | 166 bool default_search_initializing_; |
| 176 | 167 |
| 177 // Flag to ignore gtk callbacks while we are loading prefs, to avoid | 168 // Flag to ignore gtk callbacks while we are loading prefs, to avoid |
| 178 // then turning around and saving them again. | 169 // then turning around and saving them again. |
| 179 bool initializing_; | 170 bool initializing_; |
| 180 | 171 |
| 181 // Used in loading favicons. | 172 // Used in loading favicons. |
| 182 CancelableRequestConsumer fav_icon_consumer_; | 173 CancelableRequestConsumer fav_icon_consumer_; |
| 183 | 174 |
| 184 // Default icon to show when one can't be found for the URL. This is owned by | 175 // Helper to load the favicon pixbufs into the |startup_custom_pages_model_|. |
| 185 // the ResourceBundle and we do not need to free it. | 176 scoped_ptr<ListStoreFavIconLoader> favicon_loader_; |
| 186 GdkPixbuf* default_favicon_; | |
| 187 | 177 |
| 188 DISALLOW_COPY_AND_ASSIGN(GeneralPageGtk); | 178 DISALLOW_COPY_AND_ASSIGN(GeneralPageGtk); |
| 189 }; | 179 }; |
| 190 | 180 |
| 191 #endif // CHROME_BROWSER_GTK_OPTIONS_GENERAL_PAGE_GTK_H_ | 181 #endif // CHROME_BROWSER_GTK_OPTIONS_GENERAL_PAGE_GTK_H_ |
| OLD | NEW |