| Index: chrome/browser/password_manager/password_form_manager.cc
 | 
| ===================================================================
 | 
| --- chrome/browser/password_manager/password_form_manager.cc	(revision 16487)
 | 
| +++ chrome/browser/password_manager/password_form_manager.cc	(working copy)
 | 
| @@ -21,7 +21,7 @@
 | 
|        observed_form_(observed_form),
 | 
|        is_new_login_(true),
 | 
|        password_manager_(password_manager),
 | 
| -      pending_login_query_(NULL),
 | 
| +      pending_login_query_(0),
 | 
|        preferred_match_(NULL),
 | 
|        state_(PRE_MATCHING_PHASE),
 | 
|        profile_(profile) {
 | 
| @@ -168,25 +168,21 @@
 | 
|    DCHECK_EQ(state_, PRE_MATCHING_PHASE);
 | 
|    DCHECK(!pending_login_query_);
 | 
|    state_ = MATCHING_PHASE;
 | 
| -  WebDataService* web_data_service =
 | 
| -      profile_->GetWebDataService(Profile::EXPLICIT_ACCESS);
 | 
| -  if (!web_data_service) {
 | 
| +  PasswordStore* password_store =
 | 
| +      profile_->GetPasswordStore(Profile::EXPLICIT_ACCESS);
 | 
| +  if (!password_store) {
 | 
|      NOTREACHED();
 | 
|      return;
 | 
|    }
 | 
| -  pending_login_query_ = web_data_service->GetLogins(observed_form_, this);
 | 
| +  pending_login_query_ = password_store->GetLogins(observed_form_, this);
 | 
|  }
 | 
|  
 | 
|  bool PasswordFormManager::HasCompletedMatching() {
 | 
|    return state_ == POST_MATCHING_PHASE;
 | 
|  }
 | 
|  
 | 
| -void PasswordFormManager::OnRequestDone(WebDataService::Handle h,
 | 
| -    const WDTypedResult* result) {
 | 
| -  // Get the result from the database into a usable form.
 | 
| -  const WDResult<std::vector<PasswordForm*> >* r =
 | 
| -      static_cast<const WDResult<std::vector<PasswordForm*> >*>(result);
 | 
| -  std::vector<PasswordForm*> logins_result = r->GetValue();
 | 
| +void PasswordFormManager::OnRequestDone(int handle,
 | 
| +    const std::vector<PasswordForm*>& logins_result) {
 | 
|    // Note that the result gets deleted after this call completes, but we own
 | 
|    // the PasswordForm objects pointed to by the result vector, thus we keep
 | 
|    // copies to a minimum here.
 | 
| @@ -239,14 +235,6 @@
 | 
|    // We're done matching now.
 | 
|    state_ = POST_MATCHING_PHASE;
 | 
|  
 | 
| -  if (best_score <= 0) {
 | 
| -#if defined(OS_WIN)
 | 
| -    state_ = PRE_MATCHING_PHASE;
 | 
| -    FetchMatchingIE7LoginFromWebDatabase();
 | 
| -#endif
 | 
| -    return;
 | 
| -  }
 | 
| -
 | 
|    for (std::vector<PasswordForm>::const_iterator it = empties.begin();
 | 
|         it != empties.end(); ++it) {
 | 
|      // If we don't already have a result with the same username, add the
 | 
| @@ -272,30 +260,17 @@
 | 
|    }
 | 
|  }
 | 
|  
 | 
| -void PasswordFormManager::OnWebDataServiceRequestDone(WebDataService::Handle h,
 | 
| -    const WDTypedResult* result) {
 | 
| +void PasswordFormManager::OnPasswordStoreRequestDone(
 | 
| +    int handle, const std::vector<PasswordForm*>& result) {
 | 
|    DCHECK_EQ(state_, MATCHING_PHASE);
 | 
| -  DCHECK_EQ(pending_login_query_, h);
 | 
| -  DCHECK(result);
 | 
| -  pending_login_query_ = NULL;
 | 
| +  DCHECK_EQ(pending_login_query_, handle);
 | 
|  
 | 
| -  if (!result)
 | 
| +  if (result.empty()) {
 | 
| +    state_ = POST_MATCHING_PHASE;
 | 
|      return;
 | 
| -
 | 
| -  switch (result->GetType()) {
 | 
| -    case PASSWORD_RESULT: {
 | 
| -      OnRequestDone(h, result);
 | 
| -      break;
 | 
| -    }
 | 
| -#if defined(OS_WIN)
 | 
| -    case PASSWORD_IE7_RESULT: {
 | 
| -      OnIE7RequestDone(h, result);
 | 
| -      break;
 | 
| -    }
 | 
| -#endif
 | 
| -    default:
 | 
| -      NOTREACHED();
 | 
|    }
 | 
| +
 | 
| +  OnRequestDone(handle, result);
 | 
|  }
 | 
|  
 | 
|  bool PasswordFormManager::IgnoreResult(const PasswordForm& form) const {
 | 
| @@ -322,14 +297,15 @@
 | 
|  
 | 
|    DCHECK(!profile_->IsOffTheRecord());
 | 
|  
 | 
| -  WebDataService* web_data_service =
 | 
| -      profile_->GetWebDataService(Profile::IMPLICIT_ACCESS);
 | 
| -  if (!web_data_service) {
 | 
| +  PasswordStore* password_store =
 | 
| +      profile_->GetPasswordStore(Profile::IMPLICIT_ACCESS);
 | 
| +  if (!password_store) {
 | 
|      NOTREACHED();
 | 
|      return;
 | 
|    }
 | 
| +
 | 
|    pending_credentials_.date_created = Time::Now();
 | 
| -  web_data_service->AddLogin(pending_credentials_);
 | 
| +  password_store->AddLogin(pending_credentials_);
 | 
|  }
 | 
|  
 | 
|  void PasswordFormManager::UpdateLogin() {
 | 
| @@ -341,9 +317,9 @@
 | 
|    DCHECK(!IsNewLogin() && pending_credentials_.preferred);
 | 
|    DCHECK(!profile_->IsOffTheRecord());
 | 
|  
 | 
| -  WebDataService* web_data_service =
 | 
| -      profile_->GetWebDataService(Profile::IMPLICIT_ACCESS);
 | 
| -  if (!web_data_service) {
 | 
| +  PasswordStore* password_store =
 | 
| +      profile_->GetPasswordStore(Profile::IMPLICIT_ACCESS);
 | 
| +  if (!password_store) {
 | 
|      NOTREACHED();
 | 
|      return;
 | 
|    }
 | 
| @@ -355,7 +331,7 @@
 | 
|           iter->second->preferred) {
 | 
|        // This wasn't the selected login but it used to be preferred.
 | 
|        iter->second->preferred = false;
 | 
| -      web_data_service->UpdateLogin(*iter->second);
 | 
| +      password_store->UpdateLogin(*iter->second);
 | 
|      }
 | 
|    }
 | 
|    // Update the new preferred login.
 | 
| @@ -380,23 +356,20 @@
 | 
|      PasswordForm copy(pending_credentials_);
 | 
|      copy.origin = observed_form_.origin;
 | 
|      copy.action = observed_form_.action;
 | 
| -    web_data_service->AddLogin(copy);
 | 
| +    password_store->AddLogin(copy);
 | 
|    } else {
 | 
| -    web_data_service->UpdateLogin(pending_credentials_);
 | 
| +    password_store->UpdateLogin(pending_credentials_);
 | 
|    }
 | 
|  }
 | 
|  
 | 
|  void PasswordFormManager::CancelLoginsQuery() {
 | 
| -  if (!pending_login_query_)
 | 
| -    return;
 | 
| -  WebDataService* web_data_service =
 | 
| -      profile_->GetWebDataService(Profile::EXPLICIT_ACCESS);
 | 
| -  if (!web_data_service) {
 | 
| +  PasswordStore* password_store =
 | 
| +      profile_->GetPasswordStore(Profile::IMPLICIT_ACCESS);
 | 
| +  if (!password_store) {
 | 
|      NOTREACHED();
 | 
|      return;
 | 
|    }
 | 
| -  web_data_service->CancelRequest(pending_login_query_);
 | 
| -  pending_login_query_ = NULL;
 | 
| +  password_store->CancelLoginsQuery(pending_login_query_);
 | 
|  }
 | 
|  
 | 
|  int PasswordFormManager::ScoreResult(const PasswordForm& candidate) const {
 | 
| 
 |