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/renderer/autofill/password_generation_manager.h" | 5 #include "chrome/renderer/autofill/password_generation_manager.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/common/autofill_messages.h" | 8 #include "chrome/common/autofill_messages.h" |
9 #include "chrome/common/password_generation_util.h" | 9 #include "chrome/common/password_generation_util.h" |
10 #include "content/public/renderer/password_form_conversion_utils.h" | 10 #include "content/public/renderer/password_form_conversion_utils.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // them. | 96 // them. |
97 if (!enabled_) | 97 if (!enabled_) |
98 return; | 98 return; |
99 | 99 |
100 if (!ShouldAnalyzeDocument(frame->document())) | 100 if (!ShouldAnalyzeDocument(frame->document())) |
101 return; | 101 return; |
102 | 102 |
103 WebKit::WebVector<WebKit::WebFormElement> forms; | 103 WebKit::WebVector<WebKit::WebFormElement> forms; |
104 frame->document().forms(forms); | 104 frame->document().forms(forms); |
105 for (size_t i = 0; i < forms.size(); ++i) { | 105 for (size_t i = 0; i < forms.size(); ++i) { |
106 // Ignore forms with autocomplete turned off for now. We may remove this in | 106 if (forms[i].isNull()) |
107 // the future, as we only want to avoid creating passwords if the signin | |
108 // form has autocomplete turned off. | |
109 if (forms[i].isNull() || !forms[i].autoComplete()) | |
110 continue; | 107 continue; |
111 | 108 |
112 // If we can't get a valid PasswordForm, we skip this form because the | 109 // If we can't get a valid PasswordForm, we skip this form because the |
113 // the password won't get saved even if we generate it. | 110 // the password won't get saved even if we generate it. |
114 scoped_ptr<content::PasswordForm> password_form( | 111 scoped_ptr<content::PasswordForm> password_form( |
115 content::CreatePasswordForm(forms[i])); | 112 content::CreatePasswordForm(forms[i])); |
116 if (!password_form.get()) { | 113 if (!password_form.get()) { |
117 DVLOG(2) << "Skipping form as it would not be saved"; | 114 DVLOG(2) << "Skipping form as it would not be saved"; |
118 continue; | 115 continue; |
119 } | 116 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 passwords_[0].decorationElementFor(this).setAttribute("style", | 247 passwords_[0].decorationElementFor(this).setAttribute("style", |
251 "display:block"); | 248 "display:block"); |
252 password_generation::LogPasswordGenerationEvent( | 249 password_generation::LogPasswordGenerationEvent( |
253 password_generation::ICON_SHOWN); | 250 password_generation::ICON_SHOWN); |
254 return; | 251 return; |
255 } | 252 } |
256 } | 253 } |
257 } | 254 } |
258 | 255 |
259 } // namespace autofill | 256 } // namespace autofill |
OLD | NEW |