Chromium Code Reviews| 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_IMPL_ | |
| 6 #define IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_IMPL_ | |
| 7 | |
| 8 #include "base/gtest_prod_util.h" | |
|
droger
2016/02/04 13:56:14
Maybe not needed?
sdefresne
2016/02/04 15:27:41
Removed.
| |
| 9 #include "base/macros.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | |
| 12 #include "ios/chrome/browser/browser_state/chrome_browser_state_impl_io_data.h" | |
| 13 | |
| 14 namespace ssl_config { | |
| 15 class SSLConfigServiceManager; | |
| 16 } | |
| 17 | |
| 18 namespace syncable_prefs { | |
| 19 class PrefServiceSyncable; | |
| 20 } | |
| 21 | |
| 22 namespace user_prefs { | |
| 23 class PrefRegistrySyncable; | |
| 24 } | |
| 25 | |
| 26 class PrefProxyConfigTracker; | |
| 27 | |
| 28 // This class is the implementation of ChromeBrowserState used for | |
| 29 // non-incognito browsing. | |
| 30 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
| |
| 31 public: | |
| 32 ~ChromeBrowserStateImpl() override; | |
| 33 | |
| 34 // ChromeBrowserState: | |
| 35 ios::ChromeBrowserState* GetOriginalChromeBrowserState() override; | |
| 36 bool HasOffTheRecordChromeBrowserState() const override; | |
| 37 ios::ChromeBrowserState* GetOffTheRecordChromeBrowserState() override; | |
| 38 void DestroyOffTheRecordChromeBrowserState() override; | |
| 39 PrefProxyConfigTracker* GetProxyConfigTracker() override; | |
| 40 net::SSLConfigService* GetSSLConfigService() override; | |
| 41 PrefService* GetPrefs() override; | |
| 42 PrefService* GetOffTheRecordPrefs() override; | |
| 43 ChromeBrowserStateIOData* GetIOData() override; | |
| 44 void ClearNetworkingHistorySince(base::Time time, | |
| 45 const base::Closure& completion) override; | |
| 46 net::URLRequestContextGetter* CreateRequestContext( | |
| 47 ProtocolHandlerMap* protocol_handlers, | |
| 48 URLRequestInterceptorScopedVector request_interceptors) override; | |
| 49 net::URLRequestContextGetter* CreateIsolatedRequestContext( | |
| 50 const base::FilePath& partition_path) override; | |
| 51 | |
| 52 // BrowserState: | |
| 53 bool IsOffTheRecord() const override; | |
| 54 base::FilePath GetStatePath() const override; | |
| 55 | |
| 56 protected: | |
| 57 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
| |
| 58 | |
| 59 private: | |
| 60 friend class ChromeBrowserStateManagerImpl; | |
| 61 | |
| 62 // Sets the OffTheRecordChromeBrowserState. | |
| 63 void SetOffTheRecordChromeBrowserState( | |
| 64 scoped_ptr<ios::ChromeBrowserState> otr_state); | |
| 65 | |
| 66 base::FilePath state_path_; | |
| 67 | |
| 68 // The incognito ChromeBrowserState instance that is associated with this | |
| 69 // ChromeBrowserState instance. NULL if |GetOffTheRecordChromeBrowserState()| | |
| 70 // has never been called or has not been called since | |
| 71 // |DestroyOffTheRecordChromeBrowserState()|. | |
| 72 scoped_ptr<ios::ChromeBrowserState> otr_state_; | |
| 73 base::FilePath otr_state_path_; | |
| 74 | |
| 75 // !!! BIG HONKING WARNING !!! | |
| 76 // The order of the members below is important. Do not change it unless | |
| 77 // you know what you're doing. Also, if adding a new member here make sure | |
| 78 // that the declaration occurs AFTER things it depends on as destruction | |
| 79 // happens in reverse order of declaration. | |
| 80 | |
| 81 // Keep |prefs_| on top for destruction order because |io_data_| and others | |
| 82 // store pointers to |prefs_| and shall be destructed first. | |
| 83 scoped_refptr<user_prefs::PrefRegistrySyncable> pref_registry_; | |
| 84 scoped_ptr<syncable_prefs::PrefServiceSyncable> prefs_; | |
| 85 scoped_ptr<syncable_prefs::PrefServiceSyncable> otr_prefs_; | |
| 86 scoped_ptr<ChromeBrowserStateImplIOData::Handle> io_data_; | |
| 87 | |
| 88 scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; | |
| 89 scoped_ptr<ssl_config::SSLConfigServiceManager> ssl_config_service_manager_; | |
| 90 | |
| 91 // STOP!!!! DO NOT ADD ANY MORE ITEMS HERE!!!! | |
| 92 // | |
| 93 // Instead, make your Service/Manager/whatever object you're hanging off the | |
| 94 // BrowserState use our BrowserStateKeyedServiceFactory system instead. | |
| 95 // You can find the design document here: | |
| 96 // | |
| 97 // https://sites.google.com/a/chromium.org/dev/developers/design-documents/p rofile-architecture | |
| 98 // | |
| 99 // and you can read the raw headers here: | |
| 100 // | |
| 101 // components/keyed_service/ios/browser_state_dependency_manager.* | |
| 102 // components/keyed_service/core/keyed_service.h | |
| 103 // components/keyed_service/ios/browser_state_keyed_service_factory.* | |
| 104 | |
| 105 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserStateImpl); | |
| 106 }; | |
| 107 | |
| 108 #endif // IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_IMPL_ | |
| OLD | NEW |