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

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

Issue 134303003: Reland: Password manager: Gnome support for Public Suffix List matching (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add scoped_ptr Created 6 years, 11 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
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>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/metrics/histogram.h"
16 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/string_piece.h" 19 #include "base/strings/string_piece.h"
18 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
19 #include "base/strings/stringprintf.h" 21 #include "base/strings/stringprintf.h"
20 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
21 #include "base/synchronization/waitable_event.h" 23 #include "base/synchronization/waitable_event.h"
22 #include "base/time/time.h" 24 #include "base/time/time.h"
25 #include "chrome/browser/password_manager/psl_matching_helper.h"
23 #include "components/autofill/core/common/password_form.h" 26 #include "components/autofill/core/common/password_form.h"
24 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
25 28
26 using autofill::PasswordForm; 29 using autofill::PasswordForm;
27 using base::UTF8ToUTF16; 30 using base::UTF8ToUTF16;
28 using base::UTF16ToUTF8; 31 using base::UTF16ToUTF8;
29 using content::BrowserThread; 32 using content::BrowserThread;
30 33
31 #define GNOME_KEYRING_DEFINE_POINTER(name) \ 34 #define GNOME_KEYRING_DEFINE_POINTER(name) \
32 typeof(&::gnome_keyring_##name) GnomeKeyringLoader::gnome_keyring_##name; 35 typeof(&::gnome_keyring_##name) GnomeKeyringLoader::gnome_keyring_##name;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 94
92 #endif // defined(DLOPEN_GNOME_KEYRING) 95 #endif // defined(DLOPEN_GNOME_KEYRING)
93 96
94 namespace { 97 namespace {
95 98
96 const char kGnomeKeyringAppString[] = "chrome"; 99 const char kGnomeKeyringAppString[] = "chrome";
97 100
98 // Convert the attributes of a given keyring entry into a new PasswordForm. 101 // Convert the attributes of a given keyring entry into a new PasswordForm.
99 // Note: does *not* get the actual password, as that is not a key attribute! 102 // Note: does *not* get the actual password, as that is not a key attribute!
100 // Returns NULL if the attributes are for the wrong application. 103 // Returns NULL if the attributes are for the wrong application.
101 PasswordForm* FormFromAttributes(GnomeKeyringAttributeList* attrs) { 104 scoped_ptr<PasswordForm> FormFromAttributes(GnomeKeyringAttributeList* attrs) {
102 // Read the string and int attributes into the appropriate map. 105 // Read the string and int attributes into the appropriate map.
103 std::map<std::string, std::string> string_attr_map; 106 std::map<std::string, std::string> string_attr_map;
104 std::map<std::string, uint32_t> uint_attr_map; 107 std::map<std::string, uint32_t> uint_attr_map;
105 for (guint i = 0; i < attrs->len; ++i) { 108 for (guint i = 0; i < attrs->len; ++i) {
106 GnomeKeyringAttribute attr = gnome_keyring_attribute_list_index(attrs, i); 109 GnomeKeyringAttribute attr = gnome_keyring_attribute_list_index(attrs, i);
107 if (attr.type == GNOME_KEYRING_ATTRIBUTE_TYPE_STRING) 110 if (attr.type == GNOME_KEYRING_ATTRIBUTE_TYPE_STRING)
108 string_attr_map[attr.name] = attr.value.string; 111 string_attr_map[attr.name] = attr.value.string;
109 else if (attr.type == GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32) 112 else if (attr.type == GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32)
110 uint_attr_map[attr.name] = attr.value.integer; 113 uint_attr_map[attr.name] = attr.value.integer;
111 } 114 }
112 // Check to make sure this is a password we care about. 115 // Check to make sure this is a password we care about.
113 const std::string& app_value = string_attr_map["application"]; 116 const std::string& app_value = string_attr_map["application"];
114 if (!base::StringPiece(app_value).starts_with(kGnomeKeyringAppString)) 117 if (!base::StringPiece(app_value).starts_with(kGnomeKeyringAppString))
115 return NULL; 118 return scoped_ptr<PasswordForm>();
116 119
117 PasswordForm* form = new PasswordForm(); 120 scoped_ptr<PasswordForm> form(new PasswordForm());
118 form->origin = GURL(string_attr_map["origin_url"]); 121 form->origin = GURL(string_attr_map["origin_url"]);
119 form->action = GURL(string_attr_map["action_url"]); 122 form->action = GURL(string_attr_map["action_url"]);
120 form->username_element = UTF8ToUTF16(string_attr_map["username_element"]); 123 form->username_element = UTF8ToUTF16(string_attr_map["username_element"]);
121 form->username_value = UTF8ToUTF16(string_attr_map["username_value"]); 124 form->username_value = UTF8ToUTF16(string_attr_map["username_value"]);
122 form->password_element = UTF8ToUTF16(string_attr_map["password_element"]); 125 form->password_element = UTF8ToUTF16(string_attr_map["password_element"]);
123 form->submit_element = UTF8ToUTF16(string_attr_map["submit_element"]); 126 form->submit_element = UTF8ToUTF16(string_attr_map["submit_element"]);
124 form->signon_realm = string_attr_map["signon_realm"]; 127 form->signon_realm = string_attr_map["signon_realm"];
125 form->ssl_valid = uint_attr_map["ssl_valid"]; 128 form->ssl_valid = uint_attr_map["ssl_valid"];
126 form->preferred = uint_attr_map["preferred"]; 129 form->preferred = uint_attr_map["preferred"];
127 int64 date_created = 0; 130 int64 date_created = 0;
128 bool date_ok = base::StringToInt64(string_attr_map["date_created"], 131 bool date_ok = base::StringToInt64(string_attr_map["date_created"],
129 &date_created); 132 &date_created);
130 DCHECK(date_ok); 133 DCHECK(date_ok);
131 form->date_created = base::Time::FromTimeT(date_created); 134 form->date_created = base::Time::FromTimeT(date_created);
132 form->blacklisted_by_user = uint_attr_map["blacklisted_by_user"]; 135 form->blacklisted_by_user = uint_attr_map["blacklisted_by_user"];
133 form->scheme = static_cast<PasswordForm::Scheme>(uint_attr_map["scheme"]); 136 form->scheme = static_cast<PasswordForm::Scheme>(uint_attr_map["scheme"]);
134 137
135 return form; 138 return form.Pass();
136 } 139 }
137 140
138 // Parse all the results from the given GList into a PasswordFormList, and free 141 // Parse all the results from the given GList into a PasswordFormList, and free
139 // the GList. PasswordForms are allocated on the heap, and should be deleted by 142 // the GList. PasswordForms are allocated on the heap, and should be deleted by
140 // the consumer. 143 // the consumer. If not empty, |filter_by_signon_realm| is used to filter out
144 // results -- only credentials with signon realms passing the PSL matching
145 // (done by |helper|) against |filter_by_signon_realm| will be kept.
141 void ConvertFormList(GList* found, 146 void ConvertFormList(GList* found,
147 const std::string& filter_by_signon_realm,
148 const PSLMatchingHelper& helper,
142 NativeBackendGnome::PasswordFormList* forms) { 149 NativeBackendGnome::PasswordFormList* forms) {
150 PSLMatchingHelper::PSLDomainMatchMetric psl_domain_match_metric =
151 PSLMatchingHelper::PSL_DOMAIN_MATCH_NONE;
143 for (GList* element = g_list_first(found); element != NULL; 152 for (GList* element = g_list_first(found); element != NULL;
144 element = g_list_next(element)) { 153 element = g_list_next(element)) {
145 GnomeKeyringFound* data = static_cast<GnomeKeyringFound*>(element->data); 154 GnomeKeyringFound* data = static_cast<GnomeKeyringFound*>(element->data);
146 GnomeKeyringAttributeList* attrs = data->attributes; 155 GnomeKeyringAttributeList* attrs = data->attributes;
147 156
148 PasswordForm* form = FormFromAttributes(attrs); 157 scoped_ptr<PasswordForm> form(FormFromAttributes(attrs));
149 if (form) { 158 if (form) {
159 if (!filter_by_signon_realm.empty() &&
160 form->signon_realm != filter_by_signon_realm) {
161 // This is not an exact match, we try PSL matching.
162 if (!(PSLMatchingHelper::IsPublicSuffixDomainMatch(
163 filter_by_signon_realm, form->signon_realm))) {
164 continue;
165 }
166 psl_domain_match_metric = PSLMatchingHelper::PSL_DOMAIN_MATCH_FOUND;
167 form->original_signon_realm = form->signon_realm;
168 }
150 if (data->secret) { 169 if (data->secret) {
151 form->password_value = UTF8ToUTF16(data->secret); 170 form->password_value = UTF8ToUTF16(data->secret);
152 } else { 171 } else {
153 LOG(WARNING) << "Unable to access password from list element!"; 172 LOG(WARNING) << "Unable to access password from list element!";
154 } 173 }
155 forms->push_back(form); 174 forms->push_back(form.release());
156 } else { 175 } else {
157 LOG(WARNING) << "Could not initialize PasswordForm from attributes!"; 176 LOG(WARNING) << "Could not initialize PasswordForm from attributes!";
158 } 177 }
159 } 178 }
179 if (!filter_by_signon_realm.empty()) {
180 UMA_HISTOGRAM_ENUMERATION(
181 "PasswordManager.PslDomainMatchTriggering",
182 helper.IsMatchingEnabled()
183 ? psl_domain_match_metric
184 : PSLMatchingHelper::PSL_DOMAIN_MATCH_DISABLED,
185 PSLMatchingHelper::PSL_DOMAIN_MATCH_COUNT);
186 }
160 } 187 }
161 188
162 // Schema is analagous to the fields in PasswordForm. 189 // Schema is analagous to the fields in PasswordForm.
163 const GnomeKeyringPasswordSchema kGnomeSchema = { 190 const GnomeKeyringPasswordSchema kGnomeSchema = {
164 GNOME_KEYRING_ITEM_GENERIC_SECRET, { 191 GNOME_KEYRING_ITEM_GENERIC_SECRET, {
165 { "origin_url", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 192 { "origin_url", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
166 { "action_url", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 193 { "action_url", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
167 { "username_element", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 194 { "username_element", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
168 { "username_value", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 195 { "username_value", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
169 { "password_element", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, 196 { "password_element", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 270
244 // All these callbacks are called on UI thread. 271 // All these callbacks are called on UI thread.
245 static void OnOperationDone(GnomeKeyringResult result, gpointer data); 272 static void OnOperationDone(GnomeKeyringResult result, gpointer data);
246 273
247 static void OnOperationGetList(GnomeKeyringResult result, GList* list, 274 static void OnOperationGetList(GnomeKeyringResult result, GList* list,
248 gpointer data); 275 gpointer data);
249 276
250 base::WaitableEvent event_; 277 base::WaitableEvent event_;
251 GnomeKeyringResult result_; 278 GnomeKeyringResult result_;
252 NativeBackendGnome::PasswordFormList forms_; 279 NativeBackendGnome::PasswordFormList forms_;
280 // Two additional arguments to OnOperationGetList:
281 // If the credential search is related to a particular form,
282 // |original_signon_realm_| contains the signon realm of that form. It is used
283 // to filter the relevant results out of all the found ones.
284 std::string original_signon_realm_;
285 const PSLMatchingHelper helper_;
253 }; 286 };
254 287
255 void GKRMethod::AddLogin(const PasswordForm& form, const char* app_string) { 288 void GKRMethod::AddLogin(const PasswordForm& form, const char* app_string) {
256 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 289 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
257 time_t date_created = form.date_created.ToTimeT(); 290 time_t date_created = form.date_created.ToTimeT();
258 // If we are asked to save a password with 0 date, use the current time. 291 // If we are asked to save a password with 0 date, use the current time.
259 // We don't want to actually save passwords as though on January 1, 1970. 292 // We don't want to actually save passwords as though on January 1, 1970.
260 if (!date_created) 293 if (!date_created)
261 date_created = time(NULL); 294 date_created = time(NULL);
262 gnome_keyring_store_password( 295 gnome_keyring_store_password(
(...skipping 16 matching lines...) Expand all
279 "date_created", base::Int64ToString(date_created).c_str(), 312 "date_created", base::Int64ToString(date_created).c_str(),
280 "blacklisted_by_user", form.blacklisted_by_user, 313 "blacklisted_by_user", form.blacklisted_by_user,
281 "scheme", form.scheme, 314 "scheme", form.scheme,
282 "application", app_string, 315 "application", app_string,
283 NULL); 316 NULL);
284 } 317 }
285 318
286 void GKRMethod::AddLoginSearch(const PasswordForm& form, 319 void GKRMethod::AddLoginSearch(const PasswordForm& form,
287 const char* app_string) { 320 const char* app_string) {
288 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 321 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
322 original_signon_realm_ = form.signon_realm;
289 // Search GNOME Keyring for matching passwords to update. 323 // Search GNOME Keyring for matching passwords to update.
290 ScopedAttributeList attrs(gnome_keyring_attribute_list_new()); 324 ScopedAttributeList attrs(gnome_keyring_attribute_list_new());
291 AppendString(&attrs, "origin_url", form.origin.spec()); 325 AppendString(&attrs, "origin_url", form.origin.spec());
292 AppendString(&attrs, "username_element", UTF16ToUTF8(form.username_element)); 326 AppendString(&attrs, "username_element", UTF16ToUTF8(form.username_element));
293 AppendString(&attrs, "username_value", UTF16ToUTF8(form.username_value)); 327 AppendString(&attrs, "username_value", UTF16ToUTF8(form.username_value));
294 AppendString(&attrs, "password_element", UTF16ToUTF8(form.password_element)); 328 AppendString(&attrs, "password_element", UTF16ToUTF8(form.password_element));
295 AppendString(&attrs, "submit_element", UTF16ToUTF8(form.submit_element)); 329 AppendString(&attrs, "submit_element", UTF16ToUTF8(form.submit_element));
296 AppendString(&attrs, "signon_realm", form.signon_realm); 330 AppendString(&attrs, "signon_realm", form.signon_realm);
297 AppendString(&attrs, "application", app_string); 331 AppendString(&attrs, "application", app_string);
298 gnome_keyring_find_items(GNOME_KEYRING_ITEM_GENERIC_SECRET, 332 gnome_keyring_find_items(GNOME_KEYRING_ITEM_GENERIC_SECRET,
299 attrs.get(), 333 attrs.get(),
300 OnOperationGetList, 334 OnOperationGetList,
301 /*data=*/this, 335 /*data=*/this,
302 /*destroy_data=*/NULL); 336 /*destroy_data=*/NULL);
303 } 337 }
304 338
305 void GKRMethod::UpdateLoginSearch(const PasswordForm& form, 339 void GKRMethod::UpdateLoginSearch(const PasswordForm& form,
306 const char* app_string) { 340 const char* app_string) {
307 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 341 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
342 original_signon_realm_ = form.signon_realm;
308 // Search GNOME Keyring for matching passwords to update. 343 // Search GNOME Keyring for matching passwords to update.
309 ScopedAttributeList attrs(gnome_keyring_attribute_list_new()); 344 ScopedAttributeList attrs(gnome_keyring_attribute_list_new());
310 AppendString(&attrs, "origin_url", form.origin.spec()); 345 AppendString(&attrs, "origin_url", form.origin.spec());
311 AppendString(&attrs, "username_element", UTF16ToUTF8(form.username_element)); 346 AppendString(&attrs, "username_element", UTF16ToUTF8(form.username_element));
312 AppendString(&attrs, "username_value", UTF16ToUTF8(form.username_value)); 347 AppendString(&attrs, "username_value", UTF16ToUTF8(form.username_value));
313 AppendString(&attrs, "password_element", UTF16ToUTF8(form.password_element)); 348 AppendString(&attrs, "password_element", UTF16ToUTF8(form.password_element));
314 AppendString(&attrs, "signon_realm", form.signon_realm); 349 AppendString(&attrs, "signon_realm", form.signon_realm);
315 AppendString(&attrs, "application", app_string); 350 AppendString(&attrs, "application", app_string);
316 gnome_keyring_find_items(GNOME_KEYRING_ITEM_GENERIC_SECRET, 351 gnome_keyring_find_items(GNOME_KEYRING_ITEM_GENERIC_SECRET,
317 attrs.get(), 352 attrs.get(),
(...skipping 16 matching lines...) Expand all
334 "username_value", UTF16ToUTF8(form.username_value).c_str(), 369 "username_value", UTF16ToUTF8(form.username_value).c_str(),
335 "password_element", UTF16ToUTF8(form.password_element).c_str(), 370 "password_element", UTF16ToUTF8(form.password_element).c_str(),
336 "submit_element", UTF16ToUTF8(form.submit_element).c_str(), 371 "submit_element", UTF16ToUTF8(form.submit_element).c_str(),
337 "signon_realm", form.signon_realm.c_str(), 372 "signon_realm", form.signon_realm.c_str(),
338 "application", app_string, 373 "application", app_string,
339 NULL); 374 NULL);
340 } 375 }
341 376
342 void GKRMethod::GetLogins(const PasswordForm& form, const char* app_string) { 377 void GKRMethod::GetLogins(const PasswordForm& form, const char* app_string) {
343 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 378 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
379 original_signon_realm_ = form.signon_realm;
344 // Search GNOME Keyring for matching passwords. 380 // Search GNOME Keyring for matching passwords.
345 ScopedAttributeList attrs(gnome_keyring_attribute_list_new()); 381 ScopedAttributeList attrs(gnome_keyring_attribute_list_new());
346 AppendString(&attrs, "signon_realm", form.signon_realm); 382 if (!helper_.ShouldPSLDomainMatchingApply(
383 PSLMatchingHelper::GetRegistryControlledDomain(
384 GURL(form.signon_realm)))) {
385 AppendString(&attrs, "signon_realm", form.signon_realm);
386 }
347 AppendString(&attrs, "application", app_string); 387 AppendString(&attrs, "application", app_string);
348 gnome_keyring_find_items(GNOME_KEYRING_ITEM_GENERIC_SECRET, 388 gnome_keyring_find_items(GNOME_KEYRING_ITEM_GENERIC_SECRET,
349 attrs.get(), 389 attrs.get(),
350 OnOperationGetList, 390 OnOperationGetList,
351 /*data=*/this, 391 /*data=*/this,
352 /*destroy_data=*/NULL); 392 /*destroy_data=*/NULL);
353 } 393 }
354 394
355 void GKRMethod::GetLoginsList(uint32_t blacklisted_by_user, 395 void GKRMethod::GetLoginsList(uint32_t blacklisted_by_user,
356 const char* app_string) { 396 const char* app_string) {
357 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 397 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
398 original_signon_realm_.clear();
358 // Search GNOME Keyring for matching passwords. 399 // Search GNOME Keyring for matching passwords.
359 ScopedAttributeList attrs(gnome_keyring_attribute_list_new()); 400 ScopedAttributeList attrs(gnome_keyring_attribute_list_new());
360 AppendUint32(&attrs, "blacklisted_by_user", blacklisted_by_user); 401 AppendUint32(&attrs, "blacklisted_by_user", blacklisted_by_user);
361 AppendString(&attrs, "application", app_string); 402 AppendString(&attrs, "application", app_string);
362 gnome_keyring_find_items(GNOME_KEYRING_ITEM_GENERIC_SECRET, 403 gnome_keyring_find_items(GNOME_KEYRING_ITEM_GENERIC_SECRET,
363 attrs.get(), 404 attrs.get(),
364 OnOperationGetList, 405 OnOperationGetList,
365 /*data=*/this, 406 /*data=*/this,
366 /*destroy_data=*/NULL); 407 /*destroy_data=*/NULL);
367 } 408 }
368 409
369 void GKRMethod::GetAllLogins(const char* app_string) { 410 void GKRMethod::GetAllLogins(const char* app_string) {
370 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 411 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
412 original_signon_realm_.clear();
371 // We need to search for something, otherwise we get no results - so 413 // We need to search for something, otherwise we get no results - so
372 // we search for the fixed application string. 414 // we search for the fixed application string.
373 ScopedAttributeList attrs(gnome_keyring_attribute_list_new()); 415 ScopedAttributeList attrs(gnome_keyring_attribute_list_new());
374 AppendString(&attrs, "application", app_string); 416 AppendString(&attrs, "application", app_string);
375 gnome_keyring_find_items(GNOME_KEYRING_ITEM_GENERIC_SECRET, 417 gnome_keyring_find_items(GNOME_KEYRING_ITEM_GENERIC_SECRET,
376 attrs.get(), 418 attrs.get(),
377 OnOperationGetList, 419 OnOperationGetList,
378 /*data=*/this, 420 /*data=*/this,
379 /*destroy_data=*/NULL); 421 /*destroy_data=*/NULL);
380 } 422 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 method->event_.Signal(); 469 method->event_.Signal();
428 } 470 }
429 471
430 // static 472 // static
431 void GKRMethod::OnOperationGetList(GnomeKeyringResult result, GList* list, 473 void GKRMethod::OnOperationGetList(GnomeKeyringResult result, GList* list,
432 gpointer data) { 474 gpointer data) {
433 GKRMethod* method = static_cast<GKRMethod*>(data); 475 GKRMethod* method = static_cast<GKRMethod*>(data);
434 method->result_ = result; 476 method->result_ = result;
435 method->forms_.clear(); 477 method->forms_.clear();
436 // |list| will be freed after this callback returns, so convert it now. 478 // |list| will be freed after this callback returns, so convert it now.
437 ConvertFormList(list, &method->forms_); 479 ConvertFormList(
480 list, method->original_signon_realm_, method->helper_, &method->forms_);
481 method->original_signon_realm_.clear();
438 method->event_.Signal(); 482 method->event_.Signal();
439 } 483 }
440 484
441 } // namespace 485 } // namespace
442 486
443 NativeBackendGnome::NativeBackendGnome(LocalProfileId id, PrefService* prefs) 487 NativeBackendGnome::NativeBackendGnome(LocalProfileId id, PrefService* prefs)
444 : profile_id_(id), prefs_(prefs) { 488 : profile_id_(id), prefs_(prefs) {
445 // TODO(mdm): after a few more releases, remove the code which is now dead due 489 // TODO(mdm): after a few more releases, remove the code which is now dead due
446 // to the true || here, and simplify this code. We don't do it yet to make it 490 // to the true || here, and simplify this code. We don't do it yet to make it
447 // easier to revert if necessary. 491 // easier to revert if necessary.
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 // Each other profile must be able to migrate the shared data as well, 801 // Each other profile must be able to migrate the shared data as well,
758 // so we must leave it alone. After a few releases, we'll add code to 802 // so we must leave it alone. After a few releases, we'll add code to
759 // delete them, and eventually remove this migration code. 803 // delete them, and eventually remove this migration code.
760 // TODO(mdm): follow through with the plan above. 804 // TODO(mdm): follow through with the plan above.
761 PasswordStoreX::SetPasswordsUseLocalProfileId(prefs_); 805 PasswordStoreX::SetPasswordsUseLocalProfileId(prefs_);
762 } else { 806 } else {
763 // We failed to migrate for some reason. Use the old app string. 807 // We failed to migrate for some reason. Use the old app string.
764 app_string_ = kGnomeKeyringAppString; 808 app_string_ = kGnomeKeyringAppString;
765 } 809 }
766 } 810 }
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | 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