| 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_delegate_impl.h" | 5 #include "chrome/browser/password_manager_delegate_impl.h" |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "chrome/browser/autofill/autofill_manager.h" |
| 9 #include "chrome/browser/infobars/infobar_tab_helper.h" | 10 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 10 #include "chrome/browser/password_manager/password_form_manager.h" | 11 #include "chrome/browser/password_manager/password_form_manager.h" |
| 11 #include "chrome/browser/password_manager/password_manager.h" | 12 #include "chrome/browser/password_manager/password_manager.h" |
| 12 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 13 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
| 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 14 #include "chrome/common/autofill_messages.h" | 15 #include "chrome/common/autofill_messages.h" |
| 15 #include "content/public/browser/navigation_entry.h" | 16 #include "content/public/browser/navigation_entry.h" |
| 16 #include "content/public/browser/render_view_host.h" | 17 #include "content/public/browser/render_view_host.h" |
| 17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 18 #include "content/public/common/ssl_status.h" | 19 #include "content/public/common/ssl_status.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 form_to_save_->PermanentlyBlacklist(); | 108 form_to_save_->PermanentlyBlacklist(); |
| 108 infobar_response_ = DONT_REMEMBER_PASSWORD; | 109 infobar_response_ = DONT_REMEMBER_PASSWORD; |
| 109 return true; | 110 return true; |
| 110 } | 111 } |
| 111 | 112 |
| 112 | 113 |
| 113 // PasswordManagerDelegateImpl ------------------------------------------------ | 114 // PasswordManagerDelegateImpl ------------------------------------------------ |
| 114 | 115 |
| 115 void PasswordManagerDelegateImpl::FillPasswordForm( | 116 void PasswordManagerDelegateImpl::FillPasswordForm( |
| 116 const webkit::forms::PasswordFormFillData& form_data) { | 117 const webkit::forms::PasswordFormFillData& form_data) { |
| 118 bool disable_popup = tab_contents_->autofill_manager()->HasExternalDelegate(); |
| 119 |
| 117 tab_contents_->web_contents()->GetRenderViewHost()->Send( | 120 tab_contents_->web_contents()->GetRenderViewHost()->Send( |
| 118 new AutofillMsg_FillPasswordForm( | 121 new AutofillMsg_FillPasswordForm( |
| 119 tab_contents_->web_contents()->GetRenderViewHost()->GetRoutingID(), | 122 tab_contents_->web_contents()->GetRenderViewHost()->GetRoutingID(), |
| 120 form_data)); | 123 form_data, |
| 124 disable_popup)); |
| 121 } | 125 } |
| 122 | 126 |
| 123 void PasswordManagerDelegateImpl::AddSavePasswordInfoBar( | 127 void PasswordManagerDelegateImpl::AddSavePasswordInfoBar( |
| 124 PasswordFormManager* form_to_save) { | 128 PasswordFormManager* form_to_save) { |
| 125 tab_contents_->infobar_tab_helper()->AddInfoBar( | 129 tab_contents_->infobar_tab_helper()->AddInfoBar( |
| 126 new SavePasswordInfoBarDelegate( | 130 new SavePasswordInfoBarDelegate( |
| 127 tab_contents_->infobar_tab_helper(), form_to_save)); | 131 tab_contents_->infobar_tab_helper(), form_to_save)); |
| 128 } | 132 } |
| 129 | 133 |
| 130 Profile* PasswordManagerDelegateImpl::GetProfileForPasswordManager() { | 134 Profile* PasswordManagerDelegateImpl::GetProfileForPasswordManager() { |
| 131 return tab_contents_->profile(); | 135 return tab_contents_->profile(); |
| 132 } | 136 } |
| 133 | 137 |
| 134 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { | 138 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { |
| 135 content::NavigationEntry* entry = | 139 content::NavigationEntry* entry = |
| 136 tab_contents_->web_contents()->GetController().GetActiveEntry(); | 140 tab_contents_->web_contents()->GetController().GetActiveEntry(); |
| 137 if (!entry) { | 141 if (!entry) { |
| 138 NOTREACHED(); | 142 NOTREACHED(); |
| 139 return false; | 143 return false; |
| 140 } | 144 } |
| 141 | 145 |
| 142 return net::IsCertStatusError(entry->GetSSL().cert_status); | 146 return net::IsCertStatusError(entry->GetSSL().cert_status); |
| 143 } | 147 } |
| OLD | NEW |