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

Unified Diff: chrome/browser/password_manager/password_store_x.cc

Issue 6953010: Linux: sort the logins by origin when using a native password store, like the built-in store does. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/password_manager/password_store_x.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/password_manager/password_store_x.cc
===================================================================
--- chrome/browser/password_manager/password_store_x.cc (revision 84505)
+++ chrome/browser/password_manager/password_store_x.cc (working copy)
@@ -4,6 +4,7 @@
#include "chrome/browser/password_manager/password_store_x.h"
+#include <algorithm>
#include <map>
#include <vector>
@@ -98,10 +99,24 @@
STLDeleteElements(&forms);
}
+namespace {
+struct LoginLessThan {
+ bool operator()(const PasswordForm* a, const PasswordForm* b) {
+ return a->origin < b->origin;
+ }
+};
+} // anonymous namespace
+
+void PasswordStoreX::SortLoginsByOrigin(NativeBackend::PasswordFormList* list) {
+ // In login_database.cc, the query has ORDER BY origin_url. Simulate that.
+ std::sort(list->begin(), list->end(), LoginLessThan());
+}
+
void PasswordStoreX::GetLoginsImpl(GetLoginsRequest* request,
const PasswordForm& form) {
CheckMigration();
if (use_native_backend() && backend_->GetLogins(form, &request->value)) {
+ SortLoginsByOrigin(&request->value);
ForwardLoginsResult(request);
allow_fallback_ = false;
} else if (allow_default_store()) {
@@ -116,6 +131,7 @@
CheckMigration();
if (use_native_backend() &&
backend_->GetAutofillableLogins(&request->value)) {
+ SortLoginsByOrigin(&request->value);
ForwardLoginsResult(request);
allow_fallback_ = false;
} else if (allow_default_store()) {
@@ -130,6 +146,7 @@
CheckMigration();
if (use_native_backend() &&
backend_->GetBlacklistLogins(&request->value)) {
+ SortLoginsByOrigin(&request->value);
ForwardLoginsResult(request);
allow_fallback_ = false;
} else if (allow_default_store()) {
« no previous file with comments | « chrome/browser/password_manager/password_store_x.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698