OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_IO_DATA_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
6 #define CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 16 matching lines...) Expand all Loading... | |
27 class HostZoomMap; | 27 class HostZoomMap; |
28 class IOThread; | 28 class IOThread; |
29 namespace net { | 29 namespace net { |
30 class DnsCertProvenanceChecker; | 30 class DnsCertProvenanceChecker; |
31 class NetLog; | 31 class NetLog; |
32 class ProxyConfigService; | 32 class ProxyConfigService; |
33 class ProxyService; | 33 class ProxyService; |
34 class SSLConfigService; | 34 class SSLConfigService; |
35 class TransportSecurityState; | 35 class TransportSecurityState; |
36 } // namespace net | 36 } // namespace net |
37 template<class T> class PrefMember; | |
37 namespace prerender { | 38 namespace prerender { |
38 class PrerenderManager; | 39 class PrerenderManager; |
39 }; // namespace prerender | 40 }; // namespace prerender |
40 class ProtocolHandlerRegistry; | 41 class ProtocolHandlerRegistry; |
41 namespace webkit_database { | 42 namespace webkit_database { |
42 class DatabaseTracker; | 43 class DatabaseTracker; |
43 } // webkit_database | 44 } // webkit_database |
44 | 45 |
46 typedef PrefMember<bool> BooleanPrefMember; | |
47 | |
45 // Conceptually speaking, the ProfileIOData represents data that lives on the IO | 48 // Conceptually speaking, the ProfileIOData represents data that lives on the IO |
46 // thread that is owned by a Profile, such as, but not limited to, network | 49 // thread that is owned by a Profile, such as, but not limited to, network |
47 // objects like CookieMonster, HttpTransactionFactory, etc. The Profile | 50 // objects like CookieMonster, HttpTransactionFactory, etc. The Profile |
48 // implementation will maintain a reference to the ProfileIOData. The | 51 // implementation will maintain a reference to the ProfileIOData. The |
49 // ProfileIOData will originally own a reference to the ChromeURLRequestContexts | 52 // ProfileIOData will originally own a reference to the ChromeURLRequestContexts |
50 // that reference its members. When an accessor for a ChromeURLRequestContext is | 53 // that reference its members. When an accessor for a ChromeURLRequestContext is |
51 // invoked, then ProfileIOData will release its reference to the | 54 // invoked, then ProfileIOData will release its reference to the |
52 // ChromeURLRequestContext and the ChromeURLRequestContext will acquire a | 55 // ChromeURLRequestContext and the ChromeURLRequestContext will acquire a |
53 // reference to the ProfileIOData, so they exchange ownership. This is done | 56 // reference to the ProfileIOData, so they exchange ownership. This is done |
54 // because it's possible for a context's accessor never to be invoked, so this | 57 // because it's possible for a context's accessor never to be invoked, so this |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 scoped_refptr<prerender::PrerenderManager> prerender_manager; | 112 scoped_refptr<prerender::PrerenderManager> prerender_manager; |
110 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry; | 113 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry; |
111 // We need to initialize the ProxyConfigService from the UI thread | 114 // We need to initialize the ProxyConfigService from the UI thread |
112 // because on linux it relies on initializing things through gconf, | 115 // because on linux it relies on initializing things through gconf, |
113 // and needs to be on the main thread. | 116 // and needs to be on the main thread. |
114 scoped_ptr<net::ProxyConfigService> proxy_config_service; | 117 scoped_ptr<net::ProxyConfigService> proxy_config_service; |
115 // The profile this struct was populated from. | 118 // The profile this struct was populated from. |
116 ProfileId profile_id; | 119 ProfileId profile_id; |
117 }; | 120 }; |
118 | 121 |
119 explicit ProfileIOData(bool is_incognito); | 122 explicit ProfileIOData(Profile* profile, bool is_incognito); |
willchan no longer on Chromium
2011/04/12 16:34:18
Not explicit anymore.
I have to say, I resisted a
Bernhard Bauer
2011/04/12 20:26:05
Hmm, I could initialize the BooleanPrefMember in t
willchan no longer on Chromium
2011/04/12 22:43:07
Yes, I would be fine with that. That's what I refe
Bernhard Bauer
2011/04/13 11:17:20
OK, done (in ChromeNetworkDelegate now, so it can
| |
120 virtual ~ProfileIOData(); | 123 virtual ~ProfileIOData(); |
121 | 124 |
122 // Static helper functions to assist in common operations executed by | 125 // Static helper functions to assist in common operations executed by |
123 // subtypes. | 126 // subtypes. |
124 | 127 |
125 static void InitializeProfileParams(Profile* profile, ProfileParams* params); | 128 static void InitializeProfileParams(Profile* profile, ProfileParams* params); |
126 static void ApplyProfileParamsToContext(const ProfileParams& profile_params, | 129 static void ApplyProfileParamsToContext(const ProfileParams& profile_params, |
127 ChromeURLRequestContext* context); | 130 ChromeURLRequestContext* context); |
128 | 131 |
129 // Lazy initializes the ProfileIOData object the first time a request context | 132 // Lazy initializes the ProfileIOData object the first time a request context |
130 // is requested. The lazy logic is implemented here. The actual initialization | 133 // is requested. The lazy logic is implemented here. The actual initialization |
131 // is done in LazyInitializeInternal(), implemented by subtypes. Static helper | 134 // is done in LazyInitializeInternal(), implemented by subtypes. Static helper |
132 // functions have been provided to assist in common operations. | 135 // functions have been provided to assist in common operations. |
133 void LazyInitialize() const; | 136 void LazyInitialize() const; |
134 | 137 |
138 protected: | |
willchan no longer on Chromium
2011/04/12 16:34:18
Look at line 73, there's already a protected secti
Bernhard Bauer
2011/04/13 11:17:20
Oops, done.
| |
135 // -------------------------------------------- | 139 // -------------------------------------------- |
136 // Virtual interface for subtypes to implement: | 140 // Virtual interface for subtypes to implement: |
137 // -------------------------------------------- | 141 // -------------------------------------------- |
138 | 142 |
139 // Does the actual initialization of the ProfileIOData subtype. Subtypes | 143 // Does the actual initialization of the ProfileIOData subtype. Subtypes |
140 // should use the static helper functions above to implement this. | 144 // should use the static helper functions above to implement this. |
141 virtual void LazyInitializeInternal() const = 0; | 145 virtual void LazyInitializeInternal() const = 0; |
142 | 146 |
143 // Does an on-demand initialization of a RequestContext for the given | 147 // Does an on-demand initialization of a RequestContext for the given |
144 // isolated app. | 148 // isolated app. |
145 virtual scoped_refptr<RequestContext> InitializeAppRequestContext( | 149 virtual scoped_refptr<RequestContext> InitializeAppRequestContext( |
146 scoped_refptr<ChromeURLRequestContext> main_context, | 150 scoped_refptr<ChromeURLRequestContext> main_context, |
147 const std::string& app_id) const = 0; | 151 const std::string& app_id) const = 0; |
148 | 152 |
149 // These functions are used to transfer ownership of the lazily initialized | 153 // These functions are used to transfer ownership of the lazily initialized |
150 // context from ProfileIOData to the URLRequestContextGetter. | 154 // context from ProfileIOData to the URLRequestContextGetter. |
151 virtual scoped_refptr<ChromeURLRequestContext> | 155 virtual scoped_refptr<ChromeURLRequestContext> |
152 AcquireMainRequestContext() const = 0; | 156 AcquireMainRequestContext() const = 0; |
153 virtual scoped_refptr<ChromeURLRequestContext> | 157 virtual scoped_refptr<ChromeURLRequestContext> |
154 AcquireMediaRequestContext() const = 0; | 158 AcquireMediaRequestContext() const = 0; |
155 virtual scoped_refptr<ChromeURLRequestContext> | 159 virtual scoped_refptr<ChromeURLRequestContext> |
156 AcquireExtensionsRequestContext() const = 0; | 160 AcquireExtensionsRequestContext() const = 0; |
157 virtual scoped_refptr<ChromeURLRequestContext> | 161 virtual scoped_refptr<ChromeURLRequestContext> |
158 AcquireIsolatedAppRequestContext( | 162 AcquireIsolatedAppRequestContext( |
159 scoped_refptr<ChromeURLRequestContext> main_context, | 163 scoped_refptr<ChromeURLRequestContext> main_context, |
160 const std::string& app_id) const = 0; | 164 const std::string& app_id) const = 0; |
161 | 165 |
166 // Called when the profile is destroyed. | |
167 void Shutdown(); | |
willchan no longer on Chromium
2011/04/12 16:34:18
ShutdownOnUI()
Bernhard Bauer
2011/04/13 11:17:20
Done.
| |
168 | |
169 BooleanPrefMember* enable_referrers() const { | |
170 return enable_referrers_.get(); | |
171 } | |
172 | |
173 private: | |
174 scoped_ptr<BooleanPrefMember> enable_referrers_; | |
willchan no longer on Chromium
2011/04/12 16:34:18
Why use a pointer? Can't we just directly embed th
Bernhard Bauer
2011/04/13 11:17:20
Very nice! Done.
| |
162 mutable bool initialized_; | 175 mutable bool initialized_; |
163 | 176 |
164 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); | 177 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); |
165 }; | 178 }; |
166 | 179 |
167 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 180 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
OLD | NEW |