OLD | NEW |
---|---|
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 form->blacklisted_by_user = uint_attr_map["blacklisted_by_user"]; | 135 form->blacklisted_by_user = uint_attr_map["blacklisted_by_user"]; |
136 form->type = static_cast<PasswordForm::Type>(uint_attr_map["type"]); | 136 form->type = static_cast<PasswordForm::Type>(uint_attr_map["type"]); |
137 form->times_used = uint_attr_map["times_used"]; | 137 form->times_used = uint_attr_map["times_used"]; |
138 form->scheme = static_cast<PasswordForm::Scheme>(uint_attr_map["scheme"]); | 138 form->scheme = static_cast<PasswordForm::Scheme>(uint_attr_map["scheme"]); |
139 int64 date_synced = 0; | 139 int64 date_synced = 0; |
140 base::StringToInt64(string_attr_map["date_synced"], &date_synced); | 140 base::StringToInt64(string_attr_map["date_synced"], &date_synced); |
141 form->date_synced = base::Time::FromInternalValue(date_synced); | 141 form->date_synced = base::Time::FromInternalValue(date_synced); |
142 form->display_name = UTF8ToUTF16(string_attr_map["display_name"]); | 142 form->display_name = UTF8ToUTF16(string_attr_map["display_name"]); |
143 form->avatar_url = GURL(string_attr_map["avatar_url"]); | 143 form->avatar_url = GURL(string_attr_map["avatar_url"]); |
144 form->federation_url = GURL(string_attr_map["federation_url"]); | 144 form->federation_url = GURL(string_attr_map["federation_url"]); |
145 form->is_zero_click = uint_attr_map["is_zero_click"]; | 145 form->skip_next_zero_click = uint_attr_map["skip_next_zero_click"]; |
146 | 146 |
147 return form.Pass(); | 147 return form.Pass(); |
148 } | 148 } |
149 | 149 |
150 // Parse all the results from the given GList into a | 150 // Parse all the results from the given GList into a |
151 // ScopedVector<autofill::PasswordForm>, and free the GList. PasswordForms are | 151 // ScopedVector<autofill::PasswordForm>, and free the GList. PasswordForms are |
152 // allocated on the heap, and should be deleted by the consumer. If not NULL, | 152 // allocated on the heap, and should be deleted by the consumer. If not NULL, |
153 // |lookup_form| is used to filter out results -- only credentials with signon | 153 // |lookup_form| is used to filter out results -- only credentials with signon |
154 // realms passing the PSL matching against |lookup_form->signon_realm| will be | 154 // realms passing the PSL matching against |lookup_form->signon_realm| will be |
155 // kept. PSL matched results get their signon_realm, origin, and action | 155 // kept. PSL matched results get their signon_realm, origin, and action |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
223 { "preferred", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, | 223 { "preferred", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, |
224 { "date_created", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, | 224 { "date_created", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, |
225 { "blacklisted_by_user", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, | 225 { "blacklisted_by_user", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, |
226 { "scheme", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, | 226 { "scheme", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, |
227 { "type", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, | 227 { "type", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, |
228 { "times_used", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, | 228 { "times_used", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, |
229 { "date_synced", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, | 229 { "date_synced", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, |
230 { "display_name", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, | 230 { "display_name", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, |
231 { "avatar_url", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, | 231 { "avatar_url", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, |
232 { "federation_url", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, | 232 { "federation_url", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, |
233 { "is_zero_click", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, | 233 { "skip_next_zero_click", GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 }, |
Mike West
2015/02/03 14:15:40
Is there no bool type?
vasilii
2015/02/03 19:49:17
There are just a string and a number :-D
https://d
| |
234 // This field is always "chrome" so that we can search for it. | 234 // This field is always "chrome" so that we can search for it. |
235 { "application", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, | 235 { "application", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, |
236 { NULL } | 236 { NULL } |
237 } | 237 } |
238 }; | 238 }; |
239 | 239 |
240 // Sadly, PasswordStore goes to great lengths to switch from the originally | 240 // Sadly, PasswordStore goes to great lengths to switch from the originally |
241 // calling thread to the DB thread, and to provide an asynchronous API to | 241 // calling thread to the DB thread, and to provide an asynchronous API to |
242 // callers while using a synchronous (virtual) API provided by subclasses like | 242 // callers while using a synchronous (virtual) API provided by subclasses like |
243 // PasswordStoreX -- but GNOME Keyring really wants to be on the GLib main | 243 // PasswordStoreX -- but GNOME Keyring really wants to be on the GLib main |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 "preferred", form.preferred, | 342 "preferred", form.preferred, |
343 "date_created", base::Int64ToString(date_created).c_str(), | 343 "date_created", base::Int64ToString(date_created).c_str(), |
344 "blacklisted_by_user", form.blacklisted_by_user, | 344 "blacklisted_by_user", form.blacklisted_by_user, |
345 "type", form.type, | 345 "type", form.type, |
346 "times_used", form.times_used, | 346 "times_used", form.times_used, |
347 "scheme", form.scheme, | 347 "scheme", form.scheme, |
348 "date_synced", base::Int64ToString(date_synced).c_str(), | 348 "date_synced", base::Int64ToString(date_synced).c_str(), |
349 "display_name", UTF16ToUTF8(form.display_name).c_str(), | 349 "display_name", UTF16ToUTF8(form.display_name).c_str(), |
350 "avatar_url", form.avatar_url.spec().c_str(), | 350 "avatar_url", form.avatar_url.spec().c_str(), |
351 "federation_url", form.federation_url.spec().c_str(), | 351 "federation_url", form.federation_url.spec().c_str(), |
352 "is_zero_click", form.is_zero_click, | 352 "skip_next_zero_click", form.skip_next_zero_click, |
353 "application", app_string, | 353 "application", app_string, |
354 NULL); | 354 NULL); |
355 } | 355 } |
356 | 356 |
357 void GKRMethod::AddLoginSearch(const PasswordForm& form, | 357 void GKRMethod::AddLoginSearch(const PasswordForm& form, |
358 const char* app_string) { | 358 const char* app_string) { |
359 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 359 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
360 lookup_form_.reset(NULL); | 360 lookup_form_.reset(NULL); |
361 // Search GNOME Keyring for matching passwords to update. | 361 // Search GNOME Keyring for matching passwords to update. |
362 ScopedAttributeList attrs(gnome_keyring_attribute_list_new()); | 362 ScopedAttributeList attrs(gnome_keyring_attribute_list_new()); |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
789 } | 789 } |
790 return ok; | 790 return ok; |
791 } | 791 } |
792 | 792 |
793 std::string NativeBackendGnome::GetProfileSpecificAppString() const { | 793 std::string NativeBackendGnome::GetProfileSpecificAppString() const { |
794 // Originally, the application string was always just "chrome" and used only | 794 // Originally, the application string was always just "chrome" and used only |
795 // so that we had *something* to search for since GNOME Keyring won't search | 795 // so that we had *something* to search for since GNOME Keyring won't search |
796 // for nothing. Now we use it to distinguish passwords for different profiles. | 796 // for nothing. Now we use it to distinguish passwords for different profiles. |
797 return base::StringPrintf("%s-%d", kGnomeKeyringAppString, profile_id_); | 797 return base::StringPrintf("%s-%d", kGnomeKeyringAppString, profile_id_); |
798 } | 798 } |
OLD | NEW |