diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-23 22:55:01 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-23 22:55:01 +0000 |
commit | 6e95706dcc9a205e78b1d4820427754d16a50465 (patch) | |
tree | 6bca69c386a5199bc88f59f0f92afc6dd6734fc3 /chrome/browser/password_manager | |
parent | 1ffdb40816d6a92cbcb7eb6c2386232c561abc56 (diff) | |
download | chromium_src-6e95706dcc9a205e78b1d4820427754d16a50465.zip chromium_src-6e95706dcc9a205e78b1d4820427754d16a50465.tar.gz chromium_src-6e95706dcc9a205e78b1d4820427754d16a50465.tar.bz2 |
Move a bunch of functions from WebContents to TabContents. Change the services
used by the getters I moved to take a TabContents instead of a WebContents.
Review URL: http://codereview.chromium.org/96010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14362 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/password_manager')
-rw-r--r-- | chrome/browser/password_manager/password_manager.cc | 36 | ||||
-rw-r--r-- | chrome/browser/password_manager/password_manager.h | 8 |
2 files changed, 22 insertions, 22 deletions
diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc index 2144806..1e7339d 100644 --- a/chrome/browser/password_manager/password_manager.cc +++ b/chrome/browser/password_manager/password_manager.cc @@ -6,7 +6,7 @@ #include "base/string_util.h" #include "chrome/browser/profile.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/l10n_util.h" #include "chrome/common/notification_registrar.h" #include "chrome/common/notification_service.h" @@ -86,20 +86,20 @@ void PasswordManager::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kPasswordManagerEnabled, true); } -PasswordManager::PasswordManager(WebContents* web_contents) +PasswordManager::PasswordManager(TabContents* tab_contents) : login_managers_deleter_(&pending_login_managers_), - web_contents_(web_contents), + tab_contents_(tab_contents), observer_(NULL) { password_manager_enabled_.Init(prefs::kPasswordManagerEnabled, - web_contents->profile()->GetPrefs(), NULL); + tab_contents->profile()->GetPrefs(), NULL); } PasswordManager::~PasswordManager() { } void PasswordManager::ProvisionallySavePassword(PasswordForm form) { - if (!web_contents_->profile() || - web_contents_->profile()->IsOffTheRecord() || + if (!tab_contents_->profile() || + tab_contents_->profile()->IsOffTheRecord() || !*password_manager_enabled_) return; @@ -135,7 +135,7 @@ void PasswordManager::ProvisionallySavePassword(PasswordForm form) { return; form.ssl_valid = form.origin.SchemeIsSecure() && - !web_contents_->controller().ssl_manager()-> + !tab_contents_->controller().ssl_manager()-> ProcessedSSLErrorFromRequest(); form.preferred = true; manager->ProvisionallySave(form); @@ -161,15 +161,15 @@ void PasswordManager::DidStopLoading() { if (!provisional_save_manager_.get()) return; - DCHECK(!web_contents_->profile()->IsOffTheRecord()); + DCHECK(!tab_contents_->profile()->IsOffTheRecord()); DCHECK(!provisional_save_manager_->IsBlacklisted()); - if (!web_contents_->profile() || - !web_contents_->profile()->GetWebDataService(Profile::IMPLICIT_ACCESS)) + if (!tab_contents_->profile() || + !tab_contents_->profile()->GetWebDataService(Profile::IMPLICIT_ACCESS)) return; if (provisional_save_manager_->IsNewLogin()) { - web_contents_->AddInfoBar( - new SavePasswordInfoBarDelegate(web_contents_, + tab_contents_->AddInfoBar( + new SavePasswordInfoBarDelegate(tab_contents_, provisional_save_manager_.release())); } else { // If the save is not a new username entry, then we just want to save this @@ -181,14 +181,14 @@ void PasswordManager::DidStopLoading() { void PasswordManager::PasswordFormsSeen( const std::vector<PasswordForm>& forms) { - if (!web_contents_->profile() || - !web_contents_->profile()->GetWebDataService(Profile::EXPLICIT_ACCESS)) + if (!tab_contents_->profile() || + !tab_contents_->profile()->GetWebDataService(Profile::EXPLICIT_ACCESS)) return; if (!*password_manager_enabled_) return; // Ask the SSLManager for current security. - bool had_ssl_error = web_contents_->controller().ssl_manager()-> + bool had_ssl_error = tab_contents_->controller().ssl_manager()-> ProcessedSSLErrorFromRequest(); std::vector<PasswordForm>::const_iterator iter; @@ -205,7 +205,7 @@ void PasswordManager::PasswordFormsSeen( } else { bool ssl_valid = iter->origin.SchemeIsSecure() && !had_ssl_error; PasswordFormManager* manager = - new PasswordFormManager(web_contents_->profile(), + new PasswordFormManager(tab_contents_->profile(), this, *iter, ssl_valid); pending_login_managers_.push_back(manager); manager->FetchMatchingLoginsFromWebDatabase(); @@ -217,7 +217,7 @@ void PasswordManager::Autofill( const PasswordForm& form_for_autofill, const PasswordFormMap& best_matches, const PasswordForm* const preferred_match) const { - DCHECK(web_contents_); + DCHECK(tab_contents_); DCHECK(preferred_match); switch (form_for_autofill.scheme) { case PasswordForm::SCHEME_HTML: { @@ -230,7 +230,7 @@ void PasswordManager::Autofill( best_matches, preferred_match, action_mismatch, &fill_data); - web_contents_->render_view_host()->FillPasswordForm(fill_data); + tab_contents_->render_view_host()->FillPasswordForm(fill_data); return; } default: diff --git a/chrome/browser/password_manager/password_manager.h b/chrome/browser/password_manager/password_manager.h index 392cad0..cfe5443 100644 --- a/chrome/browser/password_manager/password_manager.h +++ b/chrome/browser/password_manager/password_manager.h @@ -15,7 +15,7 @@ #include "webkit/glue/password_form_dom_manager.h" class PrefService; -class WebContents; +class TabContents; // Per-tab password manager. Handles creation and management of UI elements, // receiving password form data from the renderer and managing the password @@ -25,7 +25,7 @@ class PasswordManager : public views::LoginModel { public: static void RegisterUserPrefs(PrefService* prefs); - explicit PasswordManager(WebContents* web_contents); + explicit PasswordManager(TabContents* tab_contents); ~PasswordManager(); // Called by a PasswordFormManager when it decides a form can be autofilled @@ -88,8 +88,8 @@ class PasswordManager : public views::LoginModel { // time a user submits a login form and gets to the next page. scoped_ptr<PasswordFormManager> provisional_save_manager_; - // The containing WebContents - WebContents* web_contents_; + // The containing TabContents. + TabContents* tab_contents_; // The LoginModelObserver (i.e LoginView) requiring autofill. views::LoginModelObserver* observer_; |