Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: components/autofill/content/renderer/password_autofill_agent.cc

Issue 2586413002: Remove Autofill's ContainsNonNullEntryForNonNullKey. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 } 551 }
552 552
553 // Fill if we have an exact match for the username. Note that this sets 553 // Fill if we have an exact match for the username. Note that this sets
554 // username to autofilled. 554 // username to autofilled.
555 return FillUserNameAndPassword( 555 return FillUserNameAndPassword(
556 &username_element, &password_element, fill_data, 556 &username_element, &password_element, fill_data,
557 true /* exact_username_match */, false /* set_selection */, 557 true /* exact_username_match */, false /* set_selection */,
558 field_value_and_properties_map, registration_callback, logger); 558 field_value_and_properties_map, registration_callback, logger);
559 } 559 }
560 560
561 // Takes a |map| with pointers as keys and linked_ptr as values, and returns
562 // true if |key| is not NULL and |map| contains a non-NULL entry for |key|.
563 // Makes sure not to create an entry as a side effect of using the operator [].
564 template <class Key, class Value>
565 bool ContainsNonNullEntryForNonNullKey(
566 const std::map<Key*, linked_ptr<Value>>& map,
567 Key* key) {
568 if (!key)
569 return false;
570 auto it = map.find(key);
571 return it != map.end() && it->second.get();
572 }
573
574 } // namespace 561 } // namespace
575 562
576 //////////////////////////////////////////////////////////////////////////////// 563 ////////////////////////////////////////////////////////////////////////////////
577 // PasswordAutofillAgent, public: 564 // PasswordAutofillAgent, public:
578 565
579 PasswordAutofillAgent::PasswordAutofillAgent(content::RenderFrame* render_frame) 566 PasswordAutofillAgent::PasswordAutofillAgent(content::RenderFrame* render_frame)
580 : content::RenderFrameObserver(render_frame), 567 : content::RenderFrameObserver(render_frame),
581 logging_state_active_(false), 568 logging_state_active_(false),
582 was_username_autofilled_(false), 569 was_username_autofilled_(false),
583 was_password_autofilled_(false), 570 was_password_autofilled_(false),
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 PasswordAutofillAgent::GetPasswordManagerDriver() { 1488 PasswordAutofillAgent::GetPasswordManagerDriver() {
1502 if (!password_manager_driver_) { 1489 if (!password_manager_driver_) {
1503 render_frame()->GetRemoteInterfaces()->GetInterface( 1490 render_frame()->GetRemoteInterfaces()->GetInterface(
1504 mojo::GetProxy(&password_manager_driver_)); 1491 mojo::GetProxy(&password_manager_driver_));
1505 } 1492 }
1506 1493
1507 return password_manager_driver_; 1494 return password_manager_driver_;
1508 } 1495 }
1509 1496
1510 } // namespace autofill 1497 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698