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 blink::WebElement element = render_frame()->GetFocusedElement(); | |
| 1248 | |
| 1249 DCHECK(!element.isNull()); | |
|
Mike West
2015/05/29 07:24:49
Hrm. Execution doesn't stop while a context menu i
msramek
2015/05/29 11:57:21
Ehh, thanks for the sanity check.
I also added a
| |
| 1250 DCHECK(element.hasHTMLTagName("input")) << | |
| 1251 base::UTF16ToASCII(element.tagName()); | |
| 1252 | |
| 1253 blink::WebInputElement input = element.to<blink::WebInputElement>(); | |
| 1254 DCHECK(input.isPasswordField()); | |
| 1255 | |
| 1256 scoped_ptr<PasswordForm> password_form(CreatePasswordForm( | |
| 1257 input.form(), &nonscript_modified_values_, &form_predictions_)); | |
| 1258 Send(new AutofillHostMsg_FocusedPasswordFormFound( | |
| 1259 routing_id(), *password_form)); | |
| 1260 } | |
| 1261 | |
| 1244 //////////////////////////////////////////////////////////////////////////////// | 1262 //////////////////////////////////////////////////////////////////////////////// |
| 1245 // PasswordAutofillAgent, private: | 1263 // PasswordAutofillAgent, private: |
| 1246 | 1264 |
| 1247 PasswordAutofillAgent::PasswordInfo::PasswordInfo() | 1265 PasswordAutofillAgent::PasswordInfo::PasswordInfo() |
| 1248 : backspace_pressed_last(false), password_was_edited_last(false) { | 1266 : backspace_pressed_last(false), password_was_edited_last(false) { |
| 1249 } | 1267 } |
| 1250 | 1268 |
| 1251 bool PasswordAutofillAgent::ShowSuggestionPopup( | 1269 bool PasswordAutofillAgent::ShowSuggestionPopup( |
| 1252 const PasswordFormFillData& fill_data, | 1270 const PasswordFormFillData& fill_data, |
| 1253 const blink::WebInputElement& user_input, | 1271 const blink::WebInputElement& user_input, |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1430 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::DidStopLoading() { | 1448 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::DidStopLoading() { |
| 1431 agent_->DidStopLoading(); | 1449 agent_->DidStopLoading(); |
| 1432 } | 1450 } |
| 1433 | 1451 |
| 1434 void PasswordAutofillAgent::LegacyPasswordAutofillAgent:: | 1452 void PasswordAutofillAgent::LegacyPasswordAutofillAgent:: |
| 1435 DidStartProvisionalLoad(blink::WebLocalFrame* navigated_frame) { | 1453 DidStartProvisionalLoad(blink::WebLocalFrame* navigated_frame) { |
| 1436 agent_->LegacyDidStartProvisionalLoad(navigated_frame); | 1454 agent_->LegacyDidStartProvisionalLoad(navigated_frame); |
| 1437 } | 1455 } |
| 1438 | 1456 |
| 1439 } // namespace autofill | 1457 } // namespace autofill |
| OLD | NEW |