| Index: ios/chrome/browser/browser_state/browser_state_info_cache.cc
|
| diff --git a/ios/chrome/browser/browser_state/browser_state_info_cache.cc b/ios/chrome/browser/browser_state/browser_state_info_cache.cc
|
| index 28041e9145997f46e981daa4ade72aa337858029..54911ed597c9e37365eda4f2a736633d4b47cf71 100644
|
| --- a/ios/chrome/browser/browser_state/browser_state_info_cache.cc
|
| +++ b/ios/chrome/browser/browser_state/browser_state_info_cache.cc
|
| @@ -8,9 +8,11 @@
|
|
|
| #include <algorithm>
|
| #include <memory>
|
| +#include <utility>
|
|
|
| #include "base/i18n/case_conversion.h"
|
| #include "base/logging.h"
|
| +#include "base/memory/ptr_util.h"
|
| #include "base/values.h"
|
| #include "components/prefs/pref_registry_simple.h"
|
| #include "components/prefs/scoped_user_pref_update.h"
|
| @@ -48,10 +50,10 @@ void BrowserStateInfoCache::AddBrowserState(
|
| DictionaryPrefUpdate update(prefs_, prefs::kBrowserStateInfoCache);
|
| base::DictionaryValue* cache = update.Get();
|
|
|
| - std::unique_ptr<base::DictionaryValue> info(new base::DictionaryValue);
|
| + auto info = base::MakeUnique<base::DictionaryValue>();
|
| info->SetString(kGAIAIdKey, gaia_id);
|
| info->SetString(kUserNameKey, user_name);
|
| - cache->SetWithoutPathExpansion(key, info.release());
|
| + cache->SetWithoutPathExpansion(key, std::move(info));
|
| AddBrowserStateCacheKey(key);
|
|
|
| for (auto& observer : observer_list_)
|
| @@ -148,13 +150,12 @@ void BrowserStateInfoCache::SetAuthInfoOfBrowserStateAtIndex(
|
| }
|
|
|
| std::unique_ptr<base::DictionaryValue> info(
|
| - GetInfoForBrowserStateAtIndex(index)->DeepCopy());
|
| + GetInfoForBrowserStateAtIndex(index)->CreateDeepCopy());
|
|
|
| info->SetString(kGAIAIdKey, gaia_id);
|
| info->SetString(kUserNameKey, user_name);
|
|
|
| - // This takes ownership of |info|.
|
| - SetInfoForBrowserStateAtIndex(index, info.release());
|
| + SetInfoForBrowserStateAtIndex(index, std::move(info));
|
| }
|
|
|
| void BrowserStateInfoCache::SetBrowserStateIsAuthErrorAtIndex(size_t index,
|
| @@ -163,10 +164,9 @@ void BrowserStateInfoCache::SetBrowserStateIsAuthErrorAtIndex(size_t index,
|
| return;
|
|
|
| std::unique_ptr<base::DictionaryValue> info(
|
| - GetInfoForBrowserStateAtIndex(index)->DeepCopy());
|
| + GetInfoForBrowserStateAtIndex(index)->CreateDeepCopy());
|
| info->SetBoolean(kIsAuthErrorKey, value);
|
| - // This takes ownership of |info|.
|
| - SetInfoForBrowserStateAtIndex(index, info.release());
|
| + SetInfoForBrowserStateAtIndex(index, std::move(info));
|
| }
|
|
|
| const base::FilePath& BrowserStateInfoCache::GetUserDataDir() const {
|
| @@ -190,10 +190,10 @@ BrowserStateInfoCache::GetInfoForBrowserStateAtIndex(size_t index) const {
|
|
|
| void BrowserStateInfoCache::SetInfoForBrowserStateAtIndex(
|
| size_t index,
|
| - base::DictionaryValue* info) {
|
| + std::unique_ptr<base::DictionaryValue> info) {
|
| DictionaryPrefUpdate update(prefs_, prefs::kBrowserStateInfoCache);
|
| base::DictionaryValue* cache = update.Get();
|
| - cache->SetWithoutPathExpansion(sorted_keys_[index], info);
|
| + cache->SetWithoutPathExpansion(sorted_keys_[index], std::move(info));
|
| }
|
|
|
| std::string BrowserStateInfoCache::CacheKeyFromBrowserStatePath(
|
|
|