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

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

Issue 1516723003: [Element / Autofill] Add boundsInViewportFloat() to fix <input> popup misalignment. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refator to use boundsInViewportFloat() eventually, but keep boundsInViewportInt(). Created 5 years 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/password_autofill_agent.h" 5 #include "components/autofill/content/renderer/password_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/i18n/case_conversion.h" 9 #include "base/i18n/case_conversion.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
13 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "components/autofill/content/common/autofill_messages.h" 15 #include "components/autofill/content/common/autofill_messages.h"
16 #include "components/autofill/content/renderer/form_autofill_util.h" 16 #include "components/autofill/content/renderer/form_autofill_util.h"
17 #include "components/autofill/content/renderer/password_form_conversion_utils.h" 17 #include "components/autofill/content/renderer/password_form_conversion_utils.h"
18 #include "components/autofill/content/renderer/renderer_save_password_progress_l ogger.h" 18 #include "components/autofill/content/renderer/renderer_save_password_progress_l ogger.h"
19 #include "components/autofill/core/common/autofill_constants.h" 19 #include "components/autofill/core/common/autofill_constants.h"
20 #include "components/autofill/core/common/autofill_switches.h" 20 #include "components/autofill/core/common/autofill_switches.h"
21 #include "components/autofill/core/common/autofill_util.h" 21 #include "components/autofill/core/common/autofill_util.h"
22 #include "components/autofill/core/common/form_field_data.h" 22 #include "components/autofill/core/common/form_field_data.h"
23 #include "components/autofill/core/common/password_form.h" 23 #include "components/autofill/core/common/password_form.h"
24 #include "components/autofill/core/common/password_form_fill_data.h" 24 #include "components/autofill/core/common/password_form_fill_data.h"
25 #include "content/public/renderer/document_state.h" 25 #include "content/public/renderer/document_state.h"
26 #include "content/public/renderer/navigation_state.h" 26 #include "content/public/renderer/navigation_state.h"
27 #include "content/public/renderer/render_frame.h" 27 #include "content/public/renderer/render_frame.h"
28 #include "content/public/renderer/render_view.h" 28 #include "content/public/renderer/render_view.h"
29 #include "third_party/WebKit/public/platform/WebFloatRect.h"
29 #include "third_party/WebKit/public/platform/WebVector.h" 30 #include "third_party/WebKit/public/platform/WebVector.h"
30 #include "third_party/WebKit/public/web/WebAutofillClient.h" 31 #include "third_party/WebKit/public/web/WebAutofillClient.h"
31 #include "third_party/WebKit/public/web/WebDocument.h" 32 #include "third_party/WebKit/public/web/WebDocument.h"
32 #include "third_party/WebKit/public/web/WebElement.h" 33 #include "third_party/WebKit/public/web/WebElement.h"
33 #include "third_party/WebKit/public/web/WebFormElement.h" 34 #include "third_party/WebKit/public/web/WebFormElement.h"
34 #include "third_party/WebKit/public/web/WebInputEvent.h" 35 #include "third_party/WebKit/public/web/WebInputEvent.h"
35 #include "third_party/WebKit/public/web/WebLocalFrame.h" 36 #include "third_party/WebKit/public/web/WebLocalFrame.h"
36 #include "third_party/WebKit/public/web/WebNode.h" 37 #include "third_party/WebKit/public/web/WebNode.h"
37 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" 38 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
38 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" 39 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 1432
1432 int options = 0; 1433 int options = 0;
1433 if (show_all) 1434 if (show_all)
1434 options |= SHOW_ALL; 1435 options |= SHOW_ALL;
1435 if (show_on_password_field) 1436 if (show_on_password_field)
1436 options |= IS_PASSWORD_FIELD; 1437 options |= IS_PASSWORD_FIELD;
1437 base::string16 username_string( 1438 base::string16 username_string(
1438 username.isNull() ? base::string16() 1439 username.isNull() ? base::string16()
1439 : static_cast<base::string16>(user_input.value())); 1440 : static_cast<base::string16>(user_input.value()));
1440 1441
1441 blink::WebRect bounding_box_in_window = selected_element.boundsInViewport(); 1442 blink::WebFloatRect bounding_box_in_window;
1442 render_frame()->GetRenderView()->convertViewportToWindow( 1443 render_frame()->GetRenderView()->getElementBoundingBoxWindow(
1443 &bounding_box_in_window); 1444 &selected_element, &bounding_box_in_window);
1444
1445 Send(new AutofillHostMsg_ShowPasswordSuggestions( 1445 Send(new AutofillHostMsg_ShowPasswordSuggestions(
1446 routing_id(), key_it->second, field.text_direction, username_string, 1446 routing_id(), key_it->second, field.text_direction, username_string,
1447 options, gfx::RectF(bounding_box_in_window))); 1447 options, gfx::RectF(bounding_box_in_window)));
1448 username_query_prefix_ = username_string; 1448 username_query_prefix_ = username_string;
1449 return CanShowSuggestion(fill_data, username_string, show_all); 1449 return CanShowSuggestion(fill_data, username_string, show_all);
1450 } 1450 }
1451 1451
1452 void PasswordAutofillAgent::FrameClosing() { 1452 void PasswordAutofillAgent::FrameClosing() {
1453 for (auto const& iter : web_input_to_password_info_) { 1453 for (auto const& iter : web_input_to_password_info_) {
1454 web_element_to_password_info_key_.erase(iter.first); 1454 web_element_to_password_info_key_.erase(iter.first);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 } 1502 }
1503 1503
1504 bool PasswordAutofillAgent::ProvisionallySavedPasswordIsValid() { 1504 bool PasswordAutofillAgent::ProvisionallySavedPasswordIsValid() {
1505 return provisionally_saved_form_ && 1505 return provisionally_saved_form_ &&
1506 !provisionally_saved_form_->username_value.empty() && 1506 !provisionally_saved_form_->username_value.empty() &&
1507 !(provisionally_saved_form_->password_value.empty() && 1507 !(provisionally_saved_form_->password_value.empty() &&
1508 provisionally_saved_form_->new_password_value.empty()); 1508 provisionally_saved_form_->new_password_value.empty());
1509 } 1509 }
1510 1510
1511 } // namespace autofill 1511 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698