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/string_split.h" | 10 #include "base/string_split.h" |
11 #include "base/string_util.h" | 11 #include "base/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 "chrome/common/autofill_messages.h" | 16 #include "chrome/common/autofill_messages.h" |
17 #include "content/public/browser/render_view_host.h" | 17 #include "content/public/browser/render_view_host.h" |
18 #include "content/public/browser/web_contents.h" | |
19 #include "webkit/forms/password_form_dom_manager.h" | 18 #include "webkit/forms/password_form_dom_manager.h" |
20 | 19 |
21 using base::Time; | 20 using base::Time; |
22 using webkit::forms::PasswordForm; | 21 using webkit::forms::PasswordForm; |
23 using webkit::forms::PasswordFormMap; | 22 using webkit::forms::PasswordFormMap; |
24 | 23 |
25 PasswordFormManager::PasswordFormManager(Profile* profile, | 24 PasswordFormManager::PasswordFormManager(Profile* profile, |
26 PasswordManager* password_manager, | 25 PasswordManager* password_manager, |
27 content::WebContents* web_contents, | 26 content::RenderViewHost* host, |
28 const PasswordForm& observed_form, | 27 const PasswordForm& observed_form, |
29 bool ssl_valid) | 28 bool ssl_valid) |
30 : best_matches_deleter_(&best_matches_), | 29 : best_matches_deleter_(&best_matches_), |
31 observed_form_(observed_form), | 30 observed_form_(observed_form), |
32 is_new_login_(true), | 31 is_new_login_(true), |
33 has_generated_password_(false), | 32 has_generated_password_(false), |
34 password_manager_(password_manager), | 33 password_manager_(password_manager), |
35 pending_login_query_(0), | 34 pending_login_query_(0), |
36 preferred_match_(NULL), | 35 preferred_match_(NULL), |
37 state_(PRE_MATCHING_PHASE), | 36 state_(PRE_MATCHING_PHASE), |
38 profile_(profile), | 37 profile_(profile), |
39 web_contents_(web_contents), | 38 host_(host), |
40 manager_action_(kManagerActionNone), | 39 manager_action_(kManagerActionNone), |
41 user_action_(kUserActionNone), | 40 user_action_(kUserActionNone), |
42 submit_result_(kSubmitResultNotSubmitted) { | 41 submit_result_(kSubmitResultNotSubmitted) { |
43 DCHECK(profile_); | 42 DCHECK(profile_); |
44 if (observed_form_.origin.is_valid()) | 43 if (observed_form_.origin.is_valid()) |
45 base::SplitString(observed_form_.origin.path(), '/', &form_path_tokens_); | 44 base::SplitString(observed_form_.origin.path(), '/', &form_path_tokens_); |
46 observed_form_.ssl_valid = ssl_valid; | 45 observed_form_.ssl_valid = ssl_valid; |
47 } | 46 } |
48 | 47 |
49 PasswordFormManager::~PasswordFormManager() { | 48 PasswordFormManager::~PasswordFormManager() { |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 | 500 |
502 void PasswordFormManager::SubmitPassed() { | 501 void PasswordFormManager::SubmitPassed() { |
503 submit_result_ = kSubmitResultPassed; | 502 submit_result_ = kSubmitResultPassed; |
504 } | 503 } |
505 | 504 |
506 void PasswordFormManager::SubmitFailed() { | 505 void PasswordFormManager::SubmitFailed() { |
507 submit_result_ = kSubmitResultFailed; | 506 submit_result_ = kSubmitResultFailed; |
508 } | 507 } |
509 | 508 |
510 void PasswordFormManager::SendNotBlacklistedToRenderer() { | 509 void PasswordFormManager::SendNotBlacklistedToRenderer() { |
511 content::RenderViewHost* host = web_contents_->GetRenderViewHost(); | 510 host_->Send(new AutofillMsg_FormNotBlacklisted(host_->GetRoutingID(), |
512 host->Send(new AutofillMsg_FormNotBlacklisted(host->GetRoutingID(), | |
513 observed_form_)); | 511 observed_form_)); |
514 } | 512 } |
OLD | NEW |