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

Side by Side Diff: chrome/renderer/render_view.cc

Issue 2808036: AutoFill fills only clicked field when form was filled prior. (Closed)
Patch Set: Adding comment. Created 10 years, 5 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
« no previous file with comments | « chrome/renderer/render_view.h ('k') | chrome/renderer/render_view_unittest.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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/renderer/render_view.h" 5 #include "chrome/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after
2104 DCHECK_NE(0U, suggestions_count_); 2104 DCHECK_NE(0U, suggestions_count_);
2105 2105
2106 if (index == suggestions_count_ - 1) { 2106 if (index == suggestions_count_ - 1) {
2107 // User selected 'AutoFill Options...'. 2107 // User selected 'AutoFill Options...'.
2108 Send(new ViewHostMsg_ShowAutoFillDialog(routing_id_)); 2108 Send(new ViewHostMsg_ShowAutoFillDialog(routing_id_));
2109 } else if (form_manager_.FormWithNodeIsAutoFilled(node) && 2109 } else if (form_manager_.FormWithNodeIsAutoFilled(node) &&
2110 index == suggestions_count_ - 2) { 2110 index == suggestions_count_ - 2) {
2111 // The form has been auto-filled, so give the user the chance to clear the 2111 // The form has been auto-filled, so give the user the chance to clear the
2112 // form. 2112 // form.
2113 form_manager_.ClearFormWithNode(node); 2113 form_manager_.ClearFormWithNode(node);
2114 } else if (form_manager_.FormWithNodeIsAutoFilled(node)) {
2115 // Fill a specific field value.
2116 // Cast away const'ness in this case where we're filling the element
2117 // directly.
2118 WebInputElement element = node.toConst<WebInputElement>();
2119 element.setValue(value);
2114 } else { 2120 } else {
2121 // Fill the values for the whole form.
2115 QueryAutoFillFormData(node, value, label, AUTOFILL_FILL); 2122 QueryAutoFillFormData(node, value, label, AUTOFILL_FILL);
2116 } 2123 }
2117 2124
2118 suggestions_count_ = 0; 2125 suggestions_count_ = 0;
2119 } 2126 }
2120 2127
2121 void RenderView::didSelectAutoFillSuggestion(const WebKit::WebNode& node, 2128 void RenderView::didSelectAutoFillSuggestion(const WebKit::WebNode& node,
2122 const WebKit::WebString& value, 2129 const WebKit::WebString& value,
2123 const WebKit::WebString& label) { 2130 const WebKit::WebString& label) {
2124 didClearAutoFillSelection(node); 2131 didClearAutoFillSelection(node);
(...skipping 3124 matching lines...) Expand 10 before | Expand all | Expand 10 after
5249 webkit_glue::FormData form; 5256 webkit_glue::FormData form;
5250 const WebInputElement element = node.toConst<WebInputElement>(); 5257 const WebInputElement element = node.toConst<WebInputElement>();
5251 if (!form_manager_.FindFormWithFormControlElement( 5258 if (!form_manager_.FindFormWithFormControlElement(
5252 element, FormManager::REQUIRE_NONE, &form)) 5259 element, FormManager::REQUIRE_NONE, &form))
5253 return; 5260 return;
5254 5261
5255 autofill_action_ = action; 5262 autofill_action_ = action;
5256 Send(new ViewHostMsg_FillAutoFillFormData( 5263 Send(new ViewHostMsg_FillAutoFillFormData(
5257 routing_id_, autofill_query_id_, form, value, label)); 5264 routing_id_, autofill_query_id_, form, value, label));
5258 } 5265 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.h ('k') | chrome/renderer/render_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698