Logo Search packages:      
Sourcecode: chromium-browser version File versions  Download package


// 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.


#include <gtk/gtk.h>

#include <vector>

#include "app/gtk_signal.h"
#include "chrome/browser/password_manager/password_store.h"
#include "chrome/browser/profile.h"

class PasswordsPageGtk {
  explicit PasswordsPageGtk(Profile* profile);

  GtkWidget* get_page_widget() const {
    return page_;

  // Initialize the password tree widget, setting the member variables.
  void InitPasswordTree();

  // The password store associated with the currently active profile.
  PasswordStore* GetPasswordStore();

  // Sets the password list contents to the given data.
  void SetPasswordList(const std::vector<webkit_glue::PasswordForm*>& result);

  CHROMEGTK_CALLBACK_0(PasswordsPageGtk, void, OnRemoveButtonClicked);
  CHROMEGTK_CALLBACK_0(PasswordsPageGtk, void, OnRemoveAllButtonClicked);
  CHROMEGTK_CALLBACK_1(PasswordsPageGtk, void, OnRemoveAllConfirmResponse, int);
  CHROMEGTK_CALLBACK_0(PasswordsPageGtk, void, OnShowPasswordButtonClicked);

  static void OnPasswordSelectionChangedThunk(GtkTreeSelection* selection,
                                              PasswordsPageGtk* page) {
  void OnPasswordSelectionChanged(GtkTreeSelection* selection);

  // Sorting functions.
  static gint CompareSite(GtkTreeModel* model,
                          GtkTreeIter* a, GtkTreeIter* b,
                          gpointer window);
  static gint CompareUsername(GtkTreeModel* model,
                              GtkTreeIter* a, GtkTreeIter* b,
                              gpointer window);

  // A short class to mediate requests to the password store.
  class PasswordListPopulater : public PasswordStoreConsumer {
    explicit PasswordListPopulater(PasswordsPageGtk* page)
        : page_(page),
          pending_login_query_(0) {

    // Send a query to the password store to populate a PasswordsPageGtk.
    void populate();

    // Send the password store's reply back to the PasswordsPageGtk.
    virtual void OnPasswordStoreRequestDone(
        int handle, const std::vector<webkit_glue::PasswordForm*>& result);

    PasswordsPageGtk* page_;
    int pending_login_query_;

  // Password store consumer for populating the password list.
  PasswordListPopulater populater;

  // Widgets for the buttons.
  GtkWidget* remove_button_;
  GtkWidget* remove_all_button_;
  GtkWidget* show_password_button_;

  // Widget for the shown password
  GtkWidget* password_;
  bool password_showing_;

  // Widgets for the password table.
  GtkWidget* password_tree_;
  GtkListStore* password_list_store_;
  GtkTreeModel* password_list_sort_;
  GtkTreeSelection* password_selection_;

  // The parent GtkHBox widget and GtkWindow window.
  GtkWidget* page_;

  Profile* profile_;
  std::vector<webkit_glue::PasswordForm> password_list_;



Generated by  Doxygen 1.6.0   Back to index