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