diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-08 15:44:52 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-08 15:44:52 +0000 |
commit | c117dffdb52bb572ac6f5f61e364b62d502129f2 (patch) | |
tree | 40008fd901a8423ece4f02393d3a8e5d9d7124ab /chrome/browser/views/password_manager_view.h | |
parent | e6f45624a5e05fcce4171080c56d5a671bd28e97 (diff) | |
download | chromium_src-c117dffdb52bb572ac6f5f61e364b62d502129f2.zip chromium_src-c117dffdb52bb572ac6f5f61e364b62d502129f2.tar.gz chromium_src-c117dffdb52bb572ac6f5f61e364b62d502129f2.tar.bz2 |
Enables sorting of the tables in the password editor and the URL
picker dialog.
BUG=2949
TEST=Try sorting in the password manager dialog table as well as when
adding a URL to the list of URLs to open on startup.
Review URL: http://codereview.chromium.org/6053
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3010 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/password_manager_view.h')
-rw-r--r-- | chrome/browser/views/password_manager_view.h | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/chrome/browser/views/password_manager_view.h b/chrome/browser/views/password_manager_view.h index f470bee..bbcba7d 100644 --- a/chrome/browser/views/password_manager_view.h +++ b/chrome/browser/views/password_manager_view.h @@ -8,6 +8,7 @@ #include <vector> #include "chrome/browser/webdata/web_data_service.h" +#include "chrome/common/gfx/url_elider.h" #include "chrome/views/dialog_delegate.h" #include "chrome/views/label.h" #include "chrome/views/native_button.h" @@ -20,12 +21,13 @@ struct PasswordForm; class PasswordManagerTableModel : public ChromeViews::TableModel, public WebDataServiceConsumer { public: - explicit PasswordManagerTableModel(WebDataService* profile_web_data_service); + explicit PasswordManagerTableModel(Profile* profile); virtual ~PasswordManagerTableModel(); // TableModel methods. virtual int RowCount(); virtual std::wstring GetText(int row, int column); + virtual int CompareValues(int row1, int row2, int column_id); virtual void SetObserver(ChromeViews::TableModelObserver* observer); // Delete the PasswordForm at specified row from the database (and remove @@ -46,24 +48,37 @@ class PasswordManagerTableModel : public ChromeViews::TableModel, PasswordForm* GetPasswordFormAt(int row); private: + // Wraps the PasswordForm from the database and caches the display URL for + // quick sorting. + struct PasswordRow { + ~PasswordRow(); + + // Contains the URL that is displayed along with the + gfx::SortedDisplayURL display_url; + + // The underlying PasswordForm. We own this. + PasswordForm* form; + }; + // Cancel any pending login query involving a callback. void CancelLoginsQuery(); + // The web data service associated with the currently active profile. + WebDataService* web_data_service() { + return profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); + } + // The TableView observing this model. ChromeViews::TableModelObserver* observer_; // Handle to any pending WebDataService::GetLogins query. WebDataService::Handle pending_login_query_; - // PasswordForms returned by the web data service query. - typedef std::vector<PasswordForm*> PasswordForms; - PasswordForms saved_signons_; - - // Deleter for saved_logins_. - STLElementDeleter<PasswordForms> saved_signons_deleter_; + // The set of passwords we're showing. + typedef std::vector<PasswordRow> PasswordRows; + PasswordRows saved_signons_; - // The web data service associated with the currently active profile. - WebDataService* web_data_service_; + Profile* profile_; DISALLOW_EVIL_CONSTRUCTORS(PasswordManagerTableModel); }; |