| 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 #ifndef IOS_CHROME_BROWSER_BROWSER_STATE_BROWSER_STATE_INFO_CACHE_H_ | 5 #ifndef IOS_CHROME_BROWSER_BROWSER_STATE_BROWSER_STATE_INFO_CACHE_H_ |
| 6 #define IOS_CHROME_BROWSER_BROWSER_STATE_BROWSER_STATE_INFO_CACHE_H_ | 6 #define IOS_CHROME_BROWSER_BROWSER_STATE_BROWSER_STATE_INFO_CACHE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <string> | 11 #include <string> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 16 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 17 | 18 |
| 18 namespace base { | 19 namespace base { |
| 19 class DictionaryValue; | 20 class DictionaryValue; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 bool BrowserStateIsAuthErrorAtIndex(size_t index) const; | 58 bool BrowserStateIsAuthErrorAtIndex(size_t index) const; |
| 58 | 59 |
| 59 const base::FilePath& GetUserDataDir() const; | 60 const base::FilePath& GetUserDataDir() const; |
| 60 | 61 |
| 61 // Register cache related preferences in Local State. | 62 // Register cache related preferences in Local State. |
| 62 static void RegisterPrefs(PrefRegistrySimple* registry); | 63 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 const base::DictionaryValue* GetInfoForBrowserStateAtIndex( | 66 const base::DictionaryValue* GetInfoForBrowserStateAtIndex( |
| 66 size_t index) const; | 67 size_t index) const; |
| 67 // Saves the browser state info to a cache and takes ownership of |info|. | 68 // Saves the browser state info to a cache. |
| 68 void SetInfoForBrowserStateAtIndex(size_t index, base::DictionaryValue* info); | 69 void SetInfoForBrowserStateAtIndex( |
| 70 size_t index, |
| 71 std::unique_ptr<base::DictionaryValue> info); |
| 69 | 72 |
| 70 std::string CacheKeyFromBrowserStatePath( | 73 std::string CacheKeyFromBrowserStatePath( |
| 71 const base::FilePath& browser_state_path) const; | 74 const base::FilePath& browser_state_path) const; |
| 72 void AddBrowserStateCacheKey(const std::string& key); | 75 void AddBrowserStateCacheKey(const std::string& key); |
| 73 | 76 |
| 74 PrefService* prefs_; | 77 PrefService* prefs_; |
| 75 std::vector<std::string> sorted_keys_; | 78 std::vector<std::string> sorted_keys_; |
| 76 base::FilePath user_data_dir_; | 79 base::FilePath user_data_dir_; |
| 77 base::ObserverList<BrowserStateInfoCacheObserver, true> observer_list_; | 80 base::ObserverList<BrowserStateInfoCacheObserver, true> observer_list_; |
| 78 | 81 |
| 79 DISALLOW_COPY_AND_ASSIGN(BrowserStateInfoCache); | 82 DISALLOW_COPY_AND_ASSIGN(BrowserStateInfoCache); |
| 80 }; | 83 }; |
| 81 | 84 |
| 82 #endif // IOS_CHROME_BROWSER_BROWSER_STATE_BROWSER_STATE_INFO_CACHE_H_ | 85 #endif // IOS_CHROME_BROWSER_BROWSER_STATE_BROWSER_STATE_INFO_CACHE_H_ |
| OLD | NEW |