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

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

Issue 1568073002: Reduce string copies in GURL creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
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/form_autofill_util.h" 5 #include "components/autofill/content/renderer/form_autofill_util.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "components/autofill/core/common/autofill_data_validation.h" 17 #include "components/autofill/core/common/autofill_data_validation.h"
18 #include "components/autofill/core/common/autofill_regexes.h" 18 #include "components/autofill/core/common/autofill_regexes.h"
19 #include "components/autofill/core/common/autofill_switches.h" 19 #include "components/autofill/core/common/autofill_switches.h"
20 #include "components/autofill/core/common/autofill_util.h" 20 #include "components/autofill/core/common/autofill_util.h"
21 #include "components/autofill/core/common/form_data.h" 21 #include "components/autofill/core/common/form_data.h"
22 #include "components/autofill/core/common/form_field_data.h" 22 #include "components/autofill/core/common/form_field_data.h"
23 #include "third_party/WebKit/public/platform/URLConversion.h"
23 #include "third_party/WebKit/public/platform/WebString.h" 24 #include "third_party/WebKit/public/platform/WebString.h"
24 #include "third_party/WebKit/public/platform/WebVector.h" 25 #include "third_party/WebKit/public/platform/WebVector.h"
25 #include "third_party/WebKit/public/web/WebDocument.h" 26 #include "third_party/WebKit/public/web/WebDocument.h"
26 #include "third_party/WebKit/public/web/WebElement.h" 27 #include "third_party/WebKit/public/web/WebElement.h"
27 #include "third_party/WebKit/public/web/WebElementCollection.h" 28 #include "third_party/WebKit/public/web/WebElementCollection.h"
28 #include "third_party/WebKit/public/web/WebFormControlElement.h" 29 #include "third_party/WebKit/public/web/WebFormControlElement.h"
29 #include "third_party/WebKit/public/web/WebFormElement.h" 30 #include "third_party/WebKit/public/web/WebFormElement.h"
30 #include "third_party/WebKit/public/web/WebInputElement.h" 31 #include "third_party/WebKit/public/web/WebInputElement.h"
31 #include "third_party/WebKit/public/web/WebLabelElement.h" 32 #include "third_party/WebKit/public/web/WebLabelElement.h"
32 #include "third_party/WebKit/public/web/WebLocalFrame.h" 33 #include "third_party/WebKit/public/web/WebLocalFrame.h"
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 if (!frame) 1413 if (!frame)
1413 return false; 1414 return false;
1414 1415
1415 form->name = GetFormIdentifier(form_element); 1416 form->name = GetFormIdentifier(form_element);
1416 form->origin = GetCanonicalOriginForDocument(frame->document()); 1417 form->origin = GetCanonicalOriginForDocument(frame->document());
1417 form->action = frame->document().completeURL(form_element.action()); 1418 form->action = frame->document().completeURL(form_element.action());
1418 1419
1419 // If the completed URL is not valid, just use the action we get from 1420 // If the completed URL is not valid, just use the action we get from
1420 // WebKit. 1421 // WebKit.
1421 if (!form->action.is_valid()) 1422 if (!form->action.is_valid())
1422 form->action = GURL(form_element.action()); 1423 form->action = GURL(blink::WebStringToGURL(form_element.action()));
1423 1424
1424 WebVector<WebFormControlElement> control_elements; 1425 WebVector<WebFormControlElement> control_elements;
1425 form_element.getFormControlElements(control_elements); 1426 form_element.getFormControlElements(control_elements);
1426 1427
1427 std::vector<blink::WebElement> dummy_fieldset; 1428 std::vector<blink::WebElement> dummy_fieldset;
1428 return FormOrFieldsetsToFormData(&form_element, &form_control_element, 1429 return FormOrFieldsetsToFormData(&form_element, &form_control_element,
1429 dummy_fieldset, control_elements, 1430 dummy_fieldset, control_elements,
1430 extract_mask, form, field); 1431 extract_mask, form, field);
1431 } 1432 }
1432 1433
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 // Zero selection start is for password manager, which can show usernames 1727 // Zero selection start is for password manager, which can show usernames
1727 // that do not begin with the user input value. 1728 // that do not begin with the user input value.
1728 selection_start = (offset == base::string16::npos) ? 0 : offset; 1729 selection_start = (offset == base::string16::npos) ? 0 : offset;
1729 } 1730 }
1730 1731
1731 input_element->setSelectionRange(selection_start, suggestion.length()); 1732 input_element->setSelectionRange(selection_start, suggestion.length());
1732 } 1733 }
1733 1734
1734 } // namespace form_util 1735 } // namespace form_util
1735 } // namespace autofill 1736 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/renderer/worker_content_settings_client_proxy.cc ('k') | components/html_viewer/blink_platform_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698