| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/content_password_manager_driver.h" | 5 #include "chrome/browser/password_manager/content_password_manager_driver.h" |
| 6 | 6 |
| 7 #include "components/autofill/content/common/autofill_messages.h" | 7 #include "components/autofill/content/common/autofill_messages.h" |
| 8 #include "components/autofill/core/common/password_form.h" | 8 #include "components/autofill/core/common/password_form.h" |
| 9 #include "content/public/browser/navigation_details.h" | 9 #include "content/public/browser/navigation_details.h" |
| 10 #include "content/public/browser/navigation_entry.h" | 10 #include "content/public/browser/navigation_entry.h" |
| 11 #include "content/public/browser/render_view_host.h" | 11 #include "content/public/browser/render_view_host.h" |
| 12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 13 #include "content/public/common/page_transition_types.h" | 13 #include "content/public/common/page_transition_types.h" |
| 14 #include "content/public/common/ssl_status.h" | 14 #include "content/public/common/ssl_status.h" |
| 15 #include "net/cert/cert_status_flags.h" | 15 #include "net/cert/cert_status_flags.h" |
| 16 | 16 |
| 17 ContentPasswordManagerDriver::ContentPasswordManagerDriver( | 17 ContentPasswordManagerDriver::ContentPasswordManagerDriver( |
| 18 content::WebContents* web_contents) | 18 content::WebContents* web_contents, |
| 19 : web_contents_(web_contents) { | 19 PasswordManagerDelegate* delegate) |
| 20 } | 20 : web_contents_(web_contents), |
| 21 password_manager_(web_contents, delegate), |
| 22 password_generation_manager_(web_contents, delegate) {} |
| 21 | 23 |
| 22 ContentPasswordManagerDriver::~ContentPasswordManagerDriver() { | 24 ContentPasswordManagerDriver::~ContentPasswordManagerDriver() {} |
| 23 } | |
| 24 | 25 |
| 25 void ContentPasswordManagerDriver::FillPasswordForm( | 26 void ContentPasswordManagerDriver::FillPasswordForm( |
| 26 const autofill::PasswordFormFillData& form_data) { | 27 const autofill::PasswordFormFillData& form_data) { |
| 27 web_contents_->GetRenderViewHost()->Send( | 28 web_contents_->GetRenderViewHost()->Send(new AutofillMsg_FillPasswordForm( |
| 28 new AutofillMsg_FillPasswordForm( | 29 web_contents_->GetRenderViewHost()->GetRoutingID(), form_data)); |
| 29 web_contents_->GetRenderViewHost()->GetRoutingID(), | |
| 30 form_data)); | |
| 31 } | 30 } |
| 32 | 31 |
| 33 bool ContentPasswordManagerDriver::DidLastPageLoadEncounterSSLErrors() { | 32 bool ContentPasswordManagerDriver::DidLastPageLoadEncounterSSLErrors() { |
| 34 content::NavigationEntry* entry = | 33 content::NavigationEntry* entry = |
| 35 web_contents_->GetController().GetActiveEntry(); | 34 web_contents_->GetController().GetActiveEntry(); |
| 36 if (!entry) { | 35 if (!entry) { |
| 37 NOTREACHED(); | 36 NOTREACHED(); |
| 38 return false; | 37 return false; |
| 39 } | 38 } |
| 40 | 39 |
| 41 return net::IsCertStatusError(entry->GetSSL().cert_status); | 40 return net::IsCertStatusError(entry->GetSSL().cert_status); |
| 42 } | 41 } |
| 42 |
| 43 PasswordGenerationManager* |
| 44 ContentPasswordManagerDriver::GetPasswordGenerationManager() { |
| 45 return &password_generation_manager_; |
| 46 } |
| 47 |
| 48 PasswordManager* ContentPasswordManagerDriver::GetPasswordManager() { |
| 49 return &password_manager_; |
| 50 } |
| OLD | NEW |