| 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_manager_delegate_impl.h" | 5 #include "chrome/browser/password_manager/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 "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 10 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
| 11 #include "chrome/browser/infobars/infobar_service.h" | 11 #include "chrome/browser/infobars/infobar_service.h" |
| 12 #include "chrome/browser/password_manager/password_form_manager.h" | 12 #include "chrome/browser/password_manager/password_form_manager.h" |
| 13 #include "chrome/browser/password_manager/password_manager.h" | 13 #include "chrome/browser/password_manager/password_manager.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/sync/one_click_signin_helper.h" | 15 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
| 16 #include "components/autofill/browser/autofill_manager.h" | 16 #include "components/autofill/browser/autofill_manager.h" |
| 17 #include "components/autofill/common/autofill_messages.h" | 17 #include "components/autofill/common/autofill_messages.h" |
| 18 #include "components/autofill/content/browser/autofill_driver_impl.h" |
| 18 #include "content/public/browser/navigation_entry.h" | 19 #include "content/public/browser/navigation_entry.h" |
| 19 #include "content/public/browser/render_view_host.h" | 20 #include "content/public/browser/render_view_host.h" |
| 20 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| 21 #include "content/public/common/password_form.h" | 22 #include "content/public/common/password_form.h" |
| 22 #include "content/public/common/ssl_status.h" | 23 #include "content/public/common/ssl_status.h" |
| 23 #include "google_apis/gaia/gaia_urls.h" | 24 #include "google_apis/gaia/gaia_urls.h" |
| 24 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
| 25 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| 26 #include "grit/theme_resources.h" | 27 #include "grit/theme_resources.h" |
| 27 #include "net/cert/cert_status_flags.h" | 28 #include "net/cert/cert_status_flags.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 PasswordManagerDelegateImpl::PasswordManagerDelegateImpl( | 160 PasswordManagerDelegateImpl::PasswordManagerDelegateImpl( |
| 160 content::WebContents* web_contents) | 161 content::WebContents* web_contents) |
| 161 : web_contents_(web_contents) { | 162 : web_contents_(web_contents) { |
| 162 } | 163 } |
| 163 | 164 |
| 164 PasswordManagerDelegateImpl::~PasswordManagerDelegateImpl() { | 165 PasswordManagerDelegateImpl::~PasswordManagerDelegateImpl() { |
| 165 } | 166 } |
| 166 | 167 |
| 167 void PasswordManagerDelegateImpl::FillPasswordForm( | 168 void PasswordManagerDelegateImpl::FillPasswordForm( |
| 168 const autofill::PasswordFormFillData& form_data) { | 169 const autofill::PasswordFormFillData& form_data) { |
| 169 autofill::AutofillManager* autofill_manager = | 170 autofill::AutofillDriverImpl* autofill_driver = |
| 170 autofill::AutofillManager::FromWebContents(web_contents_); | 171 autofill::AutofillDriverImpl::FromWebContents(web_contents_); |
| 171 // Browser process will own popup UI, so renderer should not show the popup. | 172 // Browser process will own popup UI, so renderer should not show the popup. |
| 172 bool disable_popup = autofill_manager->IsNativeUiEnabled(); | 173 bool disable_popup = autofill_driver->autofill_manager()->IsNativeUiEnabled(); |
| 173 | 174 |
| 174 web_contents_->GetRenderViewHost()->Send( | 175 web_contents_->GetRenderViewHost()->Send( |
| 175 new AutofillMsg_FillPasswordForm( | 176 new AutofillMsg_FillPasswordForm( |
| 176 web_contents_->GetRenderViewHost()->GetRoutingID(), | 177 web_contents_->GetRenderViewHost()->GetRoutingID(), |
| 177 form_data, | 178 form_data, |
| 178 disable_popup)); | 179 disable_popup)); |
| 179 } | 180 } |
| 180 | 181 |
| 181 void PasswordManagerDelegateImpl::AddSavePasswordInfoBarIfPermitted( | 182 void PasswordManagerDelegateImpl::AddSavePasswordInfoBarIfPermitted( |
| 182 PasswordFormManager* form_to_save) { | 183 PasswordFormManager* form_to_save) { |
| 183 SavePasswordInfoBarDelegate::Create(web_contents_, form_to_save); | 184 SavePasswordInfoBarDelegate::Create(web_contents_, form_to_save); |
| 184 } | 185 } |
| 185 | 186 |
| 186 Profile* PasswordManagerDelegateImpl::GetProfile() { | 187 Profile* PasswordManagerDelegateImpl::GetProfile() { |
| 187 return Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 188 return Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
| 188 } | 189 } |
| 189 | 190 |
| 190 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { | 191 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { |
| 191 content::NavigationEntry* entry = | 192 content::NavigationEntry* entry = |
| 192 web_contents_->GetController().GetActiveEntry(); | 193 web_contents_->GetController().GetActiveEntry(); |
| 193 if (!entry) { | 194 if (!entry) { |
| 194 NOTREACHED(); | 195 NOTREACHED(); |
| 195 return false; | 196 return false; |
| 196 } | 197 } |
| 197 | 198 |
| 198 return net::IsCertStatusError(entry->GetSSL().cert_status); | 199 return net::IsCertStatusError(entry->GetSSL().cert_status); |
| 199 } | 200 } |
| OLD | NEW |