| OLD | NEW |
| (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_OPTIONS_COOKIES_VIEW_H_ |
| 6 #define CHROME_BROWSER_GTK_OPTIONS_COOKIES_VIEW_H_ |
| 7 |
| 8 #include <gtk/gtk.h> |
| 9 |
| 10 #include "app/table_model_observer.h" |
| 11 #include "base/basictypes.h" |
| 12 #include "base/scoped_ptr.h" |
| 13 #include "base/task.h" |
| 14 |
| 15 class CookiesTableModel; |
| 16 class Profile; |
| 17 |
| 18 class CookiesView : public TableModelObserver { |
| 19 public: |
| 20 virtual ~CookiesView(); |
| 21 |
| 22 // Create (if necessary) and show the keyword window window. |
| 23 static void Show(Profile* profile); |
| 24 |
| 25 private: |
| 26 explicit CookiesView(Profile* profile); |
| 27 |
| 28 // Initialize the dialog contents and layout. |
| 29 void Init(); |
| 30 |
| 31 // Set sensitivity of buttons based on selection and filter state. |
| 32 void EnableControls(); |
| 33 |
| 34 // Remove any cookies that are currently selected. |
| 35 void RemoveSelectedCookies(); |
| 36 |
| 37 // Set the column values for |row| of |cookies_table_model_| in the |
| 38 // |list_store_| at |iter|. |
| 39 void SetColumnValues(int row, GtkTreeIter* iter); |
| 40 |
| 41 // Add the values from |row| of |cookies_table_model_|. |
| 42 void AddNodeToList(int row); |
| 43 |
| 44 // TableModelObserver implementation. |
| 45 virtual void OnModelChanged(); |
| 46 virtual void OnItemsChanged(int start, int length); |
| 47 virtual void OnItemsAdded(int start, int length); |
| 48 virtual void OnItemsRemoved(int start, int length); |
| 49 |
| 50 // List sorting callbacks. |
| 51 static gint CompareSite(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b, |
| 52 gpointer window); |
| 53 static gint CompareCookieName(GtkTreeModel* model, GtkTreeIter* a, |
| 54 GtkTreeIter* b, gpointer window); |
| 55 |
| 56 // Callback for dialog buttons. |
| 57 static void OnResponse(GtkDialog* dialog, int response_id, |
| 58 CookiesView* window); |
| 59 |
| 60 // Callback for window destruction. |
| 61 static void OnWindowDestroy(GtkWidget* widget, CookiesView* window); |
| 62 |
| 63 // Callback for when user selects something in the table. |
| 64 static void OnSelectionChanged(GtkTreeSelection *selection, |
| 65 CookiesView* window); |
| 66 |
| 67 // Filter the list against the text in |filter_entry_|. |
| 68 void UpdateFilterResults(); |
| 69 |
| 70 // Callbacks for user actions filtering the list. |
| 71 static void OnFilterEntryActivated(GtkEntry* entry, CookiesView* window); |
| 72 static void OnFilterEntryChanged(GtkEditable* editable, CookiesView* window); |
| 73 static void OnFilterClearButtonClicked(GtkButton* button, |
| 74 CookiesView* window); |
| 75 |
| 76 // Widgets of the dialog. |
| 77 GtkWidget* dialog_; |
| 78 GtkWidget* filter_entry_; |
| 79 GtkWidget* filter_clear_button_; |
| 80 GtkWidget* remove_button_; |
| 81 GtkWidget* remove_all_button_; |
| 82 |
| 83 // The table listing the cookies. |
| 84 GtkWidget* tree_; |
| 85 GtkListStore* list_store_; |
| 86 GtkTreeModel* list_sort_; |
| 87 GtkTreeSelection* selection_; |
| 88 |
| 89 // The profile. |
| 90 Profile* profile_; |
| 91 |
| 92 // The Cookies Table model |
| 93 scoped_ptr<CookiesTableModel> cookies_table_model_; |
| 94 |
| 95 // A factory to construct Runnable Methods so that we can be called back to |
| 96 // re-evaluate the model after the search query string changes. |
| 97 ScopedRunnableMethodFactory<CookiesView> filter_update_factory_; |
| 98 |
| 99 DISALLOW_COPY_AND_ASSIGN(CookiesView); |
| 100 }; |
| 101 |
| 102 |
| 103 #endif // CHROME_BROWSER_GTK_OPTIONS_COOKIES_VIEW_H_ |
| OLD | NEW |