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

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

Issue 767353002: Support for password manager suggestions on password fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Added message value to iOS grit whitelist Created 6 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
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 "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/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "components/autofill/content/common/autofill_messages.h" 12 #include "components/autofill/content/common/autofill_messages.h"
13 #include "components/autofill/content/renderer/form_autofill_util.h" 13 #include "components/autofill/content/renderer/form_autofill_util.h"
14 #include "components/autofill/content/renderer/password_form_conversion_utils.h" 14 #include "components/autofill/content/renderer/password_form_conversion_utils.h"
15 #include "components/autofill/content/renderer/renderer_save_password_progress_l ogger.h" 15 #include "components/autofill/content/renderer/renderer_save_password_progress_l ogger.h"
16 #include "components/autofill/core/common/autofill_constants.h"
16 #include "components/autofill/core/common/form_field_data.h" 17 #include "components/autofill/core/common/form_field_data.h"
17 #include "components/autofill/core/common/password_form.h" 18 #include "components/autofill/core/common/password_form.h"
18 #include "components/autofill/core/common/password_form_fill_data.h" 19 #include "components/autofill/core/common/password_form_fill_data.h"
19 #include "content/public/renderer/document_state.h" 20 #include "content/public/renderer/document_state.h"
20 #include "content/public/renderer/navigation_state.h" 21 #include "content/public/renderer/navigation_state.h"
21 #include "content/public/renderer/render_frame.h" 22 #include "content/public/renderer/render_frame.h"
22 #include "content/public/renderer/render_view.h" 23 #include "content/public/renderer/render_view.h"
23 #include "third_party/WebKit/public/platform/WebVector.h" 24 #include "third_party/WebKit/public/platform/WebVector.h"
24 #include "third_party/WebKit/public/web/WebAutofillClient.h" 25 #include "third_party/WebKit/public/web/WebAutofillClient.h"
25 #include "third_party/WebKit/public/web/WebDocument.h" 26 #include "third_party/WebKit/public/web/WebDocument.h"
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 LoginToPasswordInfoKeyMap::const_iterator key_it = 1062 LoginToPasswordInfoKeyMap::const_iterator key_it =
1062 login_to_password_info_key_.find(user_input); 1063 login_to_password_info_key_.find(user_input);
1063 DCHECK(key_it != login_to_password_info_key_.end()); 1064 DCHECK(key_it != login_to_password_info_key_.end());
1064 1065
1065 float scale = 1066 float scale =
1066 render_frame()->GetRenderView()->GetWebView()->pageScaleFactor(); 1067 render_frame()->GetRenderView()->GetWebView()->pageScaleFactor();
1067 gfx::RectF bounding_box_scaled(bounding_box.x() * scale, 1068 gfx::RectF bounding_box_scaled(bounding_box.x() * scale,
1068 bounding_box.y() * scale, 1069 bounding_box.y() * scale,
1069 bounding_box.width() * scale, 1070 bounding_box.width() * scale,
1070 bounding_box.height() * scale); 1071 bounding_box.height() * scale);
1072 int options = 0;
1073 if (show_all)
1074 options |= SHOW_ALL;
1071 Send(new AutofillHostMsg_ShowPasswordSuggestions( 1075 Send(new AutofillHostMsg_ShowPasswordSuggestions(
1072 routing_id(), key_it->second, field.text_direction, user_input.value(), 1076 routing_id(), key_it->second, field.text_direction, user_input.value(),
1073 show_all, bounding_box_scaled)); 1077 options, bounding_box_scaled));
1074 1078
1075 bool suggestions_present = false; 1079 bool suggestions_present = false;
1076 if (GetSuggestionsStats(fill_data, user_input.value(), show_all, 1080 if (GetSuggestionsStats(fill_data, user_input.value(), show_all,
1077 &suggestions_present)) { 1081 &suggestions_present)) {
1078 usernames_usage_ = OTHER_POSSIBLE_USERNAME_SHOWN; 1082 usernames_usage_ = OTHER_POSSIBLE_USERNAME_SHOWN;
1079 } 1083 }
1080 return suggestions_present; 1084 return suggestions_present;
1081 } 1085 }
1082 1086
1083 void PasswordAutofillAgent::PerformInlineAutocomplete( 1087 void PasswordAutofillAgent::PerformInlineAutocomplete(
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 agent_->WillSendSubmitEvent(frame, form); 1216 agent_->WillSendSubmitEvent(frame, form);
1213 } 1217 }
1214 1218
1215 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::WillSubmitForm( 1219 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::WillSubmitForm(
1216 blink::WebLocalFrame* frame, 1220 blink::WebLocalFrame* frame,
1217 const blink::WebFormElement& form) { 1221 const blink::WebFormElement& form) {
1218 agent_->WillSubmitForm(frame, form); 1222 agent_->WillSubmitForm(frame, form);
1219 } 1223 }
1220 1224
1221 } // namespace autofill 1225 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/content/common/autofill_messages.h ('k') | components/autofill/core/browser/popup_item_ids.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698