OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ |
6 #define CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 class ProfileImplIOData : public ProfileIOData { | 30 class ProfileImplIOData : public ProfileIOData { |
31 public: | 31 public: |
32 class Handle { | 32 class Handle { |
33 public: | 33 public: |
34 explicit Handle(Profile* profile); | 34 explicit Handle(Profile* profile); |
35 ~Handle(); | 35 ~Handle(); |
36 | 36 |
37 // Init() must be called before ~Handle(). It records most of the | 37 // Init() must be called before ~Handle(). It records most of the |
38 // parameters needed to construct a ChromeURLRequestContextGetter. | 38 // parameters needed to construct a ChromeURLRequestContextGetter. |
39 void Init(const base::FilePath& cookie_path, | 39 void Init(const base::FilePath& server_bound_cert_path, |
40 const base::FilePath& server_bound_cert_path, | |
41 const base::FilePath& cache_path, | 40 const base::FilePath& cache_path, |
42 int cache_max_size, | 41 int cache_max_size, |
43 const base::FilePath& media_cache_path, | 42 const base::FilePath& media_cache_path, |
44 int media_cache_max_size, | 43 int media_cache_max_size, |
45 const base::FilePath& extensions_cookie_path, | |
46 const base::FilePath& profile_path, | 44 const base::FilePath& profile_path, |
47 const base::FilePath& infinite_cache_path, | 45 const base::FilePath& infinite_cache_path, |
48 chrome_browser_net::Predictor* predictor, | 46 chrome_browser_net::Predictor* predictor, |
49 bool restore_old_session_cookies, | |
50 quota::SpecialStoragePolicy* special_storage_policy); | 47 quota::SpecialStoragePolicy* special_storage_policy); |
51 | 48 |
52 // These Create*ContextGetter() functions are only exposed because the | 49 // These Create*ContextGetter() functions are only exposed because the |
53 // circular relationship between Profile, ProfileIOData::Handle, and the | 50 // circular relationship between Profile, ProfileIOData::Handle, and the |
54 // ChromeURLRequestContextGetter factories requires Profile be able to call | 51 // ChromeURLRequestContextGetter factories requires Profile be able to call |
55 // these functions. | 52 // these functions. |
56 scoped_refptr<ChromeURLRequestContextGetter> | 53 scoped_refptr<ChromeURLRequestContextGetter> |
57 CreateMainRequestContextGetter( | 54 CreateMainRequestContextGetter( |
58 content::ProtocolHandlerMap* protocol_handlers, | 55 content::ProtocolHandlerMap* protocol_handlers, |
59 PrefService* local_state, | 56 PrefService* local_state, |
60 IOThread* io_thread) const; | 57 IOThread* io_thread) const; |
61 scoped_refptr<ChromeURLRequestContextGetter> | 58 scoped_refptr<ChromeURLRequestContextGetter> |
62 CreateIsolatedAppRequestContextGetter( | 59 CreateIsolatedAppRequestContextGetter( |
63 const base::FilePath& partition_path, | 60 const base::FilePath& partition_path, |
64 bool in_memory, | 61 bool in_memory, |
65 content::ProtocolHandlerMap* protocol_handlers) const; | 62 content::ProtocolHandlerMap* protocol_handlers) const; |
66 | 63 |
67 content::ResourceContext* GetResourceContext() const; | 64 content::ResourceContext* GetResourceContext() const; |
68 // GetResourceContextNoInit() does not call LazyInitialize() so it can be | 65 // GetResourceContextNoInit() does not call LazyInitialize() so it can be |
69 // safely be used during initialization. | 66 // safely be used during initialization. |
70 content::ResourceContext* GetResourceContextNoInit() const; | 67 content::ResourceContext* GetResourceContextNoInit() const; |
71 scoped_refptr<ChromeURLRequestContextGetter> | 68 scoped_refptr<ChromeURLRequestContextGetter> |
72 GetMediaRequestContextGetter() const; | 69 GetMediaRequestContextGetter() const; |
73 scoped_refptr<ChromeURLRequestContextGetter> | 70 scoped_refptr<ChromeURLRequestContextGetter> |
74 GetExtensionsRequestContextGetter() const; | |
75 scoped_refptr<ChromeURLRequestContextGetter> | |
76 GetIsolatedMediaRequestContextGetter( | 71 GetIsolatedMediaRequestContextGetter( |
77 const base::FilePath& partition_path, | 72 const base::FilePath& partition_path, |
78 bool in_memory) const; | 73 bool in_memory) const; |
79 | 74 |
80 // Deletes all network related data since |time|. It deletes transport | 75 // Deletes all network related data since |time|. It deletes transport |
81 // security state since |time| and also deletes HttpServerProperties data. | 76 // security state since |time| and also deletes HttpServerProperties data. |
82 // Works asynchronously, however if the |completion| callback is non-null, | 77 // Works asynchronously, however if the |completion| callback is non-null, |
83 // it will be posted on the UI thread once the removal process completes. | 78 // it will be posted on the UI thread once the removal process completes. |
84 void ClearNetworkingHistorySince(base::Time time, | 79 void ClearNetworkingHistorySince(base::Time time, |
85 const base::Closure& completion); | 80 const base::Closure& completion); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 }; | 117 }; |
123 | 118 |
124 private: | 119 private: |
125 friend class base::RefCountedThreadSafe<ProfileImplIOData>; | 120 friend class base::RefCountedThreadSafe<ProfileImplIOData>; |
126 | 121 |
127 struct LazyParams { | 122 struct LazyParams { |
128 LazyParams(); | 123 LazyParams(); |
129 ~LazyParams(); | 124 ~LazyParams(); |
130 | 125 |
131 // All of these parameters are intended to be read on the IO thread. | 126 // All of these parameters are intended to be read on the IO thread. |
132 base::FilePath cookie_path; | |
133 base::FilePath server_bound_cert_path; | 127 base::FilePath server_bound_cert_path; |
134 base::FilePath cache_path; | 128 base::FilePath cache_path; |
135 int cache_max_size; | 129 int cache_max_size; |
136 base::FilePath media_cache_path; | 130 base::FilePath media_cache_path; |
137 int media_cache_max_size; | 131 int media_cache_max_size; |
138 base::FilePath extensions_cookie_path; | |
139 base::FilePath infinite_cache_path; | 132 base::FilePath infinite_cache_path; |
140 bool restore_old_session_cookies; | |
141 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy; | 133 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy; |
142 }; | 134 }; |
143 | 135 |
144 typedef base::hash_map<std::string, net::HttpTransactionFactory* > | 136 typedef base::hash_map<std::string, net::HttpTransactionFactory* > |
145 HttpTransactionFactoryMap; | 137 HttpTransactionFactoryMap; |
146 | 138 |
147 ProfileImplIOData(); | 139 ProfileImplIOData(); |
148 virtual ~ProfileImplIOData(); | 140 virtual ~ProfileImplIOData(); |
149 | 141 |
150 virtual void InitializeInternal( | 142 virtual void InitializeInternal( |
151 ProfileParams* profile_params, | 143 ProfileParams* profile_params, |
152 content::ProtocolHandlerMap* protocol_handlers) const OVERRIDE; | 144 content::ProtocolHandlerMap* protocol_handlers) const OVERRIDE; |
153 virtual void InitializeExtensionsRequestContext( | |
154 ProfileParams* profile_params) const OVERRIDE; | |
155 virtual ChromeURLRequestContext* InitializeAppRequestContext( | 145 virtual ChromeURLRequestContext* InitializeAppRequestContext( |
156 ChromeURLRequestContext* main_context, | 146 ChromeURLRequestContext* main_context, |
157 const StoragePartitionDescriptor& partition_descriptor, | 147 const StoragePartitionDescriptor& partition_descriptor, |
158 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 148 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
159 protocol_handler_interceptor, | 149 protocol_handler_interceptor, |
160 content::ProtocolHandlerMap* protocol_handlers) const OVERRIDE; | 150 content::ProtocolHandlerMap* protocol_handlers) const OVERRIDE; |
161 virtual ChromeURLRequestContext* InitializeMediaRequestContext( | 151 virtual ChromeURLRequestContext* InitializeMediaRequestContext( |
162 ChromeURLRequestContext* original_context, | 152 ChromeURLRequestContext* original_context, |
163 const StoragePartitionDescriptor& partition_descriptor) const OVERRIDE; | 153 const StoragePartitionDescriptor& partition_descriptor) const OVERRIDE; |
164 virtual ChromeURLRequestContext* | 154 virtual ChromeURLRequestContext* |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 195 |
206 // Parameters needed for isolated apps. | 196 // Parameters needed for isolated apps. |
207 base::FilePath profile_path_; | 197 base::FilePath profile_path_; |
208 int app_cache_max_size_; | 198 int app_cache_max_size_; |
209 int app_media_cache_max_size_; | 199 int app_media_cache_max_size_; |
210 | 200 |
211 DISALLOW_COPY_AND_ASSIGN(ProfileImplIOData); | 201 DISALLOW_COPY_AND_ASSIGN(ProfileImplIOData); |
212 }; | 202 }; |
213 | 203 |
214 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ | 204 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ |
OLD | NEW |