| OLD | NEW |
| 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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 226 |
| 227 PasswordAutofillAgent::PasswordAutofillAgent(content::RenderView* render_view) | 227 PasswordAutofillAgent::PasswordAutofillAgent(content::RenderView* render_view) |
| 228 : content::RenderViewObserver(render_view), | 228 : content::RenderViewObserver(render_view), |
| 229 usernames_usage_(NOTHING_TO_AUTOFILL), | 229 usernames_usage_(NOTHING_TO_AUTOFILL), |
| 230 web_view_(render_view->GetWebView()), | 230 web_view_(render_view->GetWebView()), |
| 231 logging_state_active_(false), | 231 logging_state_active_(false), |
| 232 was_username_autofilled_(false), | 232 was_username_autofilled_(false), |
| 233 was_password_autofilled_(false), | 233 was_password_autofilled_(false), |
| 234 username_selection_start_(0), | 234 username_selection_start_(0), |
| 235 weak_ptr_factory_(this) { | 235 weak_ptr_factory_(this) { |
| 236 Send(new AutofillHostMsg_PasswordAutofillAgentConstructed(routing_id())); |
| 236 } | 237 } |
| 237 | 238 |
| 238 PasswordAutofillAgent::~PasswordAutofillAgent() { | 239 PasswordAutofillAgent::~PasswordAutofillAgent() { |
| 239 } | 240 } |
| 240 | 241 |
| 241 PasswordAutofillAgent::PasswordValueGatekeeper::PasswordValueGatekeeper() | 242 PasswordAutofillAgent::PasswordValueGatekeeper::PasswordValueGatekeeper() |
| 242 : was_user_gesture_seen_(false) { | 243 : was_user_gesture_seen_(false) { |
| 243 } | 244 } |
| 244 | 245 |
| 245 PasswordAutofillAgent::PasswordValueGatekeeper::~PasswordValueGatekeeper() { | 246 PasswordAutofillAgent::PasswordValueGatekeeper::~PasswordValueGatekeeper() { |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 password_forms)); | 538 password_forms)); |
| 538 } else { | 539 } else { |
| 539 Send(new AutofillHostMsg_PasswordFormsParsed(routing_id(), password_forms)); | 540 Send(new AutofillHostMsg_PasswordFormsParsed(routing_id(), password_forms)); |
| 540 } | 541 } |
| 541 } | 542 } |
| 542 | 543 |
| 543 bool PasswordAutofillAgent::OnMessageReceived(const IPC::Message& message) { | 544 bool PasswordAutofillAgent::OnMessageReceived(const IPC::Message& message) { |
| 544 bool handled = true; | 545 bool handled = true; |
| 545 IPC_BEGIN_MESSAGE_MAP(PasswordAutofillAgent, message) | 546 IPC_BEGIN_MESSAGE_MAP(PasswordAutofillAgent, message) |
| 546 IPC_MESSAGE_HANDLER(AutofillMsg_FillPasswordForm, OnFillPasswordForm) | 547 IPC_MESSAGE_HANDLER(AutofillMsg_FillPasswordForm, OnFillPasswordForm) |
| 547 IPC_MESSAGE_HANDLER(AutofillMsg_ChangeLoggingState, OnChangeLoggingState) | 548 IPC_MESSAGE_HANDLER(AutofillMsg_SetLoggingState, OnSetLoggingState) |
| 548 IPC_MESSAGE_UNHANDLED(handled = false) | 549 IPC_MESSAGE_UNHANDLED(handled = false) |
| 549 IPC_END_MESSAGE_MAP() | 550 IPC_END_MESSAGE_MAP() |
| 550 return handled; | 551 return handled; |
| 551 } | 552 } |
| 552 | 553 |
| 553 void PasswordAutofillAgent::DidStartLoading() { | 554 void PasswordAutofillAgent::DidStartLoading() { |
| 554 if (usernames_usage_ != NOTHING_TO_AUTOFILL) { | 555 if (usernames_usage_ != NOTHING_TO_AUTOFILL) { |
| 555 UMA_HISTOGRAM_ENUMERATION("PasswordManager.OtherPossibleUsernamesUsage", | 556 UMA_HISTOGRAM_ENUMERATION("PasswordManager.OtherPossibleUsernamesUsage", |
| 556 usernames_usage_, | 557 usernames_usage_, |
| 557 OTHER_POSSIBLE_USERNAMES_MAX); | 558 OTHER_POSSIBLE_USERNAMES_MAX); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 | 786 |
| 786 FormData form; | 787 FormData form; |
| 787 FormFieldData field; | 788 FormFieldData field; |
| 788 FindFormAndFieldForFormControlElement( | 789 FindFormAndFieldForFormControlElement( |
| 789 username_element, &form, &field, REQUIRE_NONE); | 790 username_element, &form, &field, REQUIRE_NONE); |
| 790 Send(new AutofillHostMsg_AddPasswordFormMapping( | 791 Send(new AutofillHostMsg_AddPasswordFormMapping( |
| 791 routing_id(), field, form_data)); | 792 routing_id(), field, form_data)); |
| 792 } | 793 } |
| 793 } | 794 } |
| 794 | 795 |
| 795 void PasswordAutofillAgent::OnChangeLoggingState(bool active) { | 796 void PasswordAutofillAgent::OnSetLoggingState(bool active) { |
| 796 logging_state_active_ = active; | 797 logging_state_active_ = active; |
| 797 } | 798 } |
| 798 | 799 |
| 799 //////////////////////////////////////////////////////////////////////////////// | 800 //////////////////////////////////////////////////////////////////////////////// |
| 800 // PasswordAutofillAgent, private: | 801 // PasswordAutofillAgent, private: |
| 801 | 802 |
| 802 void PasswordAutofillAgent::GetSuggestions( | 803 void PasswordAutofillAgent::GetSuggestions( |
| 803 const PasswordFormFillData& fill_data, | 804 const PasswordFormFillData& fill_data, |
| 804 const base::string16& input, | 805 const base::string16& input, |
| 805 std::vector<base::string16>* suggestions, | 806 std::vector<base::string16>* suggestions, |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 username->setSelectionRange(username_selection_start_, | 1067 username->setSelectionRange(username_selection_start_, |
| 1067 username->value().length()); | 1068 username->value().length()); |
| 1068 } | 1069 } |
| 1069 if (!password->suggestedValue().isEmpty()) { | 1070 if (!password->suggestedValue().isEmpty()) { |
| 1070 password->setSuggestedValue(blink::WebString()); | 1071 password->setSuggestedValue(blink::WebString()); |
| 1071 password->setAutofilled(was_password_autofilled_); | 1072 password->setAutofilled(was_password_autofilled_); |
| 1072 } | 1073 } |
| 1073 } | 1074 } |
| 1074 | 1075 |
| 1075 } // namespace autofill | 1076 } // namespace autofill |
| OLD | NEW |