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_generation_agent.h" | 5 #include "components/autofill/content/renderer/password_generation_agent.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "components/autofill/content/common/autofill_messages.h" | 10 #include "components/autofill/content/common/autofill_messages.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 return true; | 90 return true; |
91 } | 91 } |
92 return false; | 92 return false; |
93 } | 93 } |
94 | 94 |
95 void CopyValueToAllInputElements( | 95 void CopyValueToAllInputElements( |
96 const blink::WebString value, | 96 const blink::WebString value, |
97 std::vector<blink::WebInputElement>* elements) { | 97 std::vector<blink::WebInputElement>* elements) { |
98 for (std::vector<blink::WebInputElement>::iterator it = elements->begin(); | 98 for (std::vector<blink::WebInputElement>::iterator it = elements->begin(); |
99 it != elements->end(); ++it) { | 99 it != elements->end(); ++it) { |
100 it->setValue(value); | 100 it->setValue(value, true /* sendEvents */); |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 } // namespace | 104 } // namespace |
105 | 105 |
106 PasswordGenerationAgent::PasswordGenerationAgent( | 106 PasswordGenerationAgent::PasswordGenerationAgent( |
107 content::RenderView* render_view) | 107 content::RenderView* render_view) |
108 : content::RenderViewObserver(render_view), | 108 : content::RenderViewObserver(render_view), |
109 render_view_(render_view), | 109 render_view_(render_view), |
110 password_is_generated_(false), | 110 password_is_generated_(false), |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } | 249 } |
250 | 250 |
251 void PasswordGenerationAgent::OnPasswordAccepted( | 251 void PasswordGenerationAgent::OnPasswordAccepted( |
252 const base::string16& password) { | 252 const base::string16& password) { |
253 password_is_generated_ = true; | 253 password_is_generated_ = true; |
254 password_generation::LogPasswordGenerationEvent( | 254 password_generation::LogPasswordGenerationEvent( |
255 password_generation::PASSWORD_ACCEPTED); | 255 password_generation::PASSWORD_ACCEPTED); |
256 for (std::vector<blink::WebInputElement>::iterator it = | 256 for (std::vector<blink::WebInputElement>::iterator it = |
257 password_elements_.begin(); | 257 password_elements_.begin(); |
258 it != password_elements_.end(); ++it) { | 258 it != password_elements_.end(); ++it) { |
259 it->setValue(password); | 259 it->setValue(password, true /* sendEvents */); |
260 it->setAutofilled(true); | 260 it->setAutofilled(true); |
261 // Advance focus to the next input field. We assume password fields in | 261 // Advance focus to the next input field. We assume password fields in |
262 // an account creation form are always adjacent. | 262 // an account creation form are always adjacent. |
263 render_view_->GetWebView()->advanceFocus(false); | 263 render_view_->GetWebView()->advanceFocus(false); |
264 } | 264 } |
265 } | 265 } |
266 | 266 |
267 void PasswordGenerationAgent::OnAccountCreationFormsDetected( | 267 void PasswordGenerationAgent::OnAccountCreationFormsDetected( |
268 const std::vector<autofill::FormData>& forms) { | 268 const std::vector<autofill::FormData>& forms) { |
269 generation_enabled_forms_.insert( | 269 generation_enabled_forms_.insert( |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 *possible_account_creation_form_)); | 402 *possible_account_creation_form_)); |
403 | 403 |
404 editing_popup_shown_ = true; | 404 editing_popup_shown_ = true; |
405 } | 405 } |
406 | 406 |
407 void PasswordGenerationAgent::HidePopup() { | 407 void PasswordGenerationAgent::HidePopup() { |
408 Send(new AutofillHostMsg_HidePasswordGenerationPopup(routing_id())); | 408 Send(new AutofillHostMsg_HidePasswordGenerationPopup(routing_id())); |
409 } | 409 } |
410 | 410 |
411 } // namespace autofill | 411 } // namespace autofill |
OLD | NEW |