Chromium Code Reviews| Index: ios/chrome/browser/browser_state/chrome_browser_state_manager_impl.h |
| diff --git a/ios/chrome/browser/browser_state/chrome_browser_state_manager_impl.h b/ios/chrome/browser/browser_state/chrome_browser_state_manager_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d51eb1b9087b2be1fd3bfad80063648c8553b389 |
| --- /dev/null |
| +++ b/ios/chrome/browser/browser_state/chrome_browser_state_manager_impl.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_MANAGER_IMPL_H_ |
| +#define IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_MANAGER_IMPL_H_ |
| + |
| +#include <map> |
| + |
| +#include "base/files/file_path.h" |
| +#include "base/macros.h" |
| +#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.
|
| +#include "ios/chrome/browser/browser_state/browser_state_info_cache.h" |
| +#include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" |
| + |
| +class ChromeBrowserStateImpl; |
| + |
| +// ChromeBrowserStateManager implementation. |
| +class ChromeBrowserStateManagerImpl : public ios::ChromeBrowserStateManager { |
| + public: |
| + ChromeBrowserStateManagerImpl(); |
| + ~ChromeBrowserStateManagerImpl() override; |
| + |
| + // ChromeBrowserStateManager: |
| + ios::ChromeBrowserState* GetLastUsedBrowserState() override; |
| + ios::ChromeBrowserState* GetBrowserState(const base::FilePath& path) override; |
| + BrowserStateInfoCache* GetBrowserStateInfoCache() override; |
| + std::vector<ios::ChromeBrowserState*> GetLoadedBrowserStates() override; |
| + |
| + private: |
| + using ChromeBrowserStateImplPathMap = |
| + std::map<base::FilePath, scoped_ptr<ChromeBrowserStateImpl>>; |
| + |
| + // Get the path of the last used browser state, or if that's undefined, the |
| + // default browser state. |
| + base::FilePath GetLastUsedBrowserStateDir( |
| + const base::FilePath& user_data_dir); |
| + |
| + // Final initialization of the browser state. |
| + void DoFinalInit(ios::ChromeBrowserState* browser_state); |
| + void DoFinalInitForServices(ios::ChromeBrowserState* browser_state); |
| + |
| + // Adds |browser_state| to the browser state info cache if it hasn't been |
| + // added yet. |
| + void AddBrowserStateToCache(ios::ChromeBrowserState* browser_state); |
| + |
| + // Holds the ChromeBrowserStateImpl instances that this instance has created. |
| + ChromeBrowserStateImplPathMap browser_states_; |
| + scoped_ptr<BrowserStateInfoCache> browser_state_info_cache_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ChromeBrowserStateManagerImpl); |
| +}; |
| + |
| +#endif // IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_MANAGER_IMPL_H_ |