OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/password_autofill_agent.h" | 5 #include "components/autofill/renderer/password_autofill_agent.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "components/autofill/common/autofill_messages.h" | 10 #include "components/autofill/common/autofill_messages.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 return FindLoginInfo(node, &input, &password); | 327 return FindLoginInfo(node, &input, &password); |
328 } | 328 } |
329 | 329 |
330 bool PasswordAutofillAgent::DidClearAutofillSelection( | 330 bool PasswordAutofillAgent::DidClearAutofillSelection( |
331 const WebKit::WebNode& node) { | 331 const WebKit::WebNode& node) { |
332 WebKit::WebInputElement input; | 332 WebKit::WebInputElement input; |
333 PasswordInfo password; | 333 PasswordInfo password; |
334 return FindLoginInfo(node, &input, &password); | 334 return FindLoginInfo(node, &input, &password); |
335 } | 335 } |
336 | 336 |
| 337 bool PasswordAutofillAgent::ShowSuggestions( |
| 338 const WebKit::WebInputElement& element) { |
| 339 LoginToPasswordInfoMap::const_iterator iter = |
| 340 login_to_password_info_.find(element); |
| 341 if (iter == login_to_password_info_.end()) |
| 342 return false; |
| 343 |
| 344 return ShowSuggestionPopup(iter->second.fill_data, element); |
| 345 } |
| 346 |
337 void PasswordAutofillAgent::SendPasswordForms(WebKit::WebFrame* frame, | 347 void PasswordAutofillAgent::SendPasswordForms(WebKit::WebFrame* frame, |
338 bool only_visible) { | 348 bool only_visible) { |
339 // Make sure that this security origin is allowed to use password manager. | 349 // Make sure that this security origin is allowed to use password manager. |
340 WebKit::WebSecurityOrigin origin = frame->document().securityOrigin(); | 350 WebKit::WebSecurityOrigin origin = frame->document().securityOrigin(); |
341 if (!origin.canAccessPasswordManager()) | 351 if (!origin.canAccessPasswordManager()) |
342 return; | 352 return; |
343 | 353 |
344 WebKit::WebVector<WebKit::WebFormElement> forms; | 354 WebKit::WebVector<WebKit::WebFormElement> forms; |
345 frame->document().forms(forms); | 355 frame->document().forms(forms); |
346 | 356 |
347 std::vector<content::PasswordForm> password_forms; | 357 std::vector<content::PasswordForm> password_forms; |
348 for (size_t i = 0; i < forms.size(); ++i) { | 358 for (size_t i = 0; i < forms.size(); ++i) { |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(input); | 648 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(input); |
639 if (iter == login_to_password_info_.end()) | 649 if (iter == login_to_password_info_.end()) |
640 return false; | 650 return false; |
641 | 651 |
642 *found_input = input; | 652 *found_input = input; |
643 *found_password = iter->second; | 653 *found_password = iter->second; |
644 return true; | 654 return true; |
645 } | 655 } |
646 | 656 |
647 } // namespace autofill | 657 } // namespace autofill |
OLD | NEW |