OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/infobars/infobar_tab_helper.h" | 9 #include "chrome/browser/infobars/infobar_tab_helper.h" |
10 #include "chrome/browser/password_manager/password_form_manager.h" | 10 #include "chrome/browser/password_manager/password_form_manager.h" |
11 #include "chrome/browser/password_manager/password_manager.h" | 11 #include "chrome/browser/password_manager/password_manager.h" |
12 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 12 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
14 #include "chrome/common/autofill_messages.h" | 14 #include "chrome/common/autofill_messages.h" |
15 #include "content/browser/renderer_host/render_view_host.h" | 15 #include "content/browser/renderer_host/render_view_host.h" |
16 #include "content/browser/tab_contents/tab_contents.h" | 16 #include "content/browser/tab_contents/tab_contents.h" |
17 #include "grit/chromium_strings.h" | 17 #include "grit/chromium_strings.h" |
18 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
19 #include "grit/theme_resources_standard.h" | 19 #include "grit/theme_resources_standard.h" |
20 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
21 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
22 #include "webkit/glue/password_form.h" | 22 #include "webkit/forms/password_form.h" |
23 | 23 |
24 // After a successful *new* login attempt, we take the PasswordFormManager in | 24 // After a successful *new* login attempt, we take the PasswordFormManager in |
25 // provisional_save_manager_ and move it to a SavePasswordInfoBarDelegate while | 25 // provisional_save_manager_ and move it to a SavePasswordInfoBarDelegate while |
26 // the user makes up their mind with the "save password" infobar. Note if the | 26 // the user makes up their mind with the "save password" infobar. Note if the |
27 // login is one we already know about, the end of the line is | 27 // login is one we already know about, the end of the line is |
28 // provisional_save_manager_ because we just update it on success and so such | 28 // provisional_save_manager_ because we just update it on success and so such |
29 // forms never end up in an infobar. | 29 // forms never end up in an infobar. |
30 class SavePasswordInfoBarDelegate : public ConfirmInfoBarDelegate { | 30 class SavePasswordInfoBarDelegate : public ConfirmInfoBarDelegate { |
31 public: | 31 public: |
32 SavePasswordInfoBarDelegate(InfoBarTabHelper* infobar_helper, | 32 SavePasswordInfoBarDelegate(InfoBarTabHelper* infobar_helper, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 DCHECK(form_to_save_.get()); | 103 DCHECK(form_to_save_.get()); |
104 form_to_save_->PermanentlyBlacklist(); | 104 form_to_save_->PermanentlyBlacklist(); |
105 infobar_response_ = DONT_REMEMBER_PASSWORD; | 105 infobar_response_ = DONT_REMEMBER_PASSWORD; |
106 return true; | 106 return true; |
107 } | 107 } |
108 | 108 |
109 | 109 |
110 // PasswordManagerDelegateImpl ------------------------------------------------ | 110 // PasswordManagerDelegateImpl ------------------------------------------------ |
111 | 111 |
112 void PasswordManagerDelegateImpl::FillPasswordForm( | 112 void PasswordManagerDelegateImpl::FillPasswordForm( |
113 const webkit_glue::PasswordFormFillData& form_data) { | 113 const webkit::forms::PasswordFormFillData& form_data) { |
114 tab_contents_->tab_contents()->render_view_host()->Send( | 114 tab_contents_->tab_contents()->render_view_host()->Send( |
115 new AutofillMsg_FillPasswordForm( | 115 new AutofillMsg_FillPasswordForm( |
116 tab_contents_->tab_contents()->render_view_host()->routing_id(), | 116 tab_contents_->tab_contents()->render_view_host()->routing_id(), |
117 form_data)); | 117 form_data)); |
118 } | 118 } |
119 | 119 |
120 void PasswordManagerDelegateImpl::AddSavePasswordInfoBar( | 120 void PasswordManagerDelegateImpl::AddSavePasswordInfoBar( |
121 PasswordFormManager* form_to_save) { | 121 PasswordFormManager* form_to_save) { |
122 tab_contents_->infobar_tab_helper()->AddInfoBar( | 122 tab_contents_->infobar_tab_helper()->AddInfoBar( |
123 new SavePasswordInfoBarDelegate( | 123 new SavePasswordInfoBarDelegate( |
124 tab_contents_->infobar_tab_helper(), form_to_save)); | 124 tab_contents_->infobar_tab_helper(), form_to_save)); |
125 } | 125 } |
126 | 126 |
127 Profile* PasswordManagerDelegateImpl::GetProfileForPasswordManager() { | 127 Profile* PasswordManagerDelegateImpl::GetProfileForPasswordManager() { |
128 return tab_contents_->profile(); | 128 return tab_contents_->profile(); |
129 } | 129 } |
130 | 130 |
131 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { | 131 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { |
132 return tab_contents_->tab_contents()->controller().ssl_manager()-> | 132 return tab_contents_->tab_contents()->controller().ssl_manager()-> |
133 ProcessedSSLErrorFromRequest(); | 133 ProcessedSSLErrorFromRequest(); |
134 } | 134 } |
OLD | NEW |