Chromium Code Reviews| Index: ios/chrome/browser/browser_state/chrome_browser_state_impl.h |
| diff --git a/ios/chrome/browser/browser_state/chrome_browser_state_impl.h b/ios/chrome/browser/browser_state/chrome_browser_state_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f419dd27f4e04b23fa573def40953861131edd58 |
| --- /dev/null |
| +++ b/ios/chrome/browser/browser_state/chrome_browser_state_impl.h |
| @@ -0,0 +1,108 @@ |
| +// 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_IMPL_ |
| +#define IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_IMPL_ |
| + |
| +#include "base/gtest_prod_util.h" |
|
droger
2016/02/04 13:56:14
Maybe not needed?
sdefresne
2016/02/04 15:27:41
Removed.
|
| +#include "base/macros.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| +#include "ios/chrome/browser/browser_state/chrome_browser_state_impl_io_data.h" |
| + |
| +namespace ssl_config { |
| +class SSLConfigServiceManager; |
| +} |
| + |
| +namespace syncable_prefs { |
| +class PrefServiceSyncable; |
| +} |
| + |
| +namespace user_prefs { |
| +class PrefRegistrySyncable; |
| +} |
| + |
| +class PrefProxyConfigTracker; |
| + |
| +// This class is the implementation of ChromeBrowserState used for |
| +// non-incognito browsing. |
| +class ChromeBrowserStateImpl : public ios::ChromeBrowserState { |
|
droger
2016/02/04 13:56:14
Not related to this CL, but ChromeBrowserState sho
sdefresne
2016/02/04 15:27:41
Ack (as ios::ChromeBrowserStateManager, ...). I th
|
| + public: |
| + ~ChromeBrowserStateImpl() override; |
| + |
| + // ChromeBrowserState: |
| + ios::ChromeBrowserState* GetOriginalChromeBrowserState() override; |
| + bool HasOffTheRecordChromeBrowserState() const override; |
| + ios::ChromeBrowserState* GetOffTheRecordChromeBrowserState() override; |
| + void DestroyOffTheRecordChromeBrowserState() override; |
| + PrefProxyConfigTracker* GetProxyConfigTracker() override; |
| + net::SSLConfigService* GetSSLConfigService() override; |
| + PrefService* GetPrefs() override; |
| + PrefService* GetOffTheRecordPrefs() override; |
| + ChromeBrowserStateIOData* GetIOData() override; |
| + void ClearNetworkingHistorySince(base::Time time, |
| + const base::Closure& completion) override; |
| + net::URLRequestContextGetter* CreateRequestContext( |
| + ProtocolHandlerMap* protocol_handlers, |
| + URLRequestInterceptorScopedVector request_interceptors) override; |
| + net::URLRequestContextGetter* CreateIsolatedRequestContext( |
| + const base::FilePath& partition_path) override; |
| + |
| + // BrowserState: |
| + bool IsOffTheRecord() const override; |
| + base::FilePath GetStatePath() const override; |
| + |
| + protected: |
| + explicit ChromeBrowserStateImpl(const base::FilePath& path); |
|
droger
2016/02/04 13:56:14
Nit: I think this can be private. No need to be pr
sdefresne
2016/02/04 15:27:40
Made private because all ChromeBrowserStateImpl sh
|
| + |
| + private: |
| + friend class ChromeBrowserStateManagerImpl; |
| + |
| + // Sets the OffTheRecordChromeBrowserState. |
| + void SetOffTheRecordChromeBrowserState( |
| + scoped_ptr<ios::ChromeBrowserState> otr_state); |
| + |
| + base::FilePath state_path_; |
| + |
| + // The incognito ChromeBrowserState instance that is associated with this |
| + // ChromeBrowserState instance. NULL if |GetOffTheRecordChromeBrowserState()| |
| + // has never been called or has not been called since |
| + // |DestroyOffTheRecordChromeBrowserState()|. |
| + scoped_ptr<ios::ChromeBrowserState> otr_state_; |
| + base::FilePath otr_state_path_; |
| + |
| + // !!! BIG HONKING WARNING !!! |
| + // The order of the members below is important. Do not change it unless |
| + // you know what you're doing. Also, if adding a new member here make sure |
| + // that the declaration occurs AFTER things it depends on as destruction |
| + // happens in reverse order of declaration. |
| + |
| + // Keep |prefs_| on top for destruction order because |io_data_| and others |
| + // store pointers to |prefs_| and shall be destructed first. |
| + scoped_refptr<user_prefs::PrefRegistrySyncable> pref_registry_; |
| + scoped_ptr<syncable_prefs::PrefServiceSyncable> prefs_; |
| + scoped_ptr<syncable_prefs::PrefServiceSyncable> otr_prefs_; |
| + scoped_ptr<ChromeBrowserStateImplIOData::Handle> io_data_; |
| + |
| + scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; |
| + scoped_ptr<ssl_config::SSLConfigServiceManager> ssl_config_service_manager_; |
| + |
| + // STOP!!!! DO NOT ADD ANY MORE ITEMS HERE!!!! |
| + // |
| + // Instead, make your Service/Manager/whatever object you're hanging off the |
| + // BrowserState use our BrowserStateKeyedServiceFactory system instead. |
| + // You can find the design document here: |
| + // |
| + // https://sites.google.com/a/chromium.org/dev/developers/design-documents/profile-architecture |
| + // |
| + // and you can read the raw headers here: |
| + // |
| + // components/keyed_service/ios/browser_state_dependency_manager.* |
| + // components/keyed_service/core/keyed_service.h |
| + // components/keyed_service/ios/browser_state_keyed_service_factory.* |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ChromeBrowserStateImpl); |
| +}; |
| + |
| +#endif // IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_IMPL_ |