Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(647)

Side by Side Diff: chrome/browser/password_manager/password_form_manager.cc

Issue 23742004: Move PasswordForm from //content to //autofill. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_password_form_conversion_utils
Patch Set: Rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "chrome/browser/password_manager/password_manager.h" 12 #include "chrome/browser/password_manager/password_manager.h"
13 #include "chrome/browser/password_manager/password_store.h" 13 #include "chrome/browser/password_manager/password_store.h"
14 #include "chrome/browser/password_manager/password_store_factory.h" 14 #include "chrome/browser/password_manager/password_store_factory.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "components/autofill/core/browser/validation.h" 16 #include "components/autofill/core/browser/validation.h"
17 #include "components/autofill/core/common/autofill_messages.h" 17 #include "components/autofill/core/common/autofill_messages.h"
18 #include "components/autofill/core/common/password_form.h"
18 #include "content/public/browser/render_view_host.h" 19 #include "content/public/browser/render_view_host.h"
19 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
20 #include "content/public/common/password_form.h"
21 21
22 using autofill::PasswordForm;
23 using autofill::PasswordFormMap;
22 using base::Time; 24 using base::Time;
23 using content::PasswordForm;
24 using content::PasswordFormMap;
25 25
26 PasswordFormManager::PasswordFormManager(Profile* profile, 26 PasswordFormManager::PasswordFormManager(Profile* profile,
27 PasswordManager* password_manager, 27 PasswordManager* password_manager,
28 content::WebContents* web_contents, 28 content::WebContents* web_contents,
29 const PasswordForm& observed_form, 29 const PasswordForm& observed_form,
30 bool ssl_valid) 30 bool ssl_valid)
31 : best_matches_deleter_(&best_matches_), 31 : best_matches_deleter_(&best_matches_),
32 observed_form_(observed_form), 32 observed_form_(observed_form),
33 is_new_login_(true), 33 is_new_login_(true),
34 has_generated_password_(false), 34 has_generated_password_(false),
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 if (wait_for_username) 355 if (wait_for_username)
356 manager_action_ = kManagerActionNone; 356 manager_action_ = kManagerActionNone;
357 else 357 else
358 manager_action_ = kManagerActionAutofilled; 358 manager_action_ = kManagerActionAutofilled;
359 password_manager_->Autofill(observed_form_, best_matches_, 359 password_manager_->Autofill(observed_form_, best_matches_,
360 *preferred_match_, wait_for_username); 360 *preferred_match_, wait_for_username);
361 } 361 }
362 362
363 void PasswordFormManager::OnPasswordStoreRequestDone( 363 void PasswordFormManager::OnPasswordStoreRequestDone(
364 CancelableRequestProvider::Handle handle, 364 CancelableRequestProvider::Handle handle,
365 const std::vector<content::PasswordForm*>& result) { 365 const std::vector<autofill::PasswordForm*>& result) {
366 // TODO(kaiwang): Remove this function. 366 // TODO(kaiwang): Remove this function.
367 NOTREACHED(); 367 NOTREACHED();
368 } 368 }
369 369
370 void PasswordFormManager::OnGetPasswordStoreResults( 370 void PasswordFormManager::OnGetPasswordStoreResults(
371 const std::vector<content::PasswordForm*>& results) { 371 const std::vector<autofill::PasswordForm*>& results) {
372 DCHECK_EQ(state_, MATCHING_PHASE); 372 DCHECK_EQ(state_, MATCHING_PHASE);
373 373
374 if (results.empty()) { 374 if (results.empty()) {
375 state_ = POST_MATCHING_PHASE; 375 state_ = POST_MATCHING_PHASE;
376 // No result means that we visit this site the first time so we don't need 376 // No result means that we visit this site the first time so we don't need
377 // to check whether this site is blacklisted or not. Just send a message 377 // to check whether this site is blacklisted or not. Just send a message
378 // to allow password generation. 378 // to allow password generation.
379 SendNotBlacklistedToRenderer(); 379 SendNotBlacklistedToRenderer();
380 return; 380 return;
381 } 381 }
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 590
591 void PasswordFormManager::SubmitFailed() { 591 void PasswordFormManager::SubmitFailed() {
592 submit_result_ = kSubmitResultFailed; 592 submit_result_ = kSubmitResultFailed;
593 } 593 }
594 594
595 void PasswordFormManager::SendNotBlacklistedToRenderer() { 595 void PasswordFormManager::SendNotBlacklistedToRenderer() {
596 content::RenderViewHost* host = web_contents_->GetRenderViewHost(); 596 content::RenderViewHost* host = web_contents_->GetRenderViewHost();
597 host->Send(new AutofillMsg_FormNotBlacklisted(host->GetRoutingID(), 597 host->Send(new AutofillMsg_FormNotBlacklisted(host->GetRoutingID(),
598 observed_form_)); 598 observed_form_));
599 } 599 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698