| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CHROME_BROWSER_STATE_MANAGER_IMPL_H_ | 5 #ifndef IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_MANAGER_IMPL_H_ |
| 6 #define IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_MANAGER_IMPL_H_ | 6 #define IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_MANAGER_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
| 9 | 10 |
| 10 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "ios/chrome/browser/browser_state/browser_state_info_cache.h" | 13 #include "ios/chrome/browser/browser_state/browser_state_info_cache.h" |
| 14 #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" | 14 #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" |
| 15 | 15 |
| 16 class ChromeBrowserStateImpl; | 16 class ChromeBrowserStateImpl; |
| 17 | 17 |
| 18 // ChromeBrowserStateManager implementation. | 18 // ChromeBrowserStateManager implementation. |
| 19 class ChromeBrowserStateManagerImpl : public ios::ChromeBrowserStateManager { | 19 class ChromeBrowserStateManagerImpl : public ios::ChromeBrowserStateManager { |
| 20 public: | 20 public: |
| 21 ChromeBrowserStateManagerImpl(); | 21 ChromeBrowserStateManagerImpl(); |
| 22 ~ChromeBrowserStateManagerImpl() override; | 22 ~ChromeBrowserStateManagerImpl() override; |
| 23 | 23 |
| 24 // ChromeBrowserStateManager: | 24 // ChromeBrowserStateManager: |
| 25 ios::ChromeBrowserState* GetLastUsedBrowserState() override; | 25 ios::ChromeBrowserState* GetLastUsedBrowserState() override; |
| 26 ios::ChromeBrowserState* GetBrowserState(const base::FilePath& path) override; | 26 ios::ChromeBrowserState* GetBrowserState(const base::FilePath& path) override; |
| 27 BrowserStateInfoCache* GetBrowserStateInfoCache() override; | 27 BrowserStateInfoCache* GetBrowserStateInfoCache() override; |
| 28 std::vector<ios::ChromeBrowserState*> GetLoadedBrowserStates() override; | 28 std::vector<ios::ChromeBrowserState*> GetLoadedBrowserStates() override; |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 using ChromeBrowserStateImplPathMap = | 31 using ChromeBrowserStateImplPathMap = |
| 32 std::map<base::FilePath, scoped_ptr<ChromeBrowserStateImpl>>; | 32 std::map<base::FilePath, std::unique_ptr<ChromeBrowserStateImpl>>; |
| 33 | 33 |
| 34 // Get the path of the last used browser state, or if that's undefined, the | 34 // Get the path of the last used browser state, or if that's undefined, the |
| 35 // default browser state. | 35 // default browser state. |
| 36 base::FilePath GetLastUsedBrowserStateDir( | 36 base::FilePath GetLastUsedBrowserStateDir( |
| 37 const base::FilePath& user_data_dir); | 37 const base::FilePath& user_data_dir); |
| 38 | 38 |
| 39 // Final initialization of the browser state. | 39 // Final initialization of the browser state. |
| 40 void DoFinalInit(ios::ChromeBrowserState* browser_state); | 40 void DoFinalInit(ios::ChromeBrowserState* browser_state); |
| 41 void DoFinalInitForServices(ios::ChromeBrowserState* browser_state); | 41 void DoFinalInitForServices(ios::ChromeBrowserState* browser_state); |
| 42 | 42 |
| 43 // Adds |browser_state| to the browser state info cache if it hasn't been | 43 // Adds |browser_state| to the browser state info cache if it hasn't been |
| 44 // added yet. | 44 // added yet. |
| 45 void AddBrowserStateToCache(ios::ChromeBrowserState* browser_state); | 45 void AddBrowserStateToCache(ios::ChromeBrowserState* browser_state); |
| 46 | 46 |
| 47 // Holds the ChromeBrowserStateImpl instances that this instance has created. | 47 // Holds the ChromeBrowserStateImpl instances that this instance has created. |
| 48 ChromeBrowserStateImplPathMap browser_states_; | 48 ChromeBrowserStateImplPathMap browser_states_; |
| 49 scoped_ptr<BrowserStateInfoCache> browser_state_info_cache_; | 49 std::unique_ptr<BrowserStateInfoCache> browser_state_info_cache_; |
| 50 | 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserStateManagerImpl); | 51 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserStateManagerImpl); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 #endif // IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_MANAGER_IMPL_H_ | 54 #endif // IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_MANAGER_IMPL_H_ |
| OLD | NEW |