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

Side by Side Diff: chrome/browser/password_manager/native_backend_gnome_x.cc

Issue 1734193003: CREDENTIAL: Disable auto sign-in by default for existing credentials. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ugh. 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 | chrome/browser/password_manager/native_backend_gnome_x_unittest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/password_manager/native_backend_gnome_x.h" 5 #include "chrome/browser/password_manager/native_backend_gnome_x.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <gnome-keyring.h> 8 #include <gnome-keyring.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 form->type = static_cast<PasswordForm::Type>(uint_attr_map["type"]); 152 form->type = static_cast<PasswordForm::Type>(uint_attr_map["type"]);
153 form->times_used = uint_attr_map["times_used"]; 153 form->times_used = uint_attr_map["times_used"];
154 form->scheme = static_cast<PasswordForm::Scheme>(uint_attr_map["scheme"]); 154 form->scheme = static_cast<PasswordForm::Scheme>(uint_attr_map["scheme"]);
155 int64_t date_synced = 0; 155 int64_t date_synced = 0;
156 base::StringToInt64(string_attr_map["date_synced"], &date_synced); 156 base::StringToInt64(string_attr_map["date_synced"], &date_synced);
157 form->date_synced = base::Time::FromInternalValue(date_synced); 157 form->date_synced = base::Time::FromInternalValue(date_synced);
158 form->display_name = UTF8ToUTF16(string_attr_map["display_name"]); 158 form->display_name = UTF8ToUTF16(string_attr_map["display_name"]);
159 form->icon_url = GURL(string_attr_map["avatar_url"]); 159 form->icon_url = GURL(string_attr_map["avatar_url"]);
160 form->federation_origin = 160 form->federation_origin =
161 url::Origin(GURL(string_attr_map["federation_url"])); 161 url::Origin(GURL(string_attr_map["federation_url"]));
162 form->skip_zero_click = uint_attr_map["skip_zero_click"]; 162 form->skip_zero_click = uint_attr_map.count("should_skip_zero_click")
163 ? uint_attr_map["should_skip_zero_click"]
164 : true;
163 form->generation_upload_status = 165 form->generation_upload_status =
164 static_cast<PasswordForm::GenerationUploadStatus>( 166 static_cast<PasswordForm::GenerationUploadStatus>(
165 uint_attr_map["generation_upload_status"]); 167 uint_attr_map["generation_upload_status"]);
166 if (!string_attr_map["form_data"].empty()) { 168 if (!string_attr_map["form_data"].empty()) {
167 bool success = DeserializeFormDataFromBase64String( 169 bool success = DeserializeFormDataFromBase64String(
168 string_attr_map["form_data"], &form->form_data); 170 string_attr_map["form_data"], &form->form_data);
169 FormDeserializationStatus status = success ? GNOME_SUCCESS : GNOME_FAILURE; 171 FormDeserializationStatus status = success ? GNOME_SUCCESS : GNOME_FAILURE;
170 LogFormDataDeserializationStatus(status); 172 LogFormDataDeserializationStatus(status);
171 } 173 }
172 return form; 174 return form;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 password_manager::ShouldPSLDomainMatchingApply(registered_domain) 222 password_manager::ShouldPSLDomainMatchingApply(registered_domain)
221 ? psl_domain_match_metric 223 ? psl_domain_match_metric
222 : password_manager::PSL_DOMAIN_MATCH_NOT_USED, 224 : password_manager::PSL_DOMAIN_MATCH_NOT_USED,
223 password_manager::PSL_DOMAIN_MATCH_COUNT); 225 password_manager::PSL_DOMAIN_MATCH_COUNT);
224 } 226 }
225 return forms; 227 return forms;
226 } 228 }
227 229
228 // Schema is analagous to the fields in PasswordForm. 230 // Schema is analagous to the fields in PasswordForm.
229 const GnomeKeyringPasswordSchema kGnomeSchema = { 231 const GnomeKeyringPasswordSchema kGnomeSchema = {
230 GNOME_KEYRING_ITEM_GENERIC_SECRET, { 232 GNOME_KEYRING_ITEM_GENERIC_SECRET,
231 { "origin_url", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 233 {{"origin_url", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
232 { "action_url", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 234 {"action_url", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
233 { "username_element", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 235 {"username_element", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
234 { "username_value", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 236 {"username_value", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
235 { "password_element", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 237 {"password_element", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
236 { "submit_element", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 238 {"submit_element", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
237 { "signon_realm", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 239 {"signon_realm", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
238 { "ssl_valid", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, 240 {"ssl_valid", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32},
239 { "preferred", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, 241 {"preferred", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32},
240 { "date_created", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 242 {"date_created", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
241 { "blacklisted_by_user", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, 243 {"blacklisted_by_user", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32},
242 { "scheme", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, 244 {"scheme", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32},
243 { "type", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, 245 {"type", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32},
244 { "times_used", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, 246 {"times_used", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32},
245 { "date_synced", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 247 {"date_synced", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
246 { "display_name", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 248 {"display_name", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
247 { "avatar_url", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 249 {"avatar_url", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
248 { "federation_url", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 250 {"federation_url", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
249 { "skip_zero_click", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, 251 {"should_skip_zero_click", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32},
250 { "generation_upload_status", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, 252 {"generation_upload_status", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32},
251 { "form_data", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 253 {"form_data", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
252 // This field is always "chrome" so that we can search for it. 254 // This field is always "chrome" so that we can search for it.
253 { "application", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 255 {"application", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
254 { nullptr } 256 {nullptr}}};
255 }
256 };
257 257
258 // Sadly, PasswordStore goes to great lengths to switch from the originally 258 // Sadly, PasswordStore goes to great lengths to switch from the originally
259 // calling thread to the DB thread, and to provide an asynchronous API to 259 // calling thread to the DB thread, and to provide an asynchronous API to
260 // callers while using a synchronous (virtual) API provided by subclasses like 260 // callers while using a synchronous (virtual) API provided by subclasses like
261 // PasswordStoreX -- but GNOME Keyring really wants to be on the GLib main 261 // PasswordStoreX -- but GNOME Keyring really wants to be on the GLib main
262 // thread, which is the UI thread to us. So we end up having to switch threads 262 // thread, which is the UI thread to us. So we end up having to switch threads
263 // again, possibly back to the very same thread (in case the UI thread is the 263 // again, possibly back to the very same thread (in case the UI thread is the
264 // caller, e.g. in the password management UI), and *block* the DB thread 264 // caller, e.g. in the password management UI), and *block* the DB thread
265 // waiting for a response from the UI thread to provide the synchronous API 265 // waiting for a response from the UI thread to provide the synchronous API
266 // PasswordStore expects of us. (It will then in turn switch back to the 266 // PasswordStore expects of us. (It will then in turn switch back to the
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 "preferred", form.preferred, 364 "preferred", form.preferred,
365 "date_created", base::Int64ToString(date_created).c_str(), 365 "date_created", base::Int64ToString(date_created).c_str(),
366 "blacklisted_by_user", form.blacklisted_by_user, 366 "blacklisted_by_user", form.blacklisted_by_user,
367 "type", form.type, 367 "type", form.type,
368 "times_used", form.times_used, 368 "times_used", form.times_used,
369 "scheme", form.scheme, 369 "scheme", form.scheme,
370 "date_synced", base::Int64ToString(date_synced).c_str(), 370 "date_synced", base::Int64ToString(date_synced).c_str(),
371 "display_name", UTF16ToUTF8(form.display_name).c_str(), 371 "display_name", UTF16ToUTF8(form.display_name).c_str(),
372 "avatar_url", form.icon_url.spec().c_str(), 372 "avatar_url", form.icon_url.spec().c_str(),
373 "federation_url", form.federation_origin.Serialize().c_str(), 373 "federation_url", form.federation_origin.Serialize().c_str(),
374 "skip_zero_click", form.skip_zero_click, 374 "should_skip_zero_click", form.skip_zero_click,
375 "generation_upload_status", form.generation_upload_status, 375 "generation_upload_status", form.generation_upload_status,
376 "form_data", form_data.c_str(), 376 "form_data", form_data.c_str(),
377 "application", app_string, 377 "application", app_string,
378 nullptr); 378 nullptr);
379 // clang-format on 379 // clang-format on
380 } 380 }
381 381
382 void GKRMethod::LoginSearch(const PasswordForm& form, 382 void GKRMethod::LoginSearch(const PasswordForm& form,
383 const char* app_string) { 383 const char* app_string) {
384 DCHECK_CURRENTLY_ON(BrowserThread::UI); 384 DCHECK_CURRENTLY_ON(BrowserThread::UI);
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 ScopedVector<PasswordForm> forms; 804 ScopedVector<PasswordForm> forms;
805 if (!GetLoginsBetween(get_begin, get_end, date_to_compare, &forms)) 805 if (!GetLoginsBetween(get_begin, get_end, date_to_compare, &forms))
806 return false; 806 return false;
807 807
808 for (size_t i = 0; i < forms.size(); ++i) { 808 for (size_t i = 0; i < forms.size(); ++i) {
809 if (!RemoveLogin(*forms[i], changes)) 809 if (!RemoveLogin(*forms[i], changes))
810 return false; 810 return false;
811 } 811 }
812 return true; 812 return true;
813 } 813 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/password_manager/native_backend_gnome_x_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698