diff options
Diffstat (limited to 'chrome/browser/views')
4 files changed, 35 insertions, 51 deletions
diff --git a/chrome/browser/views/options/exceptions_page_view.cc b/chrome/browser/views/options/exceptions_page_view.cc index 52de9eb..9486af4 100644 --- a/chrome/browser/views/options/exceptions_page_view.cc +++ b/chrome/browser/views/options/exceptions_page_view.cc @@ -41,31 +41,21 @@ int ExceptionsTableModel::CompareValues(int row1, int row2, void ExceptionsTableModel::GetAllExceptionsForProfile() { DCHECK(!pending_login_query_); - pending_login_query_ = web_data_service()->GetAllLogins(this); + pending_login_query_ = password_store()->GetAllLogins(this); } -void ExceptionsTableModel::OnWebDataServiceRequestDone( - WebDataService::Handle h, - const WDTypedResult* result) { - DCHECK_EQ(pending_login_query_, h); +void ExceptionsTableModel::OnPasswordStoreRequestDone( + int handle, const std::vector<webkit_glue::PasswordForm*>& result) { + DCHECK_EQ(pending_login_query_, handle); pending_login_query_ = NULL; - if (!result) - return; - - DCHECK(result->GetType() == PASSWORD_RESULT); - - // Get the result from the database into a useable form. - const WDResult<std::vector<PasswordForm*> >* r = - static_cast<const WDResult<std::vector<PasswordForm*> >*>(result); - std::vector<PasswordForm*> rows = r->GetValue(); STLDeleteElements<PasswordRows>(&saved_signons_); std::wstring languages = profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); - for (size_t i = 0; i < rows.size(); ++i) { - if (rows[i]->blacklisted_by_user) { + for (size_t i = 0; i < result.size(); ++i) { + if (result[i]->blacklisted_by_user) { saved_signons_.push_back(new PasswordRow( - gfx::SortedDisplayURL(rows[i]->origin, languages), rows[i])); + gfx::SortedDisplayURL(result[i]->origin, languages), result[i])); } } if (observer_) diff --git a/chrome/browser/views/options/exceptions_page_view.h b/chrome/browser/views/options/exceptions_page_view.h index 7a2906b..931abd1 100644 --- a/chrome/browser/views/options/exceptions_page_view.h +++ b/chrome/browser/views/options/exceptions_page_view.h @@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTIONS_PAGE_VIEW_H_ #define CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTIONS_PAGE_VIEW_H_ +#include <vector> + #include "chrome/browser/views/options/options_page_view.h" #include "chrome/browser/views/options/passwords_page_view.h" #include "views/controls/table/table_view_observer.h" @@ -22,9 +24,9 @@ class ExceptionsTableModel : public PasswordsTableModel { virtual std::wstring GetText(int row, int column); virtual int CompareValues(int row1, int row2, int col_id); - // WebDataServiceConsumer implementation. - virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, - const WDTypedResult* result); + // PasswordStoreConsumer implementation. + virtual void OnPasswordStoreRequestDone( + int handle, const std::vector<webkit_glue::PasswordForm*>& result); // Request all logins data. void GetAllExceptionsForProfile(); }; diff --git a/chrome/browser/views/options/passwords_page_view.cc b/chrome/browser/views/options/passwords_page_view.cc index 2d82f27..4bd9648 100644 --- a/chrome/browser/views/options/passwords_page_view.cc +++ b/chrome/browser/views/options/passwords_page_view.cc @@ -6,6 +6,7 @@ #include "app/l10n_util.h" #include "base/string_util.h" +#include "chrome/browser/password_manager/password_store.h" #include "chrome/browser/profile.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" @@ -53,7 +54,7 @@ PasswordsTableModel::PasswordsTableModel(Profile* profile) pending_login_query_(NULL), saved_signons_cleanup_(&saved_signons_), profile_(profile) { - DCHECK(profile && profile->GetWebDataService(Profile::EXPLICIT_ACCESS)); + DCHECK(profile && profile->GetPasswordStore(Profile::EXPLICIT_ACCESS)); } PasswordsTableModel::~PasswordsTableModel() { @@ -103,31 +104,21 @@ void PasswordsTableModel::SetObserver(TableModelObserver* observer) { void PasswordsTableModel::GetAllSavedLoginsForProfile() { DCHECK(!pending_login_query_); - pending_login_query_ = web_data_service()->GetAllAutofillableLogins(this); + pending_login_query_ = password_store()->GetAllAutofillableLogins(this); } -void PasswordsTableModel::OnWebDataServiceRequestDone( - WebDataService::Handle h, - const WDTypedResult* result) { - DCHECK_EQ(pending_login_query_, h); +void PasswordsTableModel::OnPasswordStoreRequestDone( + int handle, const std::vector<PasswordForm*>& result) { + DCHECK_EQ(pending_login_query_, handle); pending_login_query_ = NULL; - if (!result) - return; - - DCHECK(result->GetType() == PASSWORD_RESULT); - - // Get the result from the database into a useable form. - const WDResult<std::vector<PasswordForm*> >* r = - static_cast<const WDResult<std::vector<PasswordForm*> >*>(result); - std::vector<PasswordForm*> rows = r->GetValue(); STLDeleteElements<PasswordRows>(&saved_signons_); - saved_signons_.resize(rows.size(), NULL); + saved_signons_.resize(result.size(), NULL); std::wstring languages = profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); - for (size_t i = 0; i < rows.size(); ++i) { + for (size_t i = 0; i < result.size(); ++i) { saved_signons_[i] = new PasswordRow( - gfx::SortedDisplayURL(rows[i]->origin, languages), rows[i]); + gfx::SortedDisplayURL(result[i]->origin, languages), result[i]); } if (observer_) observer_->OnModelChanged(); @@ -145,7 +136,7 @@ void PasswordsTableModel::ForgetAndRemoveSignon(int row) { PasswordRows::iterator target_iter = saved_signons_.begin() + row; // Remove from DB, memory, and vector. PasswordRow* password_row = *target_iter; - web_data_service()->RemoveLogin(*(password_row->form.get())); + password_store()->RemoveLogin(*(password_row->form.get())); delete password_row; saved_signons_.erase(target_iter); if (observer_) @@ -159,7 +150,7 @@ void PasswordsTableModel::ForgetAndRemoveAllSignons() { while (iter != saved_signons_.end()) { // Remove from DB, memory, and vector. PasswordRow* row = *iter; - web_data_service()->RemoveLogin(*(row->form.get())); + password_store()->RemoveLogin(*(row->form.get())); delete row; iter = saved_signons_.erase(iter); } @@ -173,7 +164,7 @@ void PasswordsTableModel::ForgetAndRemoveAllSignons() { // PasswordsTableModel, private void PasswordsTableModel::CancelLoginsQuery() { if (pending_login_query_) { - web_data_service()->CancelRequest(pending_login_query_); + password_store()->CancelLoginsQuery(pending_login_query_); pending_login_query_ = NULL; } } diff --git a/chrome/browser/views/options/passwords_page_view.h b/chrome/browser/views/options/passwords_page_view.h index fb736ca..2766bce 100644 --- a/chrome/browser/views/options/passwords_page_view.h +++ b/chrome/browser/views/options/passwords_page_view.h @@ -12,7 +12,7 @@ #include "base/scoped_ptr.h" #include "base/stl_util-inl.h" #include "chrome/browser/views/options/options_page_view.h" -#include "chrome/browser/webdata/web_data_service.h" +#include "chrome/browser/password_manager/password_store.h" #include "views/controls/button/native_button.h" #include "views/controls/label.h" #include "views/controls/table/table_view.h" @@ -61,7 +61,7 @@ class MultiLabelButtons : public views::NativeButton { /////////////////////////////////////////////////////////////////////////////// // PasswordsTableModel class PasswordsTableModel : public TableModel, - public WebDataServiceConsumer { + public PasswordStoreConsumer { public: explicit PasswordsTableModel(Profile* profile); virtual ~PasswordsTableModel(); @@ -80,9 +80,10 @@ class PasswordsTableModel : public TableModel, // and clear the view. void ForgetAndRemoveAllSignons(); - // WebDataServiceConsumer implementation. - virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, - const WDTypedResult* result); + // PasswordStoreConsumer implementation. + virtual void OnPasswordStoreRequestDone( + int handle, const std::vector<webkit_glue::PasswordForm*>& result); + // Request saved logins data. void GetAllSavedLoginsForProfile(); @@ -110,9 +111,9 @@ class PasswordsTableModel : public TableModel, scoped_ptr<webkit_glue::PasswordForm> form; }; - // The web data service associated with the currently active profile. - WebDataService* web_data_service() { - return profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); + // The password store associated with the currently active profile. + PasswordStore* password_store() { + return profile_->GetPasswordStore(Profile::EXPLICIT_ACCESS); } // The TableView observing this model. @@ -122,8 +123,8 @@ class PasswordsTableModel : public TableModel, // to this observer. PasswordsTableModelObserver* row_count_observer_; - // Handle to any pending WebDataService::GetLogins query. - WebDataService::Handle pending_login_query_; + // Handle to any pending PasswordStore login lookup query. + int pending_login_query_; // The set of passwords we're showing. typedef std::vector<PasswordRow*> PasswordRows; |