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

Side by Side Diff: components/signin/core/browser/account_tracker_service.cc

Issue 2740143002: Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Rebase Created 3 years, 8 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
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/signin/core/browser/account_tracker_service.h" 5 #include "components/signin/core/browser/account_tracker_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 if (dict->GetString(kAccountPictureURLPath, &value)) 343 if (dict->GetString(kAccountPictureURLPath, &value))
344 state.info.picture_url = base::UTF16ToUTF8(value); 344 state.info.picture_url = base::UTF16ToUTF8(value);
345 345
346 bool is_child_account = false; 346 bool is_child_account = false;
347 // Migrate deprecated service flag preference. 347 // Migrate deprecated service flag preference.
348 const base::ListValue* service_flags_list; 348 const base::ListValue* service_flags_list;
349 if (dict->GetList(kAccountServiceFlagsPath, &service_flags_list)) { 349 if (dict->GetList(kAccountServiceFlagsPath, &service_flags_list)) {
350 contains_deprecated_service_flags = true; 350 contains_deprecated_service_flags = true;
351 std::string flag_string; 351 std::string flag_string;
352 for (const auto& flag : *service_flags_list) { 352 for (const auto& flag : *service_flags_list) {
353 if (flag->GetAsString(&flag_string) && 353 if (flag.GetAsString(&flag_string) &&
354 flag_string == kChildAccountServiceFlag) { 354 flag_string == kChildAccountServiceFlag) {
355 is_child_account = true; 355 is_child_account = true;
356 break; 356 break;
357 } 357 }
358 } 358 }
359 state.info.is_child_account = is_child_account; 359 state.info.is_child_account = is_child_account;
360 } 360 }
361 if (dict->GetBoolean(kAccountChildAccountStatusPath, &is_child_account)) 361 if (dict->GetBoolean(kAccountChildAccountStatusPath, &is_child_account))
362 state.info.is_child_account = is_child_account; 362 state.info.is_child_account = is_child_account;
363 363
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 if (update->GetDictionary(i, &dict)) { 400 if (update->GetDictionary(i, &dict)) {
401 base::string16 value; 401 base::string16 value;
402 if (dict->GetString(kAccountKeyPath, &value) && value == account_id_16) 402 if (dict->GetString(kAccountKeyPath, &value) && value == account_id_16)
403 break; 403 break;
404 } 404 }
405 } 405 }
406 406
407 if (!dict) { 407 if (!dict) {
408 dict = new base::DictionaryValue(); 408 dict = new base::DictionaryValue();
409 update->Append(base::WrapUnique(dict)); 409 update->Append(base::WrapUnique(dict));
410 // |dict| is invalidated at this point, so it needs to be reset.
411 update->GetDictionary(update->GetSize() - 1, &dict);
410 dict->SetString(kAccountKeyPath, account_id_16); 412 dict->SetString(kAccountKeyPath, account_id_16);
411 } 413 }
412 414
413 dict->SetString(kAccountEmailPath, state.info.email); 415 dict->SetString(kAccountEmailPath, state.info.email);
414 dict->SetString(kAccountGaiaPath, state.info.gaia); 416 dict->SetString(kAccountGaiaPath, state.info.gaia);
415 dict->SetString(kAccountHostedDomainPath, state.info.hosted_domain); 417 dict->SetString(kAccountHostedDomainPath, state.info.hosted_domain);
416 dict->SetString(kAccountFullNamePath, state.info.full_name); 418 dict->SetString(kAccountFullNamePath, state.info.full_name);
417 dict->SetString(kAccountGivenNamePath, state.info.given_name); 419 dict->SetString(kAccountGivenNamePath, state.info.given_name);
418 dict->SetString(kAccountLocalePath, state.info.locale); 420 dict->SetString(kAccountLocalePath, state.info.locale);
419 dict->SetString(kAccountPictureURLPath, state.info.picture_url); 421 dict->SetString(kAccountPictureURLPath, state.info.picture_url);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 NotifyAccountUpdated(state); 502 NotifyAccountUpdated(state);
501 503
502 SaveToPrefs(state); 504 SaveToPrefs(state);
503 } 505 }
504 return info.account_id; 506 return info.account_id;
505 } 507 }
506 508
507 void AccountTrackerService::RemoveAccount(const std::string& account_id) { 509 void AccountTrackerService::RemoveAccount(const std::string& account_id) {
508 StopTrackingAccount(account_id); 510 StopTrackingAccount(account_id);
509 } 511 }
OLDNEW
« no previous file with comments | « components/search_engines/template_url_data_util.cc ('k') | components/ssl_config/ssl_config_service_manager_pref.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698