Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/content/renderer/password_autofill_agent.h" | 5 #include "components/autofill/content/renderer/password_autofill_agent.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 960 } | 960 } |
| 961 } | 961 } |
| 962 | 962 |
| 963 bool PasswordAutofillAgent::OnMessageReceived(const IPC::Message& message) { | 963 bool PasswordAutofillAgent::OnMessageReceived(const IPC::Message& message) { |
| 964 bool handled = true; | 964 bool handled = true; |
| 965 IPC_BEGIN_MESSAGE_MAP(PasswordAutofillAgent, message) | 965 IPC_BEGIN_MESSAGE_MAP(PasswordAutofillAgent, message) |
| 966 IPC_MESSAGE_HANDLER(AutofillMsg_FillPasswordForm, OnFillPasswordForm) | 966 IPC_MESSAGE_HANDLER(AutofillMsg_FillPasswordForm, OnFillPasswordForm) |
| 967 IPC_MESSAGE_HANDLER(AutofillMsg_SetLoggingState, OnSetLoggingState) | 967 IPC_MESSAGE_HANDLER(AutofillMsg_SetLoggingState, OnSetLoggingState) |
| 968 IPC_MESSAGE_HANDLER(AutofillMsg_AutofillUsernameDataReceived, | 968 IPC_MESSAGE_HANDLER(AutofillMsg_AutofillUsernameDataReceived, |
| 969 OnAutofillUsernameDataReceived) | 969 OnAutofillUsernameDataReceived) |
| 970 IPC_MESSAGE_HANDLER(AutofillMsg_FindFocusedPasswordForm, | |
| 971 OnFindFocusedPasswordForm) | |
| 970 IPC_MESSAGE_UNHANDLED(handled = false) | 972 IPC_MESSAGE_UNHANDLED(handled = false) |
| 971 IPC_END_MESSAGE_MAP() | 973 IPC_END_MESSAGE_MAP() |
| 972 return handled; | 974 return handled; |
| 973 } | 975 } |
| 974 | 976 |
| 975 void PasswordAutofillAgent::DidFinishDocumentLoad() { | 977 void PasswordAutofillAgent::DidFinishDocumentLoad() { |
| 976 // The |frame| contents have been parsed, but not yet rendered. Let the | 978 // The |frame| contents have been parsed, but not yet rendered. Let the |
| 977 // PasswordManager know that forms are loaded, even though we can't yet tell | 979 // PasswordManager know that forms are loaded, even though we can't yet tell |
| 978 // whether they're visible. | 980 // whether they're visible. |
| 979 SendPasswordForms(false); | 981 SendPasswordForms(false); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1234 | 1236 |
| 1235 void PasswordAutofillAgent::OnSetLoggingState(bool active) { | 1237 void PasswordAutofillAgent::OnSetLoggingState(bool active) { |
| 1236 logging_state_active_ = active; | 1238 logging_state_active_ = active; |
| 1237 } | 1239 } |
| 1238 | 1240 |
| 1239 void PasswordAutofillAgent::OnAutofillUsernameDataReceived( | 1241 void PasswordAutofillAgent::OnAutofillUsernameDataReceived( |
| 1240 const FormDataFieldDataMap& predictions) { | 1242 const FormDataFieldDataMap& predictions) { |
| 1241 form_predictions_ = predictions; | 1243 form_predictions_ = predictions; |
| 1242 } | 1244 } |
| 1243 | 1245 |
| 1246 void PasswordAutofillAgent::OnFindFocusedPasswordForm() { | |
| 1247 scoped_ptr<PasswordForm> password_form; | |
| 1248 | |
| 1249 blink::WebElement element = render_frame()->GetFocusedElement(); | |
| 1250 if (!element.isNull() && element.hasHTMLTagName("input")) { | |
| 1251 blink::WebInputElement input = element.to<blink::WebInputElement>(); | |
| 1252 if (input.isPasswordField() && !input.form().isNull()) { | |
| 1253 password_form = CreatePasswordForm( | |
| 1254 input.form(), &nonscript_modified_values_, &form_predictions_); | |
| 1255 } | |
| 1256 } | |
| 1257 | |
| 1258 if (!password_form.get()) | |
| 1259 password_form.reset(new PasswordForm()); | |
|
Mike West
2015/05/29 12:26:53
Optional nit: I'd fold this into line 1247; that i
msramek
2015/05/29 12:38:55
If the WebFormElement is ununderstandable to Creat
| |
| 1260 | |
| 1261 Send(new AutofillHostMsg_FocusedPasswordFormFound( | |
| 1262 routing_id(), *password_form)); | |
| 1263 } | |
| 1264 | |
| 1244 //////////////////////////////////////////////////////////////////////////////// | 1265 //////////////////////////////////////////////////////////////////////////////// |
| 1245 // PasswordAutofillAgent, private: | 1266 // PasswordAutofillAgent, private: |
| 1246 | 1267 |
| 1247 PasswordAutofillAgent::PasswordInfo::PasswordInfo() | 1268 PasswordAutofillAgent::PasswordInfo::PasswordInfo() |
| 1248 : backspace_pressed_last(false), password_was_edited_last(false) { | 1269 : backspace_pressed_last(false), password_was_edited_last(false) { |
| 1249 } | 1270 } |
| 1250 | 1271 |
| 1251 bool PasswordAutofillAgent::ShowSuggestionPopup( | 1272 bool PasswordAutofillAgent::ShowSuggestionPopup( |
| 1252 const PasswordFormFillData& fill_data, | 1273 const PasswordFormFillData& fill_data, |
| 1253 const blink::WebInputElement& user_input, | 1274 const blink::WebInputElement& user_input, |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1430 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::DidStopLoading() { | 1451 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::DidStopLoading() { |
| 1431 agent_->DidStopLoading(); | 1452 agent_->DidStopLoading(); |
| 1432 } | 1453 } |
| 1433 | 1454 |
| 1434 void PasswordAutofillAgent::LegacyPasswordAutofillAgent:: | 1455 void PasswordAutofillAgent::LegacyPasswordAutofillAgent:: |
| 1435 DidStartProvisionalLoad(blink::WebLocalFrame* navigated_frame) { | 1456 DidStartProvisionalLoad(blink::WebLocalFrame* navigated_frame) { |
| 1436 agent_->LegacyDidStartProvisionalLoad(navigated_frame); | 1457 agent_->LegacyDidStartProvisionalLoad(navigated_frame); |
| 1437 } | 1458 } |
| 1438 | 1459 |
| 1439 } // namespace autofill | 1460 } // namespace autofill |
| OLD | NEW |