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

Side by Side Diff: chrome/renderer/autofill/autofill_agent.cc

Issue 12188020: Adding the page and DPI scale adjustment for Autofill Popups. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/autofill_agent.h" 5 #include "chrome/renderer/autofill/autofill_agent.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/string_split.h" 9 #include "base/string_split.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 namespace autofill { 128 namespace autofill {
129 129
130 AutofillAgent::AutofillAgent( 130 AutofillAgent::AutofillAgent(
131 content::RenderView* render_view, 131 content::RenderView* render_view,
132 PasswordAutofillManager* password_autofill_manager) 132 PasswordAutofillManager* password_autofill_manager)
133 : content::RenderViewObserver(render_view), 133 : content::RenderViewObserver(render_view),
134 password_autofill_manager_(password_autofill_manager), 134 password_autofill_manager_(password_autofill_manager),
135 autofill_query_id_(0), 135 autofill_query_id_(0),
136 autofill_action_(AUTOFILL_NONE), 136 autofill_action_(AUTOFILL_NONE),
137 topmost_frame_(NULL), 137 topmost_frame_(NULL),
138 web_view_(render_view->GetWebView()),
138 display_warning_if_disabled_(false), 139 display_warning_if_disabled_(false),
139 was_query_node_autofilled_(false), 140 was_query_node_autofilled_(false),
140 has_shown_autofill_popup_for_current_edit_(false), 141 has_shown_autofill_popup_for_current_edit_(false),
141 did_set_node_text_(false), 142 did_set_node_text_(false),
142 autocheckout_click_in_progress_(false), 143 autocheckout_click_in_progress_(false),
143 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { 144 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
144 render_view->GetWebView()->setAutofillClient(this); 145 render_view->GetWebView()->setAutofillClient(this);
145 } 146 }
146 147
147 AutofillAgent::~AutofillAgent() {} 148 AutofillAgent::~AutofillAgent() {}
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 FormData form; 760 FormData form;
760 FormFieldData field; 761 FormFieldData field;
761 if (!FindFormAndFieldForInputElement(element, &form, &field, requirements)) { 762 if (!FindFormAndFieldForInputElement(element, &form, &field, requirements)) {
762 // If we didn't find the cached form, at least let autocomplete have a shot 763 // If we didn't find the cached form, at least let autocomplete have a shot
763 // at providing suggestions. 764 // at providing suggestions.
764 WebFormControlElementToFormField(element, EXTRACT_VALUE, &field); 765 WebFormControlElementToFormField(element, EXTRACT_VALUE, &field);
765 } 766 }
766 767
767 gfx::Rect bounding_box(element_.boundsInViewportSpace()); 768 gfx::Rect bounding_box(element_.boundsInViewportSpace());
768 769
770 float scale = web_view_->pageScaleFactor();
771 gfx::RectF bounding_box_scaled(bounding_box.x() * scale,
772 bounding_box.y() * scale,
773 bounding_box.width() * scale,
774 bounding_box.height() * scale);
775
769 // Find the datalist values and send them to the browser process. 776 // Find the datalist values and send them to the browser process.
770 std::vector<string16> data_list_values; 777 std::vector<string16> data_list_values;
771 std::vector<string16> data_list_labels; 778 std::vector<string16> data_list_labels;
772 std::vector<string16> data_list_icons; 779 std::vector<string16> data_list_icons;
773 std::vector<int> data_list_unique_ids; 780 std::vector<int> data_list_unique_ids;
774 AppendDataListSuggestions(element_, 781 AppendDataListSuggestions(element_,
775 &data_list_values, 782 &data_list_values,
776 &data_list_labels, 783 &data_list_labels,
777 &data_list_icons, 784 &data_list_icons,
778 &data_list_unique_ids); 785 &data_list_unique_ids);
(...skipping 10 matching lines...) Expand all
789 data_list_unique_ids)); 796 data_list_unique_ids));
790 797
791 // Add SSL Status in the formdata to let browser process alert user 798 // Add SSL Status in the formdata to let browser process alert user
792 // appropriately using browser UI. 799 // appropriately using browser UI.
793 form.ssl_status = render_view()->GetSSLStatusOfFrame( 800 form.ssl_status = render_view()->GetSSLStatusOfFrame(
794 element.document().frame()); 801 element.document().frame());
795 Send(new AutofillHostMsg_QueryFormFieldAutofill(routing_id(), 802 Send(new AutofillHostMsg_QueryFormFieldAutofill(routing_id(),
796 autofill_query_id_, 803 autofill_query_id_,
797 form, 804 form,
798 field, 805 field,
799 bounding_box, 806 bounding_box_scaled,
800 display_warning_if_disabled)); 807 display_warning_if_disabled));
801 } 808 }
802 809
803 void AutofillAgent::FillAutofillFormData(const WebNode& node, 810 void AutofillAgent::FillAutofillFormData(const WebNode& node,
804 int unique_id, 811 int unique_id,
805 AutofillAction action) { 812 AutofillAction action) {
806 DCHECK_GT(unique_id, 0); 813 DCHECK_GT(unique_id, 0);
807 814
808 static int query_counter = 0; 815 static int query_counter = 0;
809 autofill_query_id_ = query_counter++; 816 autofill_query_id_ = query_counter++;
(...skipping 25 matching lines...) Expand all
835 web_view->hidePopups(); 842 web_view->hidePopups();
836 843
837 HideHostPopups(); 844 HideHostPopups();
838 } 845 }
839 846
840 void AutofillAgent::HideHostPopups() { 847 void AutofillAgent::HideHostPopups() {
841 Send(new AutofillHostMsg_HideAutofillPopup(routing_id())); 848 Send(new AutofillHostMsg_HideAutofillPopup(routing_id()));
842 } 849 }
843 850
844 } // namespace autofill 851 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698