| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/browser_state/browser_state_info_cache.h" | 5 #include "ios/chrome/browser/browser_state/browser_state_info_cache.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "base/i18n/case_conversion.h" | 11 #include "base/i18n/case_conversion.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/prefs/pref_registry_simple.h" | |
| 15 #include "base/prefs/scoped_user_pref_update.h" | |
| 16 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "components/prefs/pref_registry_simple.h" |
| 16 #include "components/prefs/scoped_user_pref_update.h" |
| 17 #include "ios/chrome/browser/browser_state/browser_state_info_cache_observer.h" | 17 #include "ios/chrome/browser/browser_state/browser_state_info_cache_observer.h" |
| 18 #include "ios/chrome/browser/pref_names.h" | 18 #include "ios/chrome/browser/pref_names.h" |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 const char kGAIAIdKey[] = "gaia_id"; | 21 const char kGAIAIdKey[] = "gaia_id"; |
| 22 const char kIsAuthErrorKey[] = "is_auth_error"; | 22 const char kIsAuthErrorKey[] = "is_auth_error"; |
| 23 const char kUserNameKey[] = "user_name"; | 23 const char kUserNameKey[] = "user_name"; |
| 24 } | 24 } |
| 25 | 25 |
| 26 BrowserStateInfoCache::BrowserStateInfoCache( | 26 BrowserStateInfoCache::BrowserStateInfoCache( |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 const base::FilePath& browser_state_path) const { | 200 const base::FilePath& browser_state_path) const { |
| 201 DCHECK(user_data_dir_ == browser_state_path.DirName()); | 201 DCHECK(user_data_dir_ == browser_state_path.DirName()); |
| 202 base::FilePath base_name = browser_state_path.BaseName(); | 202 base::FilePath base_name = browser_state_path.BaseName(); |
| 203 return base_name.MaybeAsASCII(); | 203 return base_name.MaybeAsASCII(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 void BrowserStateInfoCache::AddBrowserStateCacheKey(const std::string& key) { | 206 void BrowserStateInfoCache::AddBrowserStateCacheKey(const std::string& key) { |
| 207 sorted_keys_.insert( | 207 sorted_keys_.insert( |
| 208 std::upper_bound(sorted_keys_.begin(), sorted_keys_.end(), key), key); | 208 std::upper_bound(sorted_keys_.begin(), sorted_keys_.end(), key), key); |
| 209 } | 209 } |
| OLD | NEW |