| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1230 // RenderView to be instantiated (such as redirects to the WebStore) | 1230 // RenderView to be instantiated (such as redirects to the WebStore) |
| 1231 // we will never get to finish the load. | 1231 // we will never get to finish the load. |
| 1232 Send(new AutofillHostMsg_PasswordFormSubmitted(routing_id(), | 1232 Send(new AutofillHostMsg_PasswordFormSubmitted(routing_id(), |
| 1233 *submitted_form)); | 1233 *submitted_form)); |
| 1234 provisionally_saved_form_.reset(); | 1234 provisionally_saved_form_.reset(); |
| 1235 } else if (logger) { | 1235 } else if (logger) { |
| 1236 logger->LogMessage(Logger::STRING_FORM_IS_NOT_PASSWORD); | 1236 logger->LogMessage(Logger::STRING_FORM_IS_NOT_PASSWORD); |
| 1237 } | 1237 } |
| 1238 } | 1238 } |
| 1239 | 1239 |
| 1240 void PasswordAutofillAgent::OnDestruct() { | |
| 1241 // As described in http://crbug.com/608100, there might be an AutofillAgent | |
| 1242 // method in-progress lower on the stack. Destroying |this| would cause | |
| 1243 // use-after-free once the lower stack frame becomes active. Instead, a task | |
| 1244 // needs to be posted to delete this. | |
| 1245 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); | |
| 1246 } | |
| 1247 | |
| 1248 void PasswordAutofillAgent::DidStartProvisionalLoad() { | 1240 void PasswordAutofillAgent::DidStartProvisionalLoad() { |
| 1249 std::unique_ptr<RendererSavePasswordProgressLogger> logger; | 1241 std::unique_ptr<RendererSavePasswordProgressLogger> logger; |
| 1250 if (logging_state_active_) { | 1242 if (logging_state_active_) { |
| 1251 logger.reset(new RendererSavePasswordProgressLogger(this, routing_id())); | 1243 logger.reset(new RendererSavePasswordProgressLogger(this, routing_id())); |
| 1252 logger->LogMessage(Logger::STRING_DID_START_PROVISIONAL_LOAD_METHOD); | 1244 logger->LogMessage(Logger::STRING_DID_START_PROVISIONAL_LOAD_METHOD); |
| 1253 } | 1245 } |
| 1254 | 1246 |
| 1255 const blink::WebLocalFrame* navigated_frame = render_frame()->GetWebFrame(); | 1247 const blink::WebLocalFrame* navigated_frame = render_frame()->GetWebFrame(); |
| 1256 if (navigated_frame->parent()) { | 1248 if (navigated_frame->parent()) { |
| 1257 if (logger) | 1249 if (logger) |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1543 } | 1535 } |
| 1544 | 1536 |
| 1545 bool PasswordAutofillAgent::ProvisionallySavedPasswordIsValid() { | 1537 bool PasswordAutofillAgent::ProvisionallySavedPasswordIsValid() { |
| 1546 return provisionally_saved_form_ && | 1538 return provisionally_saved_form_ && |
| 1547 !provisionally_saved_form_->username_value.empty() && | 1539 !provisionally_saved_form_->username_value.empty() && |
| 1548 !(provisionally_saved_form_->password_value.empty() && | 1540 !(provisionally_saved_form_->password_value.empty() && |
| 1549 provisionally_saved_form_->new_password_value.empty()); | 1541 provisionally_saved_form_->new_password_value.empty()); |
| 1550 } | 1542 } |
| 1551 | 1543 |
| 1552 } // namespace autofill | 1544 } // namespace autofill |
| OLD | NEW |