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

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

Issue 232263002: Console logging for rAc developer errors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: improvements Created 6 years, 8 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/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 14 matching lines...) Expand all
25 #include "components/autofill/core/common/password_form.h" 25 #include "components/autofill/core/common/password_form.h"
26 #include "components/autofill/core/common/web_element_descriptor.h" 26 #include "components/autofill/core/common/web_element_descriptor.h"
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/WebConsoleMessage.h"
35 #include "third_party/WebKit/public/web/WebDataSource.h" 36 #include "third_party/WebKit/public/web/WebDataSource.h"
36 #include "third_party/WebKit/public/web/WebDocument.h" 37 #include "third_party/WebKit/public/web/WebDocument.h"
37 #include "third_party/WebKit/public/web/WebElementCollection.h" 38 #include "third_party/WebKit/public/web/WebElementCollection.h"
38 #include "third_party/WebKit/public/web/WebFormControlElement.h" 39 #include "third_party/WebKit/public/web/WebFormControlElement.h"
39 #include "third_party/WebKit/public/web/WebFormElement.h" 40 #include "third_party/WebKit/public/web/WebFormElement.h"
40 #include "third_party/WebKit/public/web/WebFrame.h" 41 #include "third_party/WebKit/public/web/WebFrame.h"
41 #include "third_party/WebKit/public/web/WebInputEvent.h" 42 #include "third_party/WebKit/public/web/WebInputEvent.h"
42 #include "third_party/WebKit/public/web/WebNode.h" 43 #include "third_party/WebKit/public/web/WebNode.h"
43 #include "third_party/WebKit/public/web/WebOptionElement.h" 44 #include "third_party/WebKit/public/web/WebOptionElement.h"
44 #include "third_party/WebKit/public/web/WebTextAreaElement.h" 45 #include "third_party/WebKit/public/web/WebTextAreaElement.h"
45 #include "third_party/WebKit/public/web/WebView.h" 46 #include "third_party/WebKit/public/web/WebView.h"
46 #include "ui/base/l10n/l10n_util.h" 47 #include "ui/base/l10n/l10n_util.h"
47 #include "ui/events/keycodes/keyboard_codes.h" 48 #include "ui/events/keycodes/keyboard_codes.h"
48 49
49 using blink::WebAutofillClient; 50 using blink::WebAutofillClient;
51 using blink::WebConsoleMessage;
50 using blink::WebElement; 52 using blink::WebElement;
51 using blink::WebElementCollection; 53 using blink::WebElementCollection;
52 using blink::WebFormControlElement; 54 using blink::WebFormControlElement;
53 using blink::WebFormElement; 55 using blink::WebFormElement;
54 using blink::WebFrame; 56 using blink::WebFrame;
55 using blink::WebInputElement; 57 using blink::WebInputElement;
56 using blink::WebKeyboardEvent; 58 using blink::WebKeyboardEvent;
57 using blink::WebLocalFrame; 59 using blink::WebLocalFrame;
58 using blink::WebNode; 60 using blink::WebNode;
59 using blink::WebOptionElement; 61 using blink::WebOptionElement;
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 // skipped it handling because it believed it would be handled here. If it 499 // skipped it handling because it believed it would be handled here. If it
498 // isn't handled here then the browser logic needs to be updated. 500 // isn't handled here then the browser logic needs to be updated.
499 bool handled = password_autofill_agent_->DidAcceptAutofillSuggestion( 501 bool handled = password_autofill_agent_->DidAcceptAutofillSuggestion(
500 element_, 502 element_,
501 username); 503 username);
502 DCHECK(handled); 504 DCHECK(handled);
503 } 505 }
504 506
505 void AutofillAgent::OnRequestAutocompleteResult( 507 void AutofillAgent::OnRequestAutocompleteResult(
506 WebFormElement::AutocompleteResult result, 508 WebFormElement::AutocompleteResult result,
509 const base::string16& message,
507 const FormData& form_data) { 510 const FormData& form_data) {
508 if (in_flight_request_form_.isNull()) 511 if (in_flight_request_form_.isNull())
509 return; 512 return;
510 513
511 if (result == WebFormElement::AutocompleteResultSuccess) { 514 if (result == WebFormElement::AutocompleteResultSuccess) {
512 FillFormIncludingNonFocusableElements(form_data, in_flight_request_form_); 515 FillFormIncludingNonFocusableElements(form_data, in_flight_request_form_);
513 if (!in_flight_request_form_.checkValidityWithoutDispatchingEvents()) 516 if (!in_flight_request_form_.checkValidityWithoutDispatchingEvents())
514 result = WebFormElement::AutocompleteResultErrorInvalid; 517 result = WebFormElement::AutocompleteResultErrorInvalid;
515 } 518 }
516 519
517 in_flight_request_form_.finishRequestAutocomplete(result); 520 in_flight_request_form_.finishRequestAutocomplete(result);
521
522 if (!message.empty()) {
523 const base::string16 prefix(base::ASCIIToUTF16("requestAutocomplete: "));
524 WebConsoleMessage console_message = WebConsoleMessage(
525 WebConsoleMessage::LevelLog, WebString(prefix + message));
526 in_flight_request_form_.document().frame()->addMessageToConsole(
Dan Beam 2014/04/10 01:14:51 i think there might be some mild chance that |in_f
527 console_message);
528 }
529
518 in_flight_request_form_.reset(); 530 in_flight_request_form_.reset();
519 } 531 }
520 532
521 void AutofillAgent::ShowSuggestions(const WebFormControlElement& element, 533 void AutofillAgent::ShowSuggestions(const WebFormControlElement& element,
522 bool autofill_on_empty_values, 534 bool autofill_on_empty_values,
523 bool requires_caret_at_end, 535 bool requires_caret_at_end,
524 bool display_warning_if_disabled, 536 bool display_warning_if_disabled,
525 bool datalist_only) { 537 bool datalist_only) {
526 if (!element.isEnabled() || element.isReadOnly()) 538 if (!element.isEnabled() || element.isReadOnly())
527 return; 539 return;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 // Only monitors dynamic forms created in the top frame. Dynamic forms 681 // Only monitors dynamic forms created in the top frame. Dynamic forms
670 // inserted in iframes are not captured yet. 682 // inserted in iframes are not captured yet.
671 if (frame && !frame->parent()) { 683 if (frame && !frame->parent()) {
672 password_autofill_agent_->OnDynamicFormsSeen(frame); 684 password_autofill_agent_->OnDynamicFormsSeen(frame);
673 return; 685 return;
674 } 686 }
675 } 687 }
676 } 688 }
677 689
678 } // namespace autofill 690 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698