| 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_IMPL_ | 5 #ifndef IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_IMPL_ |
| 6 #define IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_IMPL_ | 6 #define IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_IMPL_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 11 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 11 #include "ios/chrome/browser/browser_state/chrome_browser_state_impl_io_data.h" | 12 #include "ios/chrome/browser/browser_state/chrome_browser_state_impl_io_data.h" |
| 12 | 13 |
| 13 namespace ssl_config { | 14 namespace ssl_config { |
| 14 class SSLConfigServiceManager; | 15 class SSLConfigServiceManager; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace syncable_prefs { | 18 namespace syncable_prefs { |
| 18 class PrefServiceSyncable; | 19 class PrefServiceSyncable; |
| 19 } | 20 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 bool IsOffTheRecord() const override; | 53 bool IsOffTheRecord() const override; |
| 53 base::FilePath GetStatePath() const override; | 54 base::FilePath GetStatePath() const override; |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 friend class ChromeBrowserStateManagerImpl; | 57 friend class ChromeBrowserStateManagerImpl; |
| 57 | 58 |
| 58 explicit ChromeBrowserStateImpl(const base::FilePath& path); | 59 explicit ChromeBrowserStateImpl(const base::FilePath& path); |
| 59 | 60 |
| 60 // Sets the OffTheRecordChromeBrowserState. | 61 // Sets the OffTheRecordChromeBrowserState. |
| 61 void SetOffTheRecordChromeBrowserState( | 62 void SetOffTheRecordChromeBrowserState( |
| 62 scoped_ptr<ios::ChromeBrowserState> otr_state); | 63 std::unique_ptr<ios::ChromeBrowserState> otr_state); |
| 63 | 64 |
| 64 base::FilePath state_path_; | 65 base::FilePath state_path_; |
| 65 | 66 |
| 66 // The incognito ChromeBrowserState instance that is associated with this | 67 // The incognito ChromeBrowserState instance that is associated with this |
| 67 // ChromeBrowserState instance. NULL if |GetOffTheRecordChromeBrowserState()| | 68 // ChromeBrowserState instance. NULL if |GetOffTheRecordChromeBrowserState()| |
| 68 // has never been called or has not been called since | 69 // has never been called or has not been called since |
| 69 // |DestroyOffTheRecordChromeBrowserState()|. | 70 // |DestroyOffTheRecordChromeBrowserState()|. |
| 70 scoped_ptr<ios::ChromeBrowserState> otr_state_; | 71 std::unique_ptr<ios::ChromeBrowserState> otr_state_; |
| 71 base::FilePath otr_state_path_; | 72 base::FilePath otr_state_path_; |
| 72 | 73 |
| 73 // !!! BIG HONKING WARNING !!! | 74 // !!! BIG HONKING WARNING !!! |
| 74 // The order of the members below is important. Do not change it unless | 75 // The order of the members below is important. Do not change it unless |
| 75 // you know what you're doing. Also, if adding a new member here make sure | 76 // you know what you're doing. Also, if adding a new member here make sure |
| 76 // that the declaration occurs AFTER things it depends on as destruction | 77 // that the declaration occurs AFTER things it depends on as destruction |
| 77 // happens in reverse order of declaration. | 78 // happens in reverse order of declaration. |
| 78 | 79 |
| 79 // Keep |prefs_| on top for destruction order because |io_data_| and others | 80 // Keep |prefs_| on top for destruction order because |io_data_| and others |
| 80 // store pointers to |prefs_| and shall be destructed first. | 81 // store pointers to |prefs_| and shall be destructed first. |
| 81 scoped_refptr<user_prefs::PrefRegistrySyncable> pref_registry_; | 82 scoped_refptr<user_prefs::PrefRegistrySyncable> pref_registry_; |
| 82 scoped_ptr<syncable_prefs::PrefServiceSyncable> prefs_; | 83 std::unique_ptr<syncable_prefs::PrefServiceSyncable> prefs_; |
| 83 scoped_ptr<syncable_prefs::PrefServiceSyncable> otr_prefs_; | 84 std::unique_ptr<syncable_prefs::PrefServiceSyncable> otr_prefs_; |
| 84 scoped_ptr<ChromeBrowserStateImplIOData::Handle> io_data_; | 85 std::unique_ptr<ChromeBrowserStateImplIOData::Handle> io_data_; |
| 85 | 86 |
| 86 scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; | 87 std::unique_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; |
| 87 scoped_ptr<ssl_config::SSLConfigServiceManager> ssl_config_service_manager_; | 88 std::unique_ptr<ssl_config::SSLConfigServiceManager> |
| 89 ssl_config_service_manager_; |
| 88 | 90 |
| 89 // STOP!!!! DO NOT ADD ANY MORE ITEMS HERE!!!! | 91 // STOP!!!! DO NOT ADD ANY MORE ITEMS HERE!!!! |
| 90 // | 92 // |
| 91 // Instead, make your Service/Manager/whatever object you're hanging off the | 93 // Instead, make your Service/Manager/whatever object you're hanging off the |
| 92 // BrowserState use our BrowserStateKeyedServiceFactory system instead. | 94 // BrowserState use our BrowserStateKeyedServiceFactory system instead. |
| 93 // You can find the design document here: | 95 // You can find the design document here: |
| 94 // | 96 // |
| 95 // https://sites.google.com/a/chromium.org/dev/developers/design-documents/p
rofile-architecture | 97 // https://sites.google.com/a/chromium.org/dev/developers/design-documents/p
rofile-architecture |
| 96 // | 98 // |
| 97 // and you can read the raw headers here: | 99 // and you can read the raw headers here: |
| 98 // | 100 // |
| 99 // components/keyed_service/ios/browser_state_dependency_manager.* | 101 // components/keyed_service/ios/browser_state_dependency_manager.* |
| 100 // components/keyed_service/core/keyed_service.h | 102 // components/keyed_service/core/keyed_service.h |
| 101 // components/keyed_service/ios/browser_state_keyed_service_factory.* | 103 // components/keyed_service/ios/browser_state_keyed_service_factory.* |
| 102 | 104 |
| 103 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserStateImpl); | 105 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserStateImpl); |
| 104 }; | 106 }; |
| 105 | 107 |
| 106 #endif // IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_IMPL_ | 108 #endif // IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_IMPL_ |
| OLD | NEW |