OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/password_manager/password_form_manager.h" | 5 #include "chrome/browser/password_manager/password_form_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 void PasswordFormManager::Save() { | 247 void PasswordFormManager::Save() { |
248 DCHECK_EQ(state_, POST_MATCHING_PHASE); | 248 DCHECK_EQ(state_, POST_MATCHING_PHASE); |
249 DCHECK(!profile_->IsOffTheRecord()); | 249 DCHECK(!profile_->IsOffTheRecord()); |
250 | 250 |
251 if (IsNewLogin()) | 251 if (IsNewLogin()) |
252 SaveAsNewLogin(true); | 252 SaveAsNewLogin(true); |
253 else | 253 else |
254 UpdateLogin(); | 254 UpdateLogin(); |
255 } | 255 } |
256 | 256 |
257 void PasswordFormManager::FetchMatchingLoginsFromPasswordStore() { | 257 void PasswordFormManager::FetchMatchingLoginsFromPasswordStore( |
| 258 PasswordStore::AuthorizationPromptPolicy prompt_policy) { |
258 DCHECK_EQ(state_, PRE_MATCHING_PHASE); | 259 DCHECK_EQ(state_, PRE_MATCHING_PHASE); |
259 state_ = MATCHING_PHASE; | 260 state_ = MATCHING_PHASE; |
260 PasswordStore* password_store = PasswordStoreFactory::GetForProfile( | 261 PasswordStore* password_store = PasswordStoreFactory::GetForProfile( |
261 profile_, Profile::EXPLICIT_ACCESS).get(); | 262 profile_, Profile::EXPLICIT_ACCESS).get(); |
262 if (!password_store) { | 263 if (!password_store) { |
263 NOTREACHED(); | 264 NOTREACHED(); |
264 return; | 265 return; |
265 } | 266 } |
266 password_store->GetLogins(observed_form_, this); | 267 password_store->GetLogins(observed_form_, prompt_policy, this); |
267 } | 268 } |
268 | 269 |
269 bool PasswordFormManager::HasCompletedMatching() { | 270 bool PasswordFormManager::HasCompletedMatching() { |
270 return state_ == POST_MATCHING_PHASE; | 271 return state_ == POST_MATCHING_PHASE; |
271 } | 272 } |
272 | 273 |
273 void PasswordFormManager::OnRequestDone( | 274 void PasswordFormManager::OnRequestDone( |
274 const std::vector<PasswordForm*>& logins_result) { | 275 const std::vector<PasswordForm*>& logins_result) { |
275 // Note that the result gets deleted after this call completes, but we own | 276 // Note that the result gets deleted after this call completes, but we own |
276 // the PasswordForm objects pointed to by the result vector, thus we keep | 277 // the PasswordForm objects pointed to by the result vector, thus we keep |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 | 651 |
651 void PasswordFormManager::SubmitFailed() { | 652 void PasswordFormManager::SubmitFailed() { |
652 submit_result_ = kSubmitResultFailed; | 653 submit_result_ = kSubmitResultFailed; |
653 } | 654 } |
654 | 655 |
655 void PasswordFormManager::SendNotBlacklistedToRenderer() { | 656 void PasswordFormManager::SendNotBlacklistedToRenderer() { |
656 content::RenderViewHost* host = web_contents_->GetRenderViewHost(); | 657 content::RenderViewHost* host = web_contents_->GetRenderViewHost(); |
657 host->Send(new AutofillMsg_FormNotBlacklisted(host->GetRoutingID(), | 658 host->Send(new AutofillMsg_FormNotBlacklisted(host->GetRoutingID(), |
658 observed_form_)); | 659 observed_form_)); |
659 } | 660 } |
OLD | NEW |