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

Side by Side Diff: components/password_manager/core/browser/login_database.cc

Issue 1778423002: Don't upload "null" to the Sync server for empty federation_url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/password_manager/core/browser/password_syncable_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/password_manager/core/browser/login_database.h" 5 #include "components/password_manager/core/browser/login_database.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 usernames_pickle.size()); 134 usernames_pickle.size());
135 s->BindInt(COLUMN_TIMES_USED, form.times_used); 135 s->BindInt(COLUMN_TIMES_USED, form.times_used);
136 base::Pickle form_data_pickle; 136 base::Pickle form_data_pickle;
137 autofill::SerializeFormData(form.form_data, &form_data_pickle); 137 autofill::SerializeFormData(form.form_data, &form_data_pickle);
138 s->BindBlob(COLUMN_FORM_DATA, 138 s->BindBlob(COLUMN_FORM_DATA,
139 form_data_pickle.data(), 139 form_data_pickle.data(),
140 form_data_pickle.size()); 140 form_data_pickle.size());
141 s->BindInt64(COLUMN_DATE_SYNCED, form.date_synced.ToInternalValue()); 141 s->BindInt64(COLUMN_DATE_SYNCED, form.date_synced.ToInternalValue());
142 s->BindString16(COLUMN_DISPLAY_NAME, form.display_name); 142 s->BindString16(COLUMN_DISPLAY_NAME, form.display_name);
143 s->BindString(COLUMN_ICON_URL, form.icon_url.spec()); 143 s->BindString(COLUMN_ICON_URL, form.icon_url.spec());
144 s->BindString(COLUMN_FEDERATION_URL, form.federation_origin.Serialize()); 144 // An empty Origin serializes as "null" which would be strange to store here.
145 s->BindString(COLUMN_FEDERATION_URL,
146 form.federation_origin.unique()
147 ? std::string()
148 : form.federation_origin.Serialize());
145 s->BindInt(COLUMN_SKIP_ZERO_CLICK, form.skip_zero_click); 149 s->BindInt(COLUMN_SKIP_ZERO_CLICK, form.skip_zero_click);
146 s->BindInt(COLUMN_GENERATION_UPLOAD_STATUS, form.generation_upload_status); 150 s->BindInt(COLUMN_GENERATION_UPLOAD_STATUS, form.generation_upload_status);
147 } 151 }
148 152
149 void AddCallback(int err, sql::Statement* /*stmt*/) { 153 void AddCallback(int err, sql::Statement* /*stmt*/) {
150 if (err == 19 /*SQLITE_CONSTRAINT*/) 154 if (err == 19 /*SQLITE_CONSTRAINT*/)
151 DLOG(WARNING) << "LoginDatabase::AddLogin updated an existing form"; 155 DLOG(WARNING) << "LoginDatabase::AddLogin updated an existing form";
152 } 156 }
153 157
154 bool DoesMatchConstraints(const PasswordForm& form) { 158 bool DoesMatchConstraints(const PasswordForm& form) {
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 s.BindBlob(4, pickle.data(), pickle.size()); 938 s.BindBlob(4, pickle.data(), pickle.size());
935 s.BindInt(5, form.times_used); 939 s.BindInt(5, form.times_used);
936 s.BindString16(6, form.submit_element); 940 s.BindString16(6, form.submit_element);
937 s.BindInt64(7, form.date_synced.ToInternalValue()); 941 s.BindInt64(7, form.date_synced.ToInternalValue());
938 s.BindInt64(8, form.date_created.ToInternalValue()); 942 s.BindInt64(8, form.date_created.ToInternalValue());
939 s.BindInt(9, form.blacklisted_by_user); 943 s.BindInt(9, form.blacklisted_by_user);
940 s.BindInt(10, form.scheme); 944 s.BindInt(10, form.scheme);
941 s.BindInt(11, form.type); 945 s.BindInt(11, form.type);
942 s.BindString16(12, form.display_name); 946 s.BindString16(12, form.display_name);
943 s.BindString(13, form.icon_url.spec()); 947 s.BindString(13, form.icon_url.spec());
944 // We serialize unique origins as "", in order to make other systems that 948 // An empty Origin serializes as "null" which would be strange to store here.
945 // read from the login database happy. https://crbug.com/591310
946 s.BindString(14, form.federation_origin.unique() 949 s.BindString(14, form.federation_origin.unique()
947 ? std::string() 950 ? std::string()
948 : form.federation_origin.Serialize()); 951 : form.federation_origin.Serialize());
949 s.BindInt(15, form.skip_zero_click); 952 s.BindInt(15, form.skip_zero_click);
950 s.BindInt(16, form.generation_upload_status); 953 s.BindInt(16, form.generation_upload_status);
951 954
952 // WHERE starts here. 955 // WHERE starts here.
953 s.BindString(17, form.origin.spec()); 956 s.BindString(17, form.origin.spec());
954 s.BindString16(18, form.username_element); 957 s.BindString16(18, form.username_element);
955 s.BindString16(19, form.username_value); 958 s.BindString16(19, form.username_value);
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 UMA_HISTOGRAM_ENUMERATION("PasswordManager.PslDomainMatchTriggering", 1348 UMA_HISTOGRAM_ENUMERATION("PasswordManager.PslDomainMatchTriggering",
1346 psl_domain_match_metric, PSL_DOMAIN_MATCH_COUNT); 1349 psl_domain_match_metric, PSL_DOMAIN_MATCH_COUNT);
1347 } 1350 }
1348 1351
1349 if (!statement->Succeeded()) 1352 if (!statement->Succeeded())
1350 return false; 1353 return false;
1351 return true; 1354 return true;
1352 } 1355 }
1353 1356
1354 } // namespace password_manager 1357 } // namespace password_manager
OLDNEW
« no previous file with comments | « no previous file | components/password_manager/core/browser/password_syncable_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698