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

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

Issue 6301005: Fix autocomplete for Gmail subject lines. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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/autofill_helper.h" 5 #include "chrome/renderer/autofill_helper.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/common/chrome_constants.h" 9 #include "chrome/common/chrome_constants.h"
10 #include "chrome/renderer/form_manager.h" 10 #include "chrome/renderer/form_manager.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 263
264 void AutoFillHelper::QueryAutoFillSuggestions( 264 void AutoFillHelper::QueryAutoFillSuggestions(
265 const WebNode& node, bool display_warning_if_disabled) { 265 const WebNode& node, bool display_warning_if_disabled) {
266 static int query_counter = 0; 266 static int query_counter = 0;
267 autofill_query_id_ = query_counter++; 267 autofill_query_id_ = query_counter++;
268 autofill_query_node_ = node; 268 autofill_query_node_ = node;
269 display_warning_if_disabled_ = display_warning_if_disabled; 269 display_warning_if_disabled_ = display_warning_if_disabled;
270 270
271 webkit_glue::FormData form; 271 webkit_glue::FormData form;
272 webkit_glue::FormField field; 272 webkit_glue::FormField field;
273 if (!FindFormAndFieldForNode(node, &form, &field)) 273 if (!FindFormAndFieldForNode(node, &form, &field)) {
274 return; 274 // If we didn't find the cached form, at least let autocomplete have a shot
275 // at providing suggestions.
276 FormManager::WebFormControlElementToFormField(
277 node.toConst<WebFormControlElement>(), FormManager::EXTRACT_VALUE,
278 &field);
279
280 // Really, though, this case should not be reachable. Log the source website
281 // to help debug why we do sometimes reach this case.
282 GURL url = node.document().frame()->url();
dhollowa 2011/01/14 16:13:28 As tempting as this logging may be, there are priv
283 LOG(WARNING) << "Failed to find cached form at "
284 << url.GetOrigin().spec()
285 << ". Please add this URL to http://crbug.com/69611.";
286 }
275 287
276 render_view_->Send(new ViewHostMsg_QueryFormFieldAutoFill( 288 render_view_->Send(new ViewHostMsg_QueryFormFieldAutoFill(
277 render_view_->routing_id(), autofill_query_id_, form, field)); 289 render_view_->routing_id(), autofill_query_id_, form, field));
278 } 290 }
279 291
280 void AutoFillHelper::FillAutoFillFormData(const WebNode& node, 292 void AutoFillHelper::FillAutoFillFormData(const WebNode& node,
281 int unique_id, 293 int unique_id,
282 AutoFillAction action) { 294 AutoFillAction action) {
283 static int query_counter = 0; 295 static int query_counter = 0;
284 autofill_query_id_ = query_counter++; 296 autofill_query_id_ = query_counter++;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 field); 344 field);
333 345
334 // WebFormControlElementToFormField does not scrape the DOM for the field 346 // WebFormControlElementToFormField does not scrape the DOM for the field
335 // label, so find the label here. 347 // label, so find the label here.
336 // TODO(jhawkins): Add form and field identities so we can use the cached form 348 // TODO(jhawkins): Add form and field identities so we can use the cached form
337 // data in FormManager. 349 // data in FormManager.
338 field->set_label(FormManager::LabelForElement(element)); 350 field->set_label(FormManager::LabelForElement(element));
339 351
340 return true; 352 return true;
341 } 353 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698