diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-22 19:39:21 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-22 19:39:21 +0000 |
commit | 41cf8020fe10d9949772f58af8504d768edd33a4 (patch) | |
tree | a9a291307dfe802c0aeddf7c5434102778d27427 /chrome/browser/gtk/options/cookies_view.h | |
parent | c535a312073f7fc4eaed7e5efa3d0ef3df2e1dce (diff) | |
download | chromium_src-41cf8020fe10d9949772f58af8504d768edd33a4.zip chromium_src-41cf8020fe10d9949772f58af8504d768edd33a4.tar.gz chromium_src-41cf8020fe10d9949772f58af8504d768edd33a4.tar.bz2 |
Gtk cookie manager part 1.
(Doesn't display cookie details, otherwise working.)
BUG=11507
TEST=All cookie manager functions should work as expected, other than viewing the cookie details.
Review URL: http://codereview.chromium.org/159187
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21307 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/options/cookies_view.h')
-rw-r--r-- | chrome/browser/gtk/options/cookies_view.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/chrome/browser/gtk/options/cookies_view.h b/chrome/browser/gtk/options/cookies_view.h new file mode 100644 index 0000000..5621e58 --- /dev/null +++ b/chrome/browser/gtk/options/cookies_view.h @@ -0,0 +1,103 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_GTK_OPTIONS_COOKIES_VIEW_H_ +#define CHROME_BROWSER_GTK_OPTIONS_COOKIES_VIEW_H_ + +#include <gtk/gtk.h> + +#include "app/table_model_observer.h" +#include "base/basictypes.h" +#include "base/scoped_ptr.h" +#include "base/task.h" + +class CookiesTableModel; +class Profile; + +class CookiesView : public TableModelObserver { + public: + virtual ~CookiesView(); + + // Create (if necessary) and show the keyword window window. + static void Show(Profile* profile); + + private: + explicit CookiesView(Profile* profile); + + // Initialize the dialog contents and layout. + void Init(); + + // Set sensitivity of buttons based on selection and filter state. + void EnableControls(); + + // Remove any cookies that are currently selected. + void RemoveSelectedCookies(); + + // Set the column values for |row| of |cookies_table_model_| in the + // |list_store_| at |iter|. + void SetColumnValues(int row, GtkTreeIter* iter); + + // Add the values from |row| of |cookies_table_model_|. + void AddNodeToList(int row); + + // TableModelObserver implementation. + virtual void OnModelChanged(); + virtual void OnItemsChanged(int start, int length); + virtual void OnItemsAdded(int start, int length); + virtual void OnItemsRemoved(int start, int length); + + // List sorting callbacks. + static gint CompareSite(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b, + gpointer window); + static gint CompareCookieName(GtkTreeModel* model, GtkTreeIter* a, + GtkTreeIter* b, gpointer window); + + // Callback for dialog buttons. + static void OnResponse(GtkDialog* dialog, int response_id, + CookiesView* window); + + // Callback for window destruction. + static void OnWindowDestroy(GtkWidget* widget, CookiesView* window); + + // Callback for when user selects something in the table. + static void OnSelectionChanged(GtkTreeSelection *selection, + CookiesView* window); + + // Filter the list against the text in |filter_entry_|. + void UpdateFilterResults(); + + // Callbacks for user actions filtering the list. + static void OnFilterEntryActivated(GtkEntry* entry, CookiesView* window); + static void OnFilterEntryChanged(GtkEditable* editable, CookiesView* window); + static void OnFilterClearButtonClicked(GtkButton* button, + CookiesView* window); + + // Widgets of the dialog. + GtkWidget* dialog_; + GtkWidget* filter_entry_; + GtkWidget* filter_clear_button_; + GtkWidget* remove_button_; + GtkWidget* remove_all_button_; + + // The table listing the cookies. + GtkWidget* tree_; + GtkListStore* list_store_; + GtkTreeModel* list_sort_; + GtkTreeSelection* selection_; + + // The profile. + Profile* profile_; + + // The Cookies Table model + scoped_ptr<CookiesTableModel> cookies_table_model_; + + // A factory to construct Runnable Methods so that we can be called back to + // re-evaluate the model after the search query string changes. + ScopedRunnableMethodFactory<CookiesView> filter_update_factory_; + + DISALLOW_COPY_AND_ASSIGN(CookiesView); +}; + + +#endif // CHROME_BROWSER_GTK_OPTIONS_COOKIES_VIEW_H_ |