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

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

Issue 145393004: Update components/autofill code to use WebElementCollection instead of WebNodeCollection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 10 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
« no previous file with comments | « no previous file | components/autofill/content/renderer/form_autofill_util.cc » ('j') | 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/autofill_agent.h" 5 #include "components/autofill/content/renderer/autofill_agent.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 16 matching lines...) Expand all
27 #include "content/public/common/content_switches.h" 27 #include "content/public/common/content_switches.h"
28 #include "content/public/common/ssl_status.h" 28 #include "content/public/common/ssl_status.h"
29 #include "content/public/common/url_constants.h" 29 #include "content/public/common/url_constants.h"
30 #include "content/public/renderer/render_view.h" 30 #include "content/public/renderer/render_view.h"
31 #include "grit/component_strings.h" 31 #include "grit/component_strings.h"
32 #include "net/cert/cert_status_flags.h" 32 #include "net/cert/cert_status_flags.h"
33 #include "third_party/WebKit/public/platform/WebRect.h" 33 #include "third_party/WebKit/public/platform/WebRect.h"
34 #include "third_party/WebKit/public/platform/WebURLRequest.h" 34 #include "third_party/WebKit/public/platform/WebURLRequest.h"
35 #include "third_party/WebKit/public/web/WebDataSource.h" 35 #include "third_party/WebKit/public/web/WebDataSource.h"
36 #include "third_party/WebKit/public/web/WebDocument.h" 36 #include "third_party/WebKit/public/web/WebDocument.h"
37 #include "third_party/WebKit/public/web/WebElementCollection.h"
37 #include "third_party/WebKit/public/web/WebFormControlElement.h" 38 #include "third_party/WebKit/public/web/WebFormControlElement.h"
38 #include "third_party/WebKit/public/web/WebFormElement.h" 39 #include "third_party/WebKit/public/web/WebFormElement.h"
39 #include "third_party/WebKit/public/web/WebFrame.h" 40 #include "third_party/WebKit/public/web/WebFrame.h"
40 #include "third_party/WebKit/public/web/WebInputEvent.h" 41 #include "third_party/WebKit/public/web/WebInputEvent.h"
41 #include "third_party/WebKit/public/web/WebNode.h" 42 #include "third_party/WebKit/public/web/WebNode.h"
42 #include "third_party/WebKit/public/web/WebNodeCollection.h"
43 #include "third_party/WebKit/public/web/WebOptionElement.h" 43 #include "third_party/WebKit/public/web/WebOptionElement.h"
44 #include "third_party/WebKit/public/web/WebView.h" 44 #include "third_party/WebKit/public/web/WebView.h"
45 #include "ui/base/l10n/l10n_util.h" 45 #include "ui/base/l10n/l10n_util.h"
46 #include "ui/events/keycodes/keyboard_codes.h" 46 #include "ui/events/keycodes/keyboard_codes.h"
47 47
48 using blink::WebAutofillClient; 48 using blink::WebAutofillClient;
49 using blink::WebFormControlElement; 49 using blink::WebFormControlElement;
50 using blink::WebFormElement; 50 using blink::WebFormElement;
51 using blink::WebFrame; 51 using blink::WebFrame;
52 using blink::WebInputElement; 52 using blink::WebInputElement;
53 using blink::WebKeyboardEvent; 53 using blink::WebKeyboardEvent;
54 using blink::WebNode; 54 using blink::WebNode;
55 using blink::WebNodeCollection; 55 using blink::WebElementCollection;
56 using blink::WebOptionElement; 56 using blink::WebOptionElement;
57 using blink::WebString; 57 using blink::WebString;
58 58
59 namespace autofill { 59 namespace autofill {
60 60
61 namespace { 61 namespace {
62 62
63 // Gets all the data list values (with corresponding label) for the given 63 // Gets all the data list values (with corresponding label) for the given
64 // element. 64 // element.
65 void GetDataListSuggestions(const blink::WebInputElement& element, 65 void GetDataListSuggestions(const blink::WebInputElement& element,
66 bool ignore_current_value, 66 bool ignore_current_value,
67 std::vector<base::string16>* values, 67 std::vector<base::string16>* values,
68 std::vector<base::string16>* labels) { 68 std::vector<base::string16>* labels) {
69 WebNodeCollection options = element.dataListOptions(); 69 WebElementCollection options = element.dataListOptions();
70 if (options.isNull()) 70 if (options.isNull())
71 return; 71 return;
72 72
73 base::string16 prefix; 73 base::string16 prefix;
74 if (!ignore_current_value) { 74 if (!ignore_current_value) {
75 prefix = element.editingValue(); 75 prefix = element.editingValue();
76 if (element.isMultiple() && 76 if (element.isMultiple() &&
77 element.formControlType() == WebString::fromUTF8("email")) { 77 element.formControlType() == WebString::fromUTF8("email")) {
78 std::vector<base::string16> parts; 78 std::vector<base::string16> parts;
79 base::SplitStringDontTrim(prefix, ',', &parts); 79 base::SplitStringDontTrim(prefix, ',', &parts);
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 // Only monitors dynamic forms created in the top frame. Dynamic forms 630 // Only monitors dynamic forms created in the top frame. Dynamic forms
631 // inserted in iframes are not captured yet. 631 // inserted in iframes are not captured yet.
632 if (!frame->parent()) { 632 if (!frame->parent()) {
633 password_autofill_agent_->OnDynamicFormsSeen(frame); 633 password_autofill_agent_->OnDynamicFormsSeen(frame);
634 return; 634 return;
635 } 635 }
636 } 636 }
637 } 637 }
638 638
639 } // namespace autofill 639 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | components/autofill/content/renderer/form_autofill_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698