| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_IO_DATA_H_ | 5 #ifndef IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_IMPL_IO_DATA_H_ |
| 6 #define IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_IMPL_IO_DATA_H_ | 6 #define IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_IMPL_IO_DATA_H_ |
| 7 | 7 |
| 8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 // These Create*ContextGetter() functions are only exposed because the | 48 // These Create*ContextGetter() functions are only exposed because the |
| 49 // circular relationship between ChromeBrowserState, | 49 // circular relationship between ChromeBrowserState, |
| 50 // ChromeBrowserStateIOData::Handle, and the | 50 // ChromeBrowserStateIOData::Handle, and the |
| 51 // IOSChromeURLRequestContextGetter factories requires ChromeBrowserState be | 51 // IOSChromeURLRequestContextGetter factories requires ChromeBrowserState be |
| 52 // able to call these functions. | 52 // able to call these functions. |
| 53 scoped_refptr<IOSChromeURLRequestContextGetter> | 53 scoped_refptr<IOSChromeURLRequestContextGetter> |
| 54 CreateMainRequestContextGetter(ProtocolHandlerMap* protocol_handlers, | 54 CreateMainRequestContextGetter(ProtocolHandlerMap* protocol_handlers, |
| 55 PrefService* local_state, | 55 PrefService* local_state, |
| 56 IOSChromeIOThread* io_thread) const; | 56 IOSChromeIOThread* io_thread) const; |
| 57 scoped_refptr<IOSChromeURLRequestContextGetter> | |
| 58 CreateIsolatedAppRequestContextGetter( | |
| 59 const base::FilePath& partition_path) const; | |
| 60 | 57 |
| 61 ChromeBrowserStateIOData* io_data() const; | 58 ChromeBrowserStateIOData* io_data() const; |
| 62 | 59 |
| 63 // Deletes all network related data since |time|. It deletes transport | 60 // Deletes all network related data since |time|. It deletes transport |
| 64 // security state since |time| and also deletes HttpServerProperties data. | 61 // security state since |time| and also deletes HttpServerProperties data. |
| 65 // Works asynchronously, however if the |completion| callback is non-null, | 62 // Works asynchronously, however if the |completion| callback is non-null, |
| 66 // it will be posted on the UI thread once the removal process completes. | 63 // it will be posted on the UI thread once the removal process completes. |
| 67 void ClearNetworkingHistorySince(base::Time time, | 64 void ClearNetworkingHistorySince(base::Time time, |
| 68 const base::Closure& completion); | 65 const base::Closure& completion); |
| 69 | 66 |
| 70 private: | 67 private: |
| 71 typedef std::map<base::FilePath, | 68 typedef std::map<base::FilePath, |
| 72 scoped_refptr<IOSChromeURLRequestContextGetter>> | 69 scoped_refptr<IOSChromeURLRequestContextGetter>> |
| 73 IOSChromeURLRequestContextGetterMap; | 70 IOSChromeURLRequestContextGetterMap; |
| 74 | 71 |
| 75 // Lazily initialize ProfileParams. We do this on the calls to | 72 // Lazily initialize ProfileParams. We do this on the calls to |
| 76 // Get*RequestContextGetter(), so we only initialize ProfileParams right | 73 // Get*RequestContextGetter(), so we only initialize ProfileParams right |
| 77 // before posting a task to the IO thread to start using them. This prevents | 74 // before posting a task to the IO thread to start using them. This prevents |
| 78 // objects that are supposed to be deleted on the IO thread, but are created | 75 // objects that are supposed to be deleted on the IO thread, but are created |
| 79 // on the UI thread from being unnecessarily initialized. | 76 // on the UI thread from being unnecessarily initialized. |
| 80 void LazyInitialize() const; | 77 void LazyInitialize() const; |
| 81 | 78 |
| 82 // Collect references to context getters in reverse order, i.e. last item | 79 // Collect references to context getters in reverse order, i.e. last item |
| 83 // will be main request getter. This list is passed to |io_data_| | 80 // will be main request getter. This list is passed to |io_data_| |
| 84 // for invalidation on IO thread. | 81 // for invalidation on IO thread. |
| 85 scoped_ptr<IOSChromeURLRequestContextGetterVector> GetAllContextGetters(); | 82 scoped_ptr<IOSChromeURLRequestContextGetterVector> GetAllContextGetters(); |
| 86 | 83 |
| 87 // The getters will be invalidated on the IO thread before | 84 // The getter will be invalidated on the IO thread before |
| 88 // ChromeBrowserStateIOData instance is deleted. | 85 // ChromeBrowserStateIOData instance is deleted. |
| 89 mutable scoped_refptr<IOSChromeURLRequestContextGetter> | 86 mutable scoped_refptr<IOSChromeURLRequestContextGetter> |
| 90 main_request_context_getter_; | 87 main_request_context_getter_; |
| 91 mutable IOSChromeURLRequestContextGetterMap app_request_context_getter_map_; | |
| 92 ChromeBrowserStateImplIOData* const io_data_; | 88 ChromeBrowserStateImplIOData* const io_data_; |
| 93 | 89 |
| 94 ios::ChromeBrowserState* const browser_state_; | 90 ios::ChromeBrowserState* const browser_state_; |
| 95 | 91 |
| 96 mutable bool initialized_; | 92 mutable bool initialized_; |
| 97 | 93 |
| 98 DISALLOW_COPY_AND_ASSIGN(Handle); | 94 DISALLOW_COPY_AND_ASSIGN(Handle); |
| 99 }; | 95 }; |
| 100 | 96 |
| 101 private: | 97 private: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 112 int cache_max_size; | 108 int cache_max_size; |
| 113 }; | 109 }; |
| 114 | 110 |
| 115 ChromeBrowserStateImplIOData(); | 111 ChromeBrowserStateImplIOData(); |
| 116 ~ChromeBrowserStateImplIOData() override; | 112 ~ChromeBrowserStateImplIOData() override; |
| 117 | 113 |
| 118 void InitializeInternal( | 114 void InitializeInternal( |
| 119 scoped_ptr<IOSChromeNetworkDelegate> chrome_network_delegate, | 115 scoped_ptr<IOSChromeNetworkDelegate> chrome_network_delegate, |
| 120 ProfileParams* profile_params, | 116 ProfileParams* profile_params, |
| 121 ProtocolHandlerMap* protocol_handlers) const override; | 117 ProtocolHandlerMap* protocol_handlers) const override; |
| 122 net::URLRequestContext* InitializeAppRequestContext( | |
| 123 net::URLRequestContext* main_context) const override; | |
| 124 net::URLRequestContext* AcquireIsolatedAppRequestContext( | |
| 125 net::URLRequestContext* main_context) const override; | |
| 126 | 118 |
| 127 // Deletes all network related data since |time|. It deletes transport | 119 // Deletes all network related data since |time|. It deletes transport |
| 128 // security state since |time| and also deletes HttpServerProperties data. | 120 // security state since |time| and also deletes HttpServerProperties data. |
| 129 // Works asynchronously, however if the |completion| callback is non-null, | 121 // Works asynchronously, however if the |completion| callback is non-null, |
| 130 // it will be posted on the UI thread once the removal process completes. | 122 // it will be posted on the UI thread once the removal process completes. |
| 131 void ClearNetworkingHistorySinceOnIOThread(base::Time time, | 123 void ClearNetworkingHistorySinceOnIOThread(base::Time time, |
| 132 const base::Closure& completion); | 124 const base::Closure& completion); |
| 133 | 125 |
| 134 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyNetworkDelegate> | 126 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyNetworkDelegate> |
| 135 network_delegate_; | 127 network_delegate_; |
| 136 | 128 |
| 137 // Lazy initialization params. | 129 // Lazy initialization params. |
| 138 mutable scoped_ptr<LazyParams> lazy_params_; | 130 mutable scoped_ptr<LazyParams> lazy_params_; |
| 139 | 131 |
| 140 mutable scoped_refptr<JsonPrefStore> network_json_store_; | 132 mutable scoped_refptr<JsonPrefStore> network_json_store_; |
| 141 | 133 |
| 142 mutable scoped_ptr<net::HttpNetworkSession> http_network_session_; | 134 mutable scoped_ptr<net::HttpNetworkSession> http_network_session_; |
| 143 mutable scoped_ptr<net::HttpTransactionFactory> main_http_factory_; | 135 mutable scoped_ptr<net::HttpTransactionFactory> main_http_factory_; |
| 144 | 136 |
| 145 // Same as |ChromeBrowserState::http_server_properties_|, owned there to | 137 // Same as |ChromeBrowserState::http_server_properties_|, owned there to |
| 146 // maintain destruction ordering. | 138 // maintain destruction ordering. |
| 147 mutable net::HttpServerPropertiesManager* http_server_properties_manager_; | 139 mutable net::HttpServerPropertiesManager* http_server_properties_manager_; |
| 148 | 140 |
| 149 mutable scoped_ptr<net::URLRequestJobFactory> main_job_factory_; | 141 mutable scoped_ptr<net::URLRequestJobFactory> main_job_factory_; |
| 150 | 142 |
| 151 mutable scoped_ptr<net::SdchManager> sdch_manager_; | 143 mutable scoped_ptr<net::SdchManager> sdch_manager_; |
| 152 mutable scoped_ptr<net::SdchOwner> sdch_policy_; | 144 mutable scoped_ptr<net::SdchOwner> sdch_policy_; |
| 153 | 145 |
| 154 // Parameters needed for isolated apps. | |
| 155 base::FilePath profile_path_; | 146 base::FilePath profile_path_; |
| 156 int app_cache_max_size_; | |
| 157 | 147 |
| 158 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserStateImplIOData); | 148 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserStateImplIOData); |
| 159 }; | 149 }; |
| 160 | 150 |
| 161 #endif // IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_IMPL_IO_DATA_H_ | 151 #endif // IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_IMPL_IO_DATA_H_ |
| OLD | NEW |