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 // This class gathers state related to a single user profile. | 5 // This class gathers state related to a single user profile. |
6 | 6 |
7 #ifndef CHROME_BROWSER_PROFILES_PROFILE_H_ | 7 #ifndef CHROME_BROWSER_PROFILES_PROFILE_H_ |
8 #define CHROME_BROWSER_PROFILES_PROFILE_H_ | 8 #define CHROME_BROWSER_PROFILES_PROFILE_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/hash_tables.h" | 13 #include "base/hash_tables.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "chrome/browser/net/pref_proxy_config_tracker.h" | 15 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
16 #include "content/public/browser/browser_context.h" | 16 #include "content/public/browser/browser_context.h" |
| 17 #include "net/url_request/url_request_job_factory.h" |
17 | 18 |
18 class ChromeAppCacheService; | 19 class ChromeAppCacheService; |
19 class ExtensionService; | 20 class ExtensionService; |
20 class ExtensionSpecialStoragePolicy; | 21 class ExtensionSpecialStoragePolicy; |
21 class FaviconService; | 22 class FaviconService; |
22 class HostContentSettingsMap; | 23 class HostContentSettingsMap; |
23 class PasswordStore; | 24 class PasswordStore; |
24 class PrefServiceSyncable; | 25 class PrefServiceSyncable; |
25 class PromoCounter; | 26 class PromoCounter; |
26 class ProtocolHandlerRegistry; | 27 class ProtocolHandlerRegistry; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // time that this method is called. | 219 // time that this method is called. |
219 virtual PrefServiceSyncable* GetOffTheRecordPrefs() = 0; | 220 virtual PrefServiceSyncable* GetOffTheRecordPrefs() = 0; |
220 | 221 |
221 // Returns the main request context. | 222 // Returns the main request context. |
222 virtual net::URLRequestContextGetter* GetRequestContext() = 0; | 223 virtual net::URLRequestContextGetter* GetRequestContext() = 0; |
223 | 224 |
224 // Returns the request context used for extension-related requests. This | 225 // Returns the request context used for extension-related requests. This |
225 // is only used for a separate cookie store currently. | 226 // is only used for a separate cookie store currently. |
226 virtual net::URLRequestContextGetter* GetRequestContextForExtensions() = 0; | 227 virtual net::URLRequestContextGetter* GetRequestContextForExtensions() = 0; |
227 | 228 |
228 // Returns the request context used within |partition_id|. | |
229 virtual net::URLRequestContextGetter* GetRequestContextForStoragePartition( | |
230 const FilePath& partition_path, | |
231 bool in_memory) = 0; | |
232 | |
233 // Returns the SSLConfigService for this profile. | 229 // Returns the SSLConfigService for this profile. |
234 virtual net::SSLConfigService* GetSSLConfigService() = 0; | 230 virtual net::SSLConfigService* GetSSLConfigService() = 0; |
235 | 231 |
236 // Returns the Hostname <-> Content settings map for this profile. | 232 // Returns the Hostname <-> Content settings map for this profile. |
237 virtual HostContentSettingsMap* GetHostContentSettingsMap() = 0; | 233 virtual HostContentSettingsMap* GetHostContentSettingsMap() = 0; |
238 | 234 |
239 // Returns the ProtocolHandlerRegistry, creating if not yet created. | 235 // Returns the ProtocolHandlerRegistry, creating if not yet created. |
240 // TODO(smckay): replace this with access via ProtocolHandlerRegistryFactory. | 236 // TODO(smckay): replace this with access via ProtocolHandlerRegistryFactory. |
241 virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() = 0; | 237 virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() = 0; |
242 | 238 |
243 // Return whether 2 profiles are the same. 2 profiles are the same if they | 239 // Return whether 2 profiles are the same. 2 profiles are the same if they |
244 // represent the same profile. This can happen if there is pointer equality | 240 // represent the same profile. This can happen if there is pointer equality |
245 // or if one profile is the incognito version of another profile (or vice | 241 // or if one profile is the incognito version of another profile (or vice |
246 // versa). | 242 // versa). |
247 virtual bool IsSameProfile(Profile* profile) = 0; | 243 virtual bool IsSameProfile(Profile* profile) = 0; |
248 | 244 |
249 // Returns the time the profile was started. This is not the time the profile | 245 // Returns the time the profile was started. This is not the time the profile |
250 // was created, rather it is the time the user started chrome and logged into | 246 // was created, rather it is the time the user started chrome and logged into |
251 // this profile. For the single profile case, this corresponds to the time | 247 // this profile. For the single profile case, this corresponds to the time |
252 // the user started chrome. | 248 // the user started chrome. |
253 virtual base::Time GetStartTime() const = 0; | 249 virtual base::Time GetStartTime() const = 0; |
254 | 250 |
| 251 // Creates the main net::URLRequestContextGetter that will be returned by |
| 252 // GetRequestContext(). Should only be called once per ContentBrowserClient |
| 253 // object. This function is exposed because of the circular dependency where |
| 254 // GetStoragePartition() is used to retrieve the request context, but creation |
| 255 // still has to happen in the Profile so the StoragePartition calls |
| 256 // ContextBrowserClient to call this function. |
| 257 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved. |
| 258 virtual net::URLRequestContextGetter* CreateRequestContext( |
| 259 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 260 blob_protocol_handler, |
| 261 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 262 file_system_protocol_handler, |
| 263 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 264 developer_protocol_handler, |
| 265 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 266 chrome_protocol_handler, |
| 267 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 268 chrome_devtools_protocol_handler) = 0; |
| 269 |
| 270 // Creates the net::URLRequestContextGetter for a StoragePartition. Should |
| 271 // only be called once per partition_path per ContentBrowserClient object. |
| 272 // This function is exposed because the request context is retrieved from the |
| 273 // StoragePartition, but creation still has to happen in the Profile so the |
| 274 // StoragePartition calls ContextBrowserClient to call this function. |
| 275 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved. |
| 276 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( |
| 277 const FilePath& partition_path, |
| 278 bool in_memory, |
| 279 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 280 blob_protocol_handler, |
| 281 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 282 file_system_protocol_handler, |
| 283 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 284 developer_protocol_handler, |
| 285 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 286 chrome_protocol_handler, |
| 287 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 288 chrome_devtools_protocol_handler) = 0; |
| 289 |
255 // Returns the last directory that was chosen for uploading or opening a file. | 290 // Returns the last directory that was chosen for uploading or opening a file. |
256 virtual FilePath last_selected_directory() = 0; | 291 virtual FilePath last_selected_directory() = 0; |
257 virtual void set_last_selected_directory(const FilePath& path) = 0; | 292 virtual void set_last_selected_directory(const FilePath& path) = 0; |
258 | 293 |
259 #if defined(OS_CHROMEOS) | 294 #if defined(OS_CHROMEOS) |
260 enum AppLocaleChangedVia { | 295 enum AppLocaleChangedVia { |
261 // Caused by chrome://settings change. | 296 // Caused by chrome://settings change. |
262 APP_LOCALE_CHANGED_VIA_SETTINGS, | 297 APP_LOCALE_CHANGED_VIA_SETTINGS, |
263 // Locale has been reverted via LocaleChangeGuard. | 298 // Locale has been reverted via LocaleChangeGuard. |
264 APP_LOCALE_CHANGED_VIA_REVERT, | 299 APP_LOCALE_CHANGED_VIA_REVERT, |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 struct hash<Profile*> { | 420 struct hash<Profile*> { |
386 std::size_t operator()(Profile* const& p) const { | 421 std::size_t operator()(Profile* const& p) const { |
387 return reinterpret_cast<std::size_t>(p); | 422 return reinterpret_cast<std::size_t>(p); |
388 } | 423 } |
389 }; | 424 }; |
390 | 425 |
391 } // namespace BASE_HASH_NAMESPACE | 426 } // namespace BASE_HASH_NAMESPACE |
392 #endif | 427 #endif |
393 | 428 |
394 #endif // CHROME_BROWSER_PROFILES_PROFILE_H_ | 429 #endif // CHROME_BROWSER_PROFILES_PROFILE_H_ |
OLD | NEW |