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_ForceSavePassword, OnForceSavePassword) | |
| 970 IPC_MESSAGE_UNHANDLED(handled = false) | 971 IPC_MESSAGE_UNHANDLED(handled = false) |
| 971 IPC_END_MESSAGE_MAP() | 972 IPC_END_MESSAGE_MAP() |
| 972 return handled; | 973 return handled; |
| 973 } | 974 } |
| 974 | 975 |
| 975 void PasswordAutofillAgent::DidFinishDocumentLoad() { | 976 void PasswordAutofillAgent::DidFinishDocumentLoad() { |
| 976 // The |frame| contents have been parsed, but not yet rendered. Let the | 977 // 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 | 978 // PasswordManager know that forms are loaded, even though we can't yet tell |
| 978 // whether they're visible. | 979 // whether they're visible. |
| 979 SendPasswordForms(false); | 980 SendPasswordForms(false); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1234 | 1235 |
| 1235 void PasswordAutofillAgent::OnSetLoggingState(bool active) { | 1236 void PasswordAutofillAgent::OnSetLoggingState(bool active) { |
| 1236 logging_state_active_ = active; | 1237 logging_state_active_ = active; |
| 1237 } | 1238 } |
| 1238 | 1239 |
| 1239 void PasswordAutofillAgent::OnAutofillUsernameDataReceived( | 1240 void PasswordAutofillAgent::OnAutofillUsernameDataReceived( |
| 1240 const FormDataFieldDataMap& predictions) { | 1241 const FormDataFieldDataMap& predictions) { |
| 1241 form_predictions_ = predictions; | 1242 form_predictions_ = predictions; |
| 1242 } | 1243 } |
| 1243 | 1244 |
| 1245 void PasswordAutofillAgent::OnForceSavePassword() { | |
| 1246 blink::WebElement element = render_frame()->GetFocusedElement(); | |
| 1247 | |
| 1248 DCHECK(!element.isNull()); | |
| 1249 DCHECK(element.hasHTMLTagName("input")); | |
|
vabr (Chromium)
2015/05/28 19:41:23
optional: Consider adding
<< element.tagName()
to
msramek
2015/05/28 20:28:28
Done.
| |
| 1250 | |
| 1251 blink::WebInputElement input = element.to<blink::WebInputElement>(); | |
| 1252 DCHECK(input.isPasswordField()); | |
| 1253 | |
| 1254 ProvisionallySavePassword(input.form(), RESTRICTION_NONE); | |
|
vabr (Chromium)
2015/05/28 19:41:23
Why do we need to provisionally save the password,
msramek
2015/05/28 20:28:28
Here, ProvisionallySavePassword() is used to trans
vabr (Chromium)
2015/05/29 06:48:50
Acknowledged.
| |
| 1255 Send(new AutofillHostMsg_PasswordFormForceSaveRequested( | |
| 1256 routing_id(), *provisionally_saved_form_)); | |
| 1257 } | |
| 1258 | |
| 1244 //////////////////////////////////////////////////////////////////////////////// | 1259 //////////////////////////////////////////////////////////////////////////////// |
| 1245 // PasswordAutofillAgent, private: | 1260 // PasswordAutofillAgent, private: |
| 1246 | 1261 |
| 1247 PasswordAutofillAgent::PasswordInfo::PasswordInfo() | 1262 PasswordAutofillAgent::PasswordInfo::PasswordInfo() |
| 1248 : backspace_pressed_last(false), password_was_edited_last(false) { | 1263 : backspace_pressed_last(false), password_was_edited_last(false) { |
| 1249 } | 1264 } |
| 1250 | 1265 |
| 1251 bool PasswordAutofillAgent::ShowSuggestionPopup( | 1266 bool PasswordAutofillAgent::ShowSuggestionPopup( |
| 1252 const PasswordFormFillData& fill_data, | 1267 const PasswordFormFillData& fill_data, |
| 1253 const blink::WebInputElement& user_input, | 1268 const blink::WebInputElement& user_input, |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1430 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::DidStopLoading() { | 1445 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::DidStopLoading() { |
| 1431 agent_->DidStopLoading(); | 1446 agent_->DidStopLoading(); |
| 1432 } | 1447 } |
| 1433 | 1448 |
| 1434 void PasswordAutofillAgent::LegacyPasswordAutofillAgent:: | 1449 void PasswordAutofillAgent::LegacyPasswordAutofillAgent:: |
| 1435 DidStartProvisionalLoad(blink::WebLocalFrame* navigated_frame) { | 1450 DidStartProvisionalLoad(blink::WebLocalFrame* navigated_frame) { |
| 1436 agent_->LegacyDidStartProvisionalLoad(navigated_frame); | 1451 agent_->LegacyDidStartProvisionalLoad(navigated_frame); |
| 1437 } | 1452 } |
| 1438 | 1453 |
| 1439 } // namespace autofill | 1454 } // namespace autofill |
| OLD | NEW |