| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PASSWORDS_EXCEPTIONS_PAGE_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_OPTIONS_PASSWORDS_EXCEPTIONS_PAGE_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_OPTIONS_PASSWORDS_EXCEPTIONS_PAGE_GTK_H_ | 6 #define CHROME_BROWSER_GTK_OPTIONS_PASSWORDS_EXCEPTIONS_PAGE_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gtk/gtk.h> | 9 #include "chrome/browser/ui/gtk/options/passwords_exceptions_page_gtk.h" |
| 10 | 10 // TODO(msw): remove this file once all includes have been updated. |
| 11 #include <vector> | |
| 12 | |
| 13 #include "app/gtk_signal.h" | |
| 14 #include "chrome/browser/password_manager/password_store.h" | |
| 15 | |
| 16 class Profile; | |
| 17 | |
| 18 // A page in the show saved passwords dialog that lists what sites we never | |
| 19 // show passwords for, with controls for the user to add/remove sites from that | |
| 20 // list. | |
| 21 class PasswordsExceptionsPageGtk { | |
| 22 public: | |
| 23 explicit PasswordsExceptionsPageGtk(Profile* profile); | |
| 24 virtual ~PasswordsExceptionsPageGtk(); | |
| 25 | |
| 26 GtkWidget* get_page_widget() const { return page_; } | |
| 27 | |
| 28 private: | |
| 29 // Initialize the exception tree widget, setting the member variables. | |
| 30 void InitExceptionTree(); | |
| 31 | |
| 32 // The password store associated with the currently active profile. | |
| 33 PasswordStore* GetPasswordStore(); | |
| 34 | |
| 35 // Sets the exception list contents to the given data. We take ownership of | |
| 36 // the PasswordForms in the vector. | |
| 37 void SetExceptionList(const std::vector<webkit_glue::PasswordForm*>& result); | |
| 38 | |
| 39 CHROMEGTK_CALLBACK_0(PasswordsExceptionsPageGtk, void, OnRemoveButtonClicked); | |
| 40 CHROMEGTK_CALLBACK_0(PasswordsExceptionsPageGtk, void, | |
| 41 OnRemoveAllButtonClicked); | |
| 42 | |
| 43 CHROMEG_CALLBACK_0(PasswordsExceptionsPageGtk, void, | |
| 44 OnExceptionSelectionChanged, GtkTreeSelection*); | |
| 45 | |
| 46 // Sorting function. | |
| 47 static gint CompareSite(GtkTreeModel* model, | |
| 48 GtkTreeIter* a, GtkTreeIter* b, | |
| 49 gpointer window); | |
| 50 | |
| 51 // A short class to mediate requests to the password store. | |
| 52 class ExceptionListPopulater : public PasswordStoreConsumer { | |
| 53 public: | |
| 54 explicit ExceptionListPopulater(PasswordsExceptionsPageGtk* page) | |
| 55 : page_(page), | |
| 56 pending_login_query_(0) { | |
| 57 } | |
| 58 | |
| 59 // Send a query to the password store to populate an | |
| 60 // PasswordsExceptionsPageGtk. | |
| 61 void populate(); | |
| 62 | |
| 63 // PasswordStoreConsumer implementation. | |
| 64 // Send the password store's reply back to the PasswordsExceptionsPageGtk. | |
| 65 virtual void OnPasswordStoreRequestDone( | |
| 66 int handle, const std::vector<webkit_glue::PasswordForm*>& result); | |
| 67 | |
| 68 private: | |
| 69 PasswordsExceptionsPageGtk* page_; | |
| 70 int pending_login_query_; | |
| 71 }; | |
| 72 | |
| 73 // Password store consumer for populating the exception list. | |
| 74 ExceptionListPopulater populater; | |
| 75 | |
| 76 // Widgets for the buttons. | |
| 77 GtkWidget* remove_button_; | |
| 78 GtkWidget* remove_all_button_; | |
| 79 | |
| 80 // Widgets for the exception table. | |
| 81 GtkWidget* exception_tree_; | |
| 82 GtkListStore* exception_list_store_; | |
| 83 GtkTreeModel* exception_list_sort_; | |
| 84 GtkTreeSelection* exception_selection_; | |
| 85 | |
| 86 // The parent GtkHBox widget. | |
| 87 GtkWidget* page_; | |
| 88 | |
| 89 Profile* profile_; | |
| 90 std::vector<webkit_glue::PasswordForm*> exception_list_; | |
| 91 | |
| 92 DISALLOW_COPY_AND_ASSIGN(PasswordsExceptionsPageGtk); | |
| 93 }; | |
| 94 | 11 |
| 95 #endif // CHROME_BROWSER_GTK_OPTIONS_PASSWORDS_EXCEPTIONS_PAGE_GTK_H_ | 12 #endif // CHROME_BROWSER_GTK_OPTIONS_PASSWORDS_EXCEPTIONS_PAGE_GTK_H_ |
| OLD | NEW |