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

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

Issue 459103005: Introduce new PasswordForm attributes for Credential Management API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mike's comment Created 6 years, 4 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 | Annotate | Revision Log
« 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 9
10 #include <map> 10 #include <map>
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 &date_created); 133 &date_created);
134 DCHECK(date_ok); 134 DCHECK(date_ok);
135 form->date_created = base::Time::FromTimeT(date_created); 135 form->date_created = base::Time::FromTimeT(date_created);
136 form->blacklisted_by_user = uint_attr_map["blacklisted_by_user"]; 136 form->blacklisted_by_user = uint_attr_map["blacklisted_by_user"];
137 form->type = static_cast<PasswordForm::Type>(uint_attr_map["type"]); 137 form->type = static_cast<PasswordForm::Type>(uint_attr_map["type"]);
138 form->times_used = uint_attr_map["times_used"]; 138 form->times_used = uint_attr_map["times_used"];
139 form->scheme = static_cast<PasswordForm::Scheme>(uint_attr_map["scheme"]); 139 form->scheme = static_cast<PasswordForm::Scheme>(uint_attr_map["scheme"]);
140 int64 date_synced = 0; 140 int64 date_synced = 0;
141 base::StringToInt64(string_attr_map["date_synced"], &date_synced); 141 base::StringToInt64(string_attr_map["date_synced"], &date_synced);
142 form->date_synced = base::Time::FromInternalValue(date_synced); 142 form->date_synced = base::Time::FromInternalValue(date_synced);
143 form->display_name = UTF8ToUTF16(string_attr_map["display_name"]);
144 form->avatar_url = GURL(string_attr_map["avatar_url"]);
145 form->federation_url = GURL(string_attr_map["federation_url"]);
146 form->is_zero_click = uint_attr_map["is_zero_click"];
143 147
144 return form.Pass(); 148 return form.Pass();
145 } 149 }
146 150
147 // Parse all the results from the given GList into a PasswordFormList, and free 151 // Parse all the results from the given GList into a PasswordFormList, and free
148 // the GList. PasswordForms are allocated on the heap, and should be deleted by 152 // the GList. PasswordForms are allocated on the heap, and should be deleted by
149 // the consumer. If not NULL, |lookup_form| is used to filter out results -- 153 // the consumer. If not NULL, |lookup_form| is used to filter out results --
150 // only credentials with signon realms passing the PSL matching (done by 154 // only credentials with signon realms passing the PSL matching (done by
151 // |helper|) against |lookup_form->signon_realm| will be kept. PSL matched 155 // |helper|) against |lookup_form->signon_realm| will be kept. PSL matched
152 // results get their signon_realm, origin, and action rewritten to those of 156 // results get their signon_realm, origin, and action rewritten to those of
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 { "submit_element", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 219 { "submit_element", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
216 { "signon_realm", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 220 { "signon_realm", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
217 { "ssl_valid", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, 221 { "ssl_valid", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 },
218 { "preferred", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, 222 { "preferred", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 },
219 { "date_created", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 223 { "date_created", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
220 { "blacklisted_by_user", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, 224 { "blacklisted_by_user", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 },
221 { "scheme", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, 225 { "scheme", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 },
222 { "type", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, 226 { "type", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 },
223 { "times_used", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, 227 { "times_used", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 },
224 { "date_synced", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 228 { "date_synced", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
229 { "display_name", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
230 { "avatar_url", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
231 { "federation_url", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
232 { "is_zero_click", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 },
225 // This field is always "chrome" so that we can search for it. 233 // This field is always "chrome" so that we can search for it.
226 { "application", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 234 { "application", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
227 { NULL } 235 { NULL }
228 } 236 }
229 }; 237 };
230 238
231 // Sadly, PasswordStore goes to great lengths to switch from the originally 239 // Sadly, PasswordStore goes to great lengths to switch from the originally
232 // calling thread to the DB thread, and to provide an asynchronous API to 240 // calling thread to the DB thread, and to provide an asynchronous API to
233 // callers while using a synchronous (virtual) API provided by subclasses like 241 // callers while using a synchronous (virtual) API provided by subclasses like
234 // PasswordStoreX -- but GNOME Keyring really wants to be on the GLib main 242 // PasswordStoreX -- but GNOME Keyring really wants to be on the GLib main
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 "submit_element", UTF16ToUTF8(form.submit_element).c_str(), 341 "submit_element", UTF16ToUTF8(form.submit_element).c_str(),
334 "signon_realm", form.signon_realm.c_str(), 342 "signon_realm", form.signon_realm.c_str(),
335 "ssl_valid", form.ssl_valid, 343 "ssl_valid", form.ssl_valid,
336 "preferred", form.preferred, 344 "preferred", form.preferred,
337 "date_created", base::Int64ToString(date_created).c_str(), 345 "date_created", base::Int64ToString(date_created).c_str(),
338 "blacklisted_by_user", form.blacklisted_by_user, 346 "blacklisted_by_user", form.blacklisted_by_user,
339 "type", form.type, 347 "type", form.type,
340 "times_used", form.times_used, 348 "times_used", form.times_used,
341 "scheme", form.scheme, 349 "scheme", form.scheme,
342 "date_synced", base::Int64ToString(date_synced).c_str(), 350 "date_synced", base::Int64ToString(date_synced).c_str(),
351 "display_name", UTF16ToUTF8(form.display_name).c_str(),
352 "avatar_url", form.avatar_url.spec().c_str(),
353 "federation_url", form.federation_url.spec().c_str(),
354 "is_zero_click", form.is_zero_click,
343 "application", app_string, 355 "application", app_string,
344 NULL); 356 NULL);
345 } 357 }
346 358
347 void GKRMethod::AddLoginSearch(const PasswordForm& form, 359 void GKRMethod::AddLoginSearch(const PasswordForm& form,
348 const char* app_string) { 360 const char* app_string) {
349 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 361 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
350 lookup_form_.reset(NULL); 362 lookup_form_.reset(NULL);
351 // Search GNOME Keyring for matching passwords to update. 363 // Search GNOME Keyring for matching passwords to update.
352 ScopedAttributeList attrs(gnome_keyring_attribute_list_new()); 364 ScopedAttributeList attrs(gnome_keyring_attribute_list_new());
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 } 787 }
776 return ok; 788 return ok;
777 } 789 }
778 790
779 std::string NativeBackendGnome::GetProfileSpecificAppString() const { 791 std::string NativeBackendGnome::GetProfileSpecificAppString() const {
780 // Originally, the application string was always just "chrome" and used only 792 // Originally, the application string was always just "chrome" and used only
781 // so that we had *something* to search for since GNOME Keyring won't search 793 // so that we had *something* to search for since GNOME Keyring won't search
782 // for nothing. Now we use it to distinguish passwords for different profiles. 794 // for nothing. Now we use it to distinguish passwords for different profiles.
783 return base::StringPrintf("%s-%d", kGnomeKeyringAppString, profile_id_); 795 return base::StringPrintf("%s-%d", kGnomeKeyringAppString, profile_id_);
784 } 796 }
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