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

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

Issue 120343003: Autofill popup should not be presented when autocomplete='off', even if (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added browser test Created 6 years, 12 months 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 | Annotate | Revision Log
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/core/common/form_field_data.h" 15 #include "components/autofill/core/common/form_field_data.h"
16 #include "components/autofill/core/common/password_autofill_util.h" 16 #include "components/autofill/core/common/password_autofill_util.h"
17 #include "components/autofill/core/common/password_form.h" 17 #include "components/autofill/core/common/password_form.h"
18 #include "components/autofill/core/common/password_form_fill_data.h" 18 #include "components/autofill/core/common/password_form_fill_data.h"
19 #include "content/public/renderer/render_view.h" 19 #include "content/public/renderer/render_view.h"
20 #include "third_party/WebKit/public/platform/WebVector.h" 20 #include "third_party/WebKit/public/platform/WebVector.h"
21 #include "third_party/WebKit/public/web/WebAutofillClient.h" 21 #include "third_party/WebKit/public/web/WebAutofillClient.h"
22 #include "third_party/WebKit/public/web/WebDocument.h" 22 #include "third_party/WebKit/public/web/WebDocument.h"
23 #include "third_party/WebKit/public/web/WebElement.h" 23 #include "third_party/WebKit/public/web/WebElement.h"
24 #include "third_party/WebKit/public/web/WebFormElement.h" 24 #include "third_party/WebKit/public/web/WebFormElement.h"
25 #include "third_party/WebKit/public/web/WebFrame.h" 25 #include "third_party/WebKit/public/web/WebFrame.h"
26 #include "third_party/WebKit/public/web/WebInputEvent.h" 26 #include "third_party/WebKit/public/web/WebInputEvent.h"
27 #include "third_party/WebKit/public/web/WebNode.h" 27 #include "third_party/WebKit/public/web/WebNode.h"
28 #include "third_party/WebKit/public/web/WebNodeList.h" 28 #include "third_party/WebKit/public/web/WebNodeList.h"
29 #include "third_party/WebKit/public/web/WebPasswordFormData.h"
29 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" 30 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
30 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" 31 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
31 #include "third_party/WebKit/public/web/WebView.h" 32 #include "third_party/WebKit/public/web/WebView.h"
32 #include "ui/events/keycodes/keyboard_codes.h" 33 #include "ui/events/keycodes/keyboard_codes.h"
33 34
34 namespace autofill { 35 namespace autofill {
35 namespace { 36 namespace {
36 37
37 // The size above which we stop triggering autocomplete. 38 // The size above which we stop triggering autocomplete.
38 static const size_t kMaximumTextSizeForAutocomplete = 1000; 39 static const size_t kMaximumTextSizeForAutocomplete = 1000;
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 314
314 bool PasswordAutofillAgent::DidClearAutofillSelection( 315 bool PasswordAutofillAgent::DidClearAutofillSelection(
315 const blink::WebNode& node) { 316 const blink::WebNode& node) {
316 blink::WebInputElement input; 317 blink::WebInputElement input;
317 PasswordInfo password; 318 PasswordInfo password;
318 return FindLoginInfo(node, &input, &password); 319 return FindLoginInfo(node, &input, &password);
319 } 320 }
320 321
321 bool PasswordAutofillAgent::ShowSuggestions( 322 bool PasswordAutofillAgent::ShowSuggestions(
322 const blink::WebInputElement& element) { 323 const blink::WebInputElement& element) {
324 blink::WebPasswordFormData form_data(element.form());
Garrett Casto 2013/12/27 22:09:48 You also need to verify that element.form() is val
jww 2013/12/27 23:04:39 I believe this is irrelevant given my changes per
325 scoped_ptr<PasswordForm> password_form = CreatePasswordForm(element.form());
326 if (!ShouldIgnoreAutocompleteOffForPasswordFields() && password_form.get() &&
327 (!element.autoComplete() || !password_form->password_autocomplete_set ||
328 !form_data.passwordShouldAutocomplete))
Ilya Sherman 2013/12/27 21:43:22 Why do you need both "!password_form->password_aut
Garrett Casto 2013/12/27 22:09:48 passwordShouldAutocomplete implies password_autoco
jww 2013/12/27 23:04:39 Done.
329 return true;
330
323 LoginToPasswordInfoMap::const_iterator iter = 331 LoginToPasswordInfoMap::const_iterator iter =
324 login_to_password_info_.find(element); 332 login_to_password_info_.find(element);
325 if (iter == login_to_password_info_.end()) 333 if (iter == login_to_password_info_.end())
326 return false; 334 return false;
327 335
328 return ShowSuggestionPopup(iter->second.fill_data, element); 336 return ShowSuggestionPopup(iter->second.fill_data, element);
329 } 337 }
330 338
331 bool PasswordAutofillAgent::OriginCanAccessPasswordManager( 339 bool PasswordAutofillAgent::OriginCanAccessPasswordManager(
332 const blink::WebSecurityOrigin& origin) { 340 const blink::WebSecurityOrigin& origin) {
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 } 848 }
841 849
842 PasswordAutofillAgent::AutofillWebUserGestureHandler:: 850 PasswordAutofillAgent::AutofillWebUserGestureHandler::
843 AutofillWebUserGestureHandler(PasswordAutofillAgent* agent) 851 AutofillWebUserGestureHandler(PasswordAutofillAgent* agent)
844 : agent_(agent) {} 852 : agent_(agent) {}
845 853
846 PasswordAutofillAgent::AutofillWebUserGestureHandler:: 854 PasswordAutofillAgent::AutofillWebUserGestureHandler::
847 ~AutofillWebUserGestureHandler() {} 855 ~AutofillWebUserGestureHandler() {}
848 856
849 } // namespace autofill 857 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698