summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorvabr@chromium.org <vabr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-26 02:10:02 +0000
committervabr@chromium.org <vabr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-26 02:10:02 +0000
commita9e390c49aa040569fbfb76f6fb3e601658338df (patch)
treed183fda64af6bea78c3730e09b85bbc2dcaec6df /components
parent0a4b869516c49ccefbeee75da76b478058108698 (diff)
downloadchromium_src-a9e390c49aa040569fbfb76f6fb3e601658338df.zip
chromium_src-a9e390c49aa040569fbfb76f6fb3e601658338df.tar.gz
chromium_src-a9e390c49aa040569fbfb76f6fb3e601658338df.tar.bz2
Fix style in PasswordManager and PasswordAutofillAgent .cc files
This CL contains only style-related clean-up. The purpose is to allow other CLs (like https://codereview.chromium.org/231283003/) make whole-file clang-format without inducing many unrelated changes. Putting Ilya in TBR, because of https://codereview.chromium.org/231283003/diff/200001/components/autofill/content/renderer/password_autofill_agent.cc#newcode280 TBR=isherman@chromium.org BUG=347927 Review URL: https://codereview.chromium.org/254573005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266318 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r--components/autofill/content/renderer/password_autofill_agent.cc77
-rw-r--r--components/password_manager/core/browser/password_manager.cc59
2 files changed, 71 insertions, 65 deletions
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc
index d1fa6a8..4f25414 100644
--- a/components/autofill/content/renderer/password_autofill_agent.cc
+++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -39,8 +39,7 @@ namespace {
static const size_t kMaximumTextSizeForAutocomplete = 1000;
// Maps element names to the actual elements to simplify form filling.
-typedef std::map<base::string16, blink::WebInputElement>
- FormInputElementMap;
+typedef std::map<base::string16, blink::WebInputElement> FormInputElementMap;
// Utility struct for form lookup and autofill. When we parse the DOM to look up
// a form, in addition to action and origin URL's we have to compare all
@@ -213,12 +212,15 @@ PasswordAutofillAgent::PasswordAutofillAgent(content::RenderView* render_view)
weak_ptr_factory_(this) {
}
-PasswordAutofillAgent::~PasswordAutofillAgent() {}
+PasswordAutofillAgent::~PasswordAutofillAgent() {
+}
PasswordAutofillAgent::PasswordValueGatekeeper::PasswordValueGatekeeper()
- : was_user_gesture_seen_(false) {}
+ : was_user_gesture_seen_(false) {
+}
-PasswordAutofillAgent::PasswordValueGatekeeper::~PasswordValueGatekeeper() {}
+PasswordAutofillAgent::PasswordValueGatekeeper::~PasswordValueGatekeeper() {
+}
void PasswordAutofillAgent::PasswordValueGatekeeper::RegisterElement(
blink::WebInputElement* element) {
@@ -258,8 +260,7 @@ bool PasswordAutofillAgent::TextFieldDidEndEditing(
if (iter == login_to_password_info_.end())
return false;
- const PasswordFormFillData& fill_data =
- iter->second.fill_data;
+ const PasswordFormFillData& fill_data = iter->second.fill_data;
// If wait_for_username is false, we should have filled when the text changed.
if (!fill_data.wait_for_username)
@@ -273,7 +274,9 @@ bool PasswordAutofillAgent::TextFieldDidEndEditing(
// Do not set selection when ending an editing session, otherwise it can
// mess with focus.
- FillUserNameAndPassword(&username, &password, fill_data,
+ FillUserNameAndPassword(&username,
+ &password,
+ fill_data,
true /* exact_username_match */,
false /* set_selection */);
return true;
@@ -462,7 +465,8 @@ bool PasswordAutofillAgent::OnMessageReceived(const IPC::Message& message) {
void PasswordAutofillAgent::DidStartLoading() {
if (usernames_usage_ != NOTHING_TO_AUTOFILL) {
UMA_HISTOGRAM_ENUMERATION("PasswordManager.OtherPossibleUsernamesUsage",
- usernames_usage_, OTHER_POSSIBLE_USERNAMES_MAX);
+ usernames_usage_,
+ OTHER_POSSIBLE_USERNAMES_MAX);
usernames_usage_ = NOTHING_TO_AUTOFILL;
}
}
@@ -563,8 +567,7 @@ void PasswordAutofillAgent::DidStartProvisionalLoad(
// If onsubmit has been called, try and save that form.
if (provisionally_saved_forms_[form_frame].get()) {
Send(new AutofillHostMsg_PasswordFormSubmitted(
- routing_id(),
- *provisionally_saved_forms_[form_frame]));
+ routing_id(), *provisionally_saved_forms_[form_frame]));
provisionally_saved_forms_.erase(form_frame);
} else {
// Loop through the forms on the page looking for one that has been
@@ -573,15 +576,14 @@ void PasswordAutofillAgent::DidStartProvisionalLoad(
frame->document().forms(forms);
for (size_t i = 0; i < forms.size(); ++i) {
- blink::WebFormElement form_element= forms[i];
+ blink::WebFormElement form_element = forms[i];
scoped_ptr<PasswordForm> password_form(
CreatePasswordForm(form_element));
- if (password_form.get() &&
- !password_form->username_value.empty() &&
+ if (password_form.get() && !password_form->username_value.empty() &&
!password_form->password_value.empty() &&
!PasswordValueIsDefault(*password_form, form_element)) {
- Send(new AutofillHostMsg_PasswordFormSubmitted(
- routing_id(), *password_form));
+ Send(new AutofillHostMsg_PasswordFormSubmitted(routing_id(),
+ *password_form));
}
}
}
@@ -642,9 +644,7 @@ void PasswordAutofillAgent::OnFillPasswordForm(
FindFormAndFieldForFormControlElement(
username_element, &form, &field, REQUIRE_NONE);
Send(new AutofillHostMsg_AddPasswordFormMapping(
- routing_id(),
- field,
- form_data));
+ routing_id(), field, form_data));
}
}
@@ -663,7 +663,8 @@ void PasswordAutofillAgent::GetSuggestions(
for (PasswordFormFillData::LoginCollection::const_iterator iter =
fill_data.additional_logins.begin();
- iter != fill_data.additional_logins.end(); ++iter) {
+ iter != fill_data.additional_logins.end();
+ ++iter) {
if (StartsWith(iter->first, input, false)) {
suggestions->push_back(iter->first);
realms->push_back(base::UTF8ToUTF16(iter->second.realm));
@@ -672,7 +673,8 @@ void PasswordAutofillAgent::GetSuggestions(
for (PasswordFormFillData::UsernamesCollection::const_iterator iter =
fill_data.other_possible_usernames.begin();
- iter != fill_data.other_possible_usernames.end(); ++iter) {
+ iter != fill_data.other_possible_usernames.end();
+ ++iter) {
for (size_t i = 0; i < iter->second.size(); ++i) {
if (StartsWith(iter->second[i], input, false)) {
usernames_usage_ = OTHER_POSSIBLE_USERNAME_SHOWN;
@@ -712,11 +714,8 @@ bool PasswordAutofillAgent::ShowSuggestionPopup(
bounding_box.y() * scale,
bounding_box.width() * scale,
bounding_box.height() * scale);
- Send(new AutofillHostMsg_ShowPasswordSuggestions(routing_id(),
- field,
- bounding_box_scaled,
- suggestions,
- realms));
+ Send(new AutofillHostMsg_ShowPasswordSuggestions(
+ routing_id(), field, bounding_box_scaled, suggestions, realms));
return !suggestions.empty();
}
@@ -747,7 +746,9 @@ void PasswordAutofillAgent::FillFormOnPasswordRecieved(
// Fill if we have an exact match for the username. Note that this sets
// username to autofilled.
- FillUserNameAndPassword(&username_element, &password_element, fill_data,
+ FillUserNameAndPassword(&username_element,
+ &password_element,
+ fill_data,
true /* exact_username_match */,
false /* set_selection */);
}
@@ -764,7 +765,8 @@ bool PasswordAutofillAgent::FillUserNameAndPassword(
base::string16 password;
// Look for any suitable matches to current field text.
- if (DoUsernamesMatch(fill_data.basic_data.fields[0].value, current_username,
+ if (DoUsernamesMatch(fill_data.basic_data.fields[0].value,
+ current_username,
exact_username_match)) {
username = fill_data.basic_data.fields[0].value;
password = fill_data.basic_data.fields[1].value;
@@ -772,9 +774,10 @@ bool PasswordAutofillAgent::FillUserNameAndPassword(
// Scan additional logins for a match.
PasswordFormFillData::LoginCollection::const_iterator iter;
for (iter = fill_data.additional_logins.begin();
- iter != fill_data.additional_logins.end(); ++iter) {
- if (DoUsernamesMatch(iter->first, current_username,
- exact_username_match)) {
+ iter != fill_data.additional_logins.end();
+ ++iter) {
+ if (DoUsernamesMatch(
+ iter->first, current_username, exact_username_match)) {
username = iter->first;
password = iter->second.password;
break;
@@ -785,10 +788,11 @@ bool PasswordAutofillAgent::FillUserNameAndPassword(
if (username.empty() && password.empty()) {
for (PasswordFormFillData::UsernamesCollection::const_iterator iter =
fill_data.other_possible_usernames.begin();
- iter != fill_data.other_possible_usernames.end(); ++iter) {
+ iter != fill_data.other_possible_usernames.end();
+ ++iter) {
for (size_t i = 0; i < iter->second.size(); ++i) {
- if (DoUsernamesMatch(iter->second[i], current_username,
- exact_username_match)) {
+ if (DoUsernamesMatch(
+ iter->second[i], current_username, exact_username_match)) {
usernames_usage_ = OTHER_POSSIBLE_USERNAME_SELECTED;
username = iter->second[i];
password = iter->first.password;
@@ -856,11 +860,12 @@ void PasswordAutofillAgent::PerformInlineAutocomplete(
// Show the popup with the list of available usernames.
ShowSuggestionPopup(fill_data, username);
-
#if !defined(OS_ANDROID)
// Fill the user and password field with the most relevant match. Android
// only fills in the fields after the user clicks on the suggestion popup.
- FillUserNameAndPassword(&username, &password, fill_data,
+ FillUserNameAndPassword(&username,
+ &password,
+ fill_data,
false /* exact_username_match */,
true /* set_selection */);
#endif
diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc
index 2aa81ef..0e01882 100644
--- a/components/password_manager/core/browser/password_manager.cc
+++ b/components/password_manager/core/browser/password_manager.cc
@@ -85,9 +85,9 @@ PasswordManager::~PasswordManager() {
void PasswordManager::SetFormHasGeneratedPassword(const PasswordForm& form) {
for (ScopedVector<PasswordFormManager>::iterator iter =
pending_login_managers_.begin();
- iter != pending_login_managers_.end(); ++iter) {
- if ((*iter)->DoesManage(
- form, PasswordFormManager::ACTION_MATCH_REQUIRED)) {
+ iter != pending_login_managers_.end();
+ ++iter) {
+ if ((*iter)->DoesManage(form, PasswordFormManager::ACTION_MATCH_REQUIRED)) {
(*iter)->SetHasGeneratedPassword();
return;
}
@@ -97,8 +97,8 @@ void PasswordManager::SetFormHasGeneratedPassword(const PasswordForm& form) {
// ability to detect forms.
bool ssl_valid = (form.origin.SchemeIsSecure() &&
!driver_->DidLastPageLoadEncounterSSLErrors());
- PasswordFormManager* manager = new PasswordFormManager(
- this, client_, driver_, form, ssl_valid);
+ PasswordFormManager* manager =
+ new PasswordFormManager(this, client_, driver_, form, ssl_valid);
pending_login_managers_.push_back(manager);
manager->SetHasGeneratedPassword();
// TODO(gcasto): Add UMA stats to track this.
@@ -125,18 +125,18 @@ void PasswordManager::ProvisionallySavePassword(const PasswordForm& form) {
pending_login_managers_.end();
for (ScopedVector<PasswordFormManager>::iterator iter =
pending_login_managers_.begin();
- iter != pending_login_managers_.end(); ++iter) {
- // If we find a manager that exactly matches the submitted form including
- // the action URL, exit the loop.
- if ((*iter)->DoesManage(
- form, PasswordFormManager::ACTION_MATCH_REQUIRED)) {
+ iter != pending_login_managers_.end();
+ ++iter) {
+ if ((*iter)->DoesManage(form, PasswordFormManager::ACTION_MATCH_REQUIRED)) {
+ // If we find a manager that exactly matches the submitted form including
+ // the action URL, exit the loop.
matched_manager_it = iter;
break;
- // If the current manager matches the submitted form excluding the action
- // URL, remember it as a candidate and continue searching for an exact
- // match.
} else if ((*iter)->DoesManage(
- form, PasswordFormManager::ACTION_MATCH_NOT_REQUIRED)) {
+ form, PasswordFormManager::ACTION_MATCH_NOT_REQUIRED)) {
+ // If the current manager matches the submitted form excluding the action
+ // URL, remember it as a candidate and continue searching for an exact
+ // match.
matched_manager_it = iter;
}
}
@@ -179,8 +179,7 @@ void PasswordManager::ProvisionallySavePassword(const PasswordForm& form) {
// Chrome to manage such passwords. For other passwords, respect the
// autocomplete attribute if autocomplete='off' is not ignored.
if (!autofill::ShouldIgnoreAutocompleteOffForPasswordFields() &&
- !manager->HasGeneratedPassword() &&
- !form.password_autocomplete_set) {
+ !manager->HasGeneratedPassword() && !form.password_autocomplete_set) {
RecordFailure(AUTOCOMPLETE_OFF, form.origin.host());
return;
}
@@ -200,8 +199,8 @@ void PasswordManager::ProvisionallySavePassword(const PasswordForm& form) {
void PasswordManager::RecordFailure(ProvisionalSaveFailure failure,
const std::string& form_origin) {
- UMA_HISTOGRAM_ENUMERATION("PasswordManager.ProvisionalSaveFailure",
- failure, MAX_FAILURE_VALUE);
+ UMA_HISTOGRAM_ENUMERATION(
+ "PasswordManager.ProvisionalSaveFailure", failure, MAX_FAILURE_VALUE);
std::string group_name = metrics_util::GroupIdToString(
metrics_util::MonitoredDomainGroupId(form_origin, client_->GetPrefs()));
@@ -251,15 +250,16 @@ void PasswordManager::OnPasswordFormsParsed(
bool had_ssl_error = driver_->DidLastPageLoadEncounterSSLErrors();
for (std::vector<PasswordForm>::const_iterator iter = forms.begin();
- iter != forms.end(); ++iter) {
+ iter != forms.end();
+ ++iter) {
// Don't involve the password manager if this form corresponds to
// SpdyProxy authentication, as indicated by the realm.
if (EndsWith(iter->signon_realm, kSpdyProxyRealm, true))
continue;
bool ssl_valid = iter->origin.SchemeIsSecure() && !had_ssl_error;
- PasswordFormManager* manager = new PasswordFormManager(
- this, client_, driver_, *iter, ssl_valid);
+ PasswordFormManager* manager =
+ new PasswordFormManager(this, client_, driver_, *iter, ssl_valid);
pending_login_managers_.push_back(manager);
// Avoid prompting the user for access to a password if they don't have
@@ -320,7 +320,8 @@ void PasswordManager::PossiblyInitializeUsernamesExperiment(
bool other_possible_usernames_exist = false;
for (autofill::PasswordFormMap::const_iterator it = best_matches.begin();
- it != best_matches.end(); ++it) {
+ it != best_matches.end();
+ ++it) {
if (!it->second->other_possible_usernames.empty()) {
other_possible_usernames_exist = true;
break;
@@ -346,14 +347,13 @@ void PasswordManager::PossiblyInitializeUsernamesExperiment(
bool PasswordManager::OtherPossibleUsernamesEnabled() const {
return base::FieldTrialList::FindFullName(
- kOtherPossibleUsernamesExperiment) == "Enabled";
+ kOtherPossibleUsernamesExperiment) == "Enabled";
}
-void PasswordManager::Autofill(
- const PasswordForm& form_for_autofill,
- const PasswordFormMap& best_matches,
- const PasswordForm& preferred_match,
- bool wait_for_username) const {
+void PasswordManager::Autofill(const PasswordForm& form_for_autofill,
+ const PasswordFormMap& best_matches,
+ const PasswordForm& preferred_match,
+ bool wait_for_username) const {
PossiblyInitializeUsernamesExperiment(best_matches);
// TODO(tedchoc): Switch to only requesting authentication if the user is
@@ -361,7 +361,8 @@ void PasswordManager::Autofill(
// of on page load.
bool authentication_required = preferred_match.use_additional_authentication;
for (autofill::PasswordFormMap::const_iterator it = best_matches.begin();
- !authentication_required && it != best_matches.end(); ++it) {
+ !authentication_required && it != best_matches.end();
+ ++it) {
if (it->second->use_additional_authentication)
authentication_required = true;
}