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