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