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

Unified Diff: components/password_manager/core/browser/password_autofill_manager.cc

Issue 695233002: Revert of Do not haul suggestions back to browser in AutofillHostMsg_ShowPasswordSuggestions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: components/password_manager/core/browser/password_autofill_manager.cc
diff --git a/components/password_manager/core/browser/password_autofill_manager.cc b/components/password_manager/core/browser/password_autofill_manager.cc
index ab03c02396b9bcf586ac314a375ef4501d1d9ee2..01bf791bed010de8ddfda9ae442a1c79cb34dcd1 100644
--- a/components/password_manager/core/browser/password_autofill_manager.cc
+++ b/components/password_manager/core/browser/password_autofill_manager.cc
@@ -2,58 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/password_manager/core/browser/password_autofill_manager.h"
-
-#include <vector>
-
#include "base/logging.h"
-#include "base/strings/string16.h"
-#include "base/strings/string_util.h"
-#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/browser/autofill_driver.h"
#include "components/autofill/core/browser/popup_item_ids.h"
#include "components/autofill/core/common/autofill_data_validation.h"
+#include "components/password_manager/core/browser/password_autofill_manager.h"
#include "components/password_manager/core/browser/password_manager_client.h"
#include "components/password_manager/core/browser/password_manager_driver.h"
namespace password_manager {
-
-namespace {
-
-// This function attempts to fill |suggestions| and |realms| form |fill_data|
-// based on |current_username|. Unless |show_all| is true, it only picks
-// suggestions where the username has |current_username| as a prefix.
-void GetSuggestions(const autofill::PasswordFormFillData& fill_data,
- const base::string16& current_username,
- std::vector<base::string16>* suggestions,
- std::vector<base::string16>* realms,
- bool show_all) {
- if (show_all ||
- StartsWith(
- fill_data.basic_data.fields[0].value, current_username, false)) {
- suggestions->push_back(fill_data.basic_data.fields[0].value);
- realms->push_back(base::UTF8ToUTF16(fill_data.preferred_realm));
- }
-
- for (const auto& login : fill_data.additional_logins) {
- if (show_all || StartsWith(login.first, current_username, false)) {
- suggestions->push_back(login.first);
- realms->push_back(base::UTF8ToUTF16(login.second.realm));
- }
- }
-
- for (const auto& usernames : fill_data.other_possible_usernames) {
- for (size_t i = 0; i < usernames.second.size(); ++i) {
- if (show_all ||
- StartsWith(usernames.second[i], current_username, false)) {
- suggestions->push_back(usernames.second[i]);
- realms->push_back(base::UTF8ToUTF16(usernames.first.realm));
- }
- }
- }
-}
-
-} // namespace
////////////////////////////////////////////////////////////////////////////////
// PasswordAutofillManager, public:
@@ -109,18 +66,9 @@
void PasswordAutofillManager::OnShowPasswordSuggestions(
const autofill::FormFieldData& field,
- const base::string16& typed_username,
- bool show_all,
- const gfx::RectF& bounds) {
- std::vector<base::string16> suggestions;
- std::vector<base::string16> realms;
- LoginToPasswordInfoMap::const_iterator fill_data_it =
- login_to_password_info_.find(field);
- DCHECK(fill_data_it != login_to_password_info_.end());
- GetSuggestions(fill_data_it->second, typed_username, &suggestions, &realms,
- show_all);
- DCHECK_EQ(suggestions.size(), realms.size());
-
+ const gfx::RectF& bounds,
+ const std::vector<base::string16>& suggestions,
+ const std::vector<base::string16>& realms) {
if (!autofill::IsValidString16Vector(suggestions) ||
!autofill::IsValidString16Vector(realms) ||
suggestions.size() != realms.size())

Powered by Google App Engine
This is Rietveld 408576698