blob: bbd710c8c1e66522bd43943246eb6971a3e7624f [file] [log] [blame]
[email protected]e284e6d82010-01-29 19:49:451// Copyright (c) 2010 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit09911bf2008-07-26 23:55:294
5// This class gathers state related to a single user profile.
6
[email protected]bfd04a62009-02-01 18:16:567#ifndef CHROME_BROWSER_PROFILE_H_
8#define CHROME_BROWSER_PROFILE_H_
[email protected]32b76ef2010-07-26 23:08:249#pragma once
initial.commit09911bf2008-07-26 23:55:2910
initial.commit09911bf2008-07-26 23:55:2911#include "base/basictypes.h"
[email protected]ca5e7402010-08-19 17:22:4712#include "base/logging.h"
[email protected]e5047ff2010-07-31 00:18:2513
[email protected]ca5e7402010-08-19 17:22:4714namespace base {
15class Time;
16}
[email protected]f50278cd2010-08-24 17:34:0817
18#if defined(OS_CHROMEOS)
19namespace chromeos {
20class ProxyConfigServiceImpl;
21}
22#endif
23
[email protected]523623c2010-05-19 16:03:4224namespace history {
25class TopSites;
26}
27
[email protected]a9cea7542009-05-20 04:30:2328namespace net {
[email protected]326e6792009-12-11 21:04:4229class TransportSecurityState;
[email protected]db36938c2009-08-19 21:48:4230class SSLConfigService;
[email protected]a9cea7542009-05-20 04:30:2331}
[email protected]be180c802009-10-23 06:33:3132
[email protected]2f351cb2009-11-09 23:43:3433namespace webkit_database {
34class DatabaseTracker;
35}
36
[email protected]69c579e2010-04-23 20:01:0037class AutocompleteClassifier;
[email protected]398206c2010-06-21 01:46:0838class BackgroundContentsService;
[email protected]4c793f02010-08-18 20:55:4539class BackgroundModeManager;
[email protected]d8e41ed2008-09-11 15:22:3240class BookmarkModel;
[email protected]449478302009-06-09 20:04:2841class BrowserThemeProvider;
[email protected]02a5cdb2010-08-11 20:47:3242class ChromeAppCacheService;
[email protected]22339b12010-08-27 18:29:2443class ChromeBlobStorageContext;
[email protected]be180c802009-10-23 06:33:3144class ChromeURLRequestContextGetter;
[email protected]4bb336302009-10-12 05:44:2645class DesktopNotificationService;
initial.commit09911bf2008-07-26 23:55:2946class DownloadManager;
[email protected]4a190632009-05-09 01:07:4247class Extension;
[email protected]89ebc7e2009-08-24 22:11:0748class ExtensionDevToolsManager;
[email protected]481e1a42009-05-06 20:56:0549class ExtensionProcessManager;
[email protected]7120f132009-07-20 21:05:3750class ExtensionMessageService;
[email protected]6014d672008-12-05 00:38:2551class ExtensionsService;
[email protected]0189bc722009-08-28 21:56:4852class FaviconService;
[email protected]864b1362010-08-19 03:49:3853class FilePath;
[email protected]c44b7902010-08-27 21:24:4354class FileSystemHostContext;
[email protected]e5d2f7132010-04-09 18:13:5355class FindBarState;
[email protected]aee541e2010-03-19 01:52:4556class GeolocationContentSettingsMap;
[email protected]8b4b84ee2010-05-11 13:08:5257class GeolocationPermissionContext;
initial.commit09911bf2008-07-26 23:55:2958class HistoryService;
[email protected]e284e6d82010-01-29 19:49:4559class HostContentSettingsMap;
[email protected]40bd6582009-12-04 23:49:5160class HostZoomMap;
initial.commit09911bf2008-07-26 23:55:2961class NavigationController;
[email protected]9c8dd902009-11-19 17:50:4262class NTPResourceCache;
[email protected]e69d33952009-06-03 22:00:4163class PasswordStore;
[email protected]def11712009-11-06 00:42:1564class PersonalDataManager;
[email protected]911f8152010-03-18 16:46:4065class PinnedTabService;
initial.commit09911bf2008-07-26 23:55:2966class PrefService;
[email protected]48352c12009-08-15 01:19:1167class ProfileSyncService;
[email protected]4aea04a2010-02-10 20:13:4368class ProfileSyncFactory;
initial.commit09911bf2008-07-26 23:55:2969class SessionService;
[email protected]9c92d192009-12-02 08:03:1670class SpellCheckHost;
[email protected]db36938c2009-08-19 21:48:4271class SSLConfigServiceManager;
[email protected]34cc84f2009-02-13 10:04:3572class SSLHostState;
[email protected]4c793f02010-08-18 20:55:4573class StatusTray;
[email protected]326e6792009-12-11 21:04:4274class TransportSecurityPersister;
[email protected]47accfd62009-05-14 18:46:2175class SQLitePersistentCookieStore;
initial.commit09911bf2008-07-26 23:55:2976class TabRestoreService;
77class TemplateURLFetcher;
78class TemplateURLModel;
[email protected]2735e3692009-09-25 18:19:3979class ThemeProvider;
[email protected]8e4c29612010-07-14 01:24:4580class TokenService;
[email protected]be180c802009-10-23 06:33:3181class URLRequestContextGetter;
[email protected]0938d3c2009-01-09 20:37:3582class UserScriptMaster;
[email protected]6c32ce72010-03-08 05:18:0683class UserStyleSheetWatcher;
initial.commit09911bf2008-07-26 23:55:2984class VisitedLinkMaster;
[email protected]a6d0f182010-01-12 08:01:4485class VisitedLinkEventListener;
initial.commit09911bf2008-07-26 23:55:2986class WebDataService;
[email protected]3bf335a2009-06-26 20:46:0687class WebKitContext;
[email protected]b1748b1d82009-11-30 20:32:5688class WebResourceService;
[email protected]1bd056e2010-04-20 02:03:4889class CloudPrintProxyService;
initial.commit09911bf2008-07-26 23:55:2990
[email protected]4bf6afd2009-10-08 14:00:1191typedef intptr_t ProfileId;
92
initial.commit09911bf2008-07-26 23:55:2993class Profile {
94 public:
initial.commit09911bf2008-07-26 23:55:2995 // Profile services are accessed with the following parameter. This parameter
96 // defines what the caller plans to do with the service.
[email protected]f7011fcb2009-01-28 21:54:3297 // The caller is responsible for not performing any operation that would
initial.commit09911bf2008-07-26 23:55:2998 // result in persistent implicit records while using an OffTheRecord profile.
99 // This flag allows the profile to perform an additional check.
100 //
101 // It also gives us an opportunity to perform further checks in the future. We
102 // could, for example, return an history service that only allow some specific
103 // methods.
104 enum ServiceAccessType {
105 // The caller plans to perform a read or write that takes place as a result
106 // of the user input. Use this flag when the operation you are doing can be
107 // performed while off the record. (ex: creating a bookmark)
108 //
109 // Since EXPLICIT_ACCESS means "as a result of a user action", this request
110 // always succeeds.
111 EXPLICIT_ACCESS,
112
113 // The caller plans to call a method that will permanently change some data
114 // in the profile, as part of Chrome's implicit data logging. Use this flag
115 // when you are about to perform an operation which is incompatible with the
116 // off the record mode.
117 IMPLICIT_ACCESS
118 };
[email protected]4bf6afd2009-10-08 14:00:11119
120 // Value that represents no profile Id.
121 static const ProfileId InvalidProfileId;
122
[email protected]5cbe1e22010-01-30 01:18:56123 Profile() : restored_last_session_(false), accessibility_pause_level_(0) {}
initial.commit09911bf2008-07-26 23:55:29124 virtual ~Profile() {}
125
126 // Profile prefs are registered as soon as the prefs are loaded for the first
127 // time.
128 static void RegisterUserPrefs(PrefService* prefs);
129
130 // Create a new profile given a path.
[email protected]f7011fcb2009-01-28 21:54:32131 static Profile* CreateProfile(const FilePath& path);
initial.commit09911bf2008-07-26 23:55:29132
[email protected]b3186d02008-09-15 20:33:14133 // Returns the request context for the "default" profile. This may be called
134 // from any thread. This CAN return NULL if a first request context has not
135 // yet been created. If necessary, listen on the UI thread for
136 // NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE.
[email protected]be180c802009-10-23 06:33:31137 static URLRequestContextGetter* GetDefaultRequestContext();
initial.commit09911bf2008-07-26 23:55:29138
[email protected]4bf6afd2009-10-08 14:00:11139 // Returns a unique Id that can be used to identify this profile at runtime.
140 // This Id is not persistent and will not survive a restart of the browser.
141 virtual ProfileId GetRuntimeId() = 0;
142
initial.commit09911bf2008-07-26 23:55:29143 // Returns the path of the directory where this profile's data is stored.
[email protected]f7011fcb2009-01-28 21:54:32144 virtual FilePath GetPath() = 0;
initial.commit09911bf2008-07-26 23:55:29145
146 // Return whether this profile is off the record. Default is false.
147 virtual bool IsOffTheRecord() = 0;
148
149 // Return the off the record version of this profile. The returned pointer
150 // is owned by the receiving profile. If the receiving profile is off the
151 // record, the same profile is returned.
152 virtual Profile* GetOffTheRecordProfile() = 0;
153
[email protected]860f55492009-03-27 19:50:59154 // Destroys the off the record profile.
155 virtual void DestroyOffTheRecordProfile() = 0;
156
[email protected]6c8909c2010-07-02 07:31:11157 // True if an off the record profile exists.
158 virtual bool HasOffTheRecordProfile() = 0;
159
initial.commit09911bf2008-07-26 23:55:29160 // Return the original "recording" profile. This method returns this if the
161 // profile is not off the record.
162 virtual Profile* GetOriginalProfile() = 0;
163
[email protected]02a5cdb2010-08-11 20:47:32164 // Returns a pointer to the ChromeAppCacheService instance for this profile.
165 virtual ChromeAppCacheService* GetAppCacheService() = 0;
166
[email protected]2f351cb2009-11-09 23:43:34167 // Returns a pointer to the DatabaseTracker instance for this profile.
168 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0;
169
[email protected]523623c2010-05-19 16:03:42170 // Returns a pointer to the TopSites (thumbnail manager) instance
171 // for this profile.
172 virtual history::TopSites* GetTopSites() = 0;
173
initial.commit09911bf2008-07-26 23:55:29174 // Retrieves a pointer to the VisitedLinkMaster associated with this
175 // profile. The VisitedLinkMaster is lazily created the first time
176 // that this method is called.
177 virtual VisitedLinkMaster* GetVisitedLinkMaster() = 0;
178
[email protected]6014d672008-12-05 00:38:25179 // Retrieves a pointer to the ExtensionsService associated with this
180 // profile. The ExtensionsService is created at startup.
181 virtual ExtensionsService* GetExtensionsService() = 0;
182
[email protected]0938d3c2009-01-09 20:37:35183 // Retrieves a pointer to the UserScriptMaster associated with this
184 // profile. The UserScriptMaster is lazily created the first time
[email protected]04fba9a92008-10-28 17:25:25185 // that this method is called.
[email protected]0938d3c2009-01-09 20:37:35186 virtual UserScriptMaster* GetUserScriptMaster() = 0;
[email protected]04fba9a92008-10-28 17:25:25187
[email protected]89ebc7e2009-08-24 22:11:07188 // Retrieves a pointer to the ExtensionDevToolsManager associated with this
189 // profile. The instance is created at startup.
190 virtual ExtensionDevToolsManager* GetExtensionDevToolsManager() = 0;
191
[email protected]481e1a42009-05-06 20:56:05192 // Retrieves a pointer to the ExtensionProcessManager associated with this
193 // profile. The instance is created at startup.
194 virtual ExtensionProcessManager* GetExtensionProcessManager() = 0;
195
[email protected]7120f132009-07-20 21:05:37196 // Retrieves a pointer to the ExtensionMessageService associated with this
197 // profile. The instance is created at startup.
198 virtual ExtensionMessageService* GetExtensionMessageService() = 0;
199
[email protected]34cc84f2009-02-13 10:04:35200 // Retrieves a pointer to the SSLHostState associated with this profile.
201 // The SSLHostState is lazily created the first time that this method is
202 // called.
203 virtual SSLHostState* GetSSLHostState() = 0;
204
[email protected]326e6792009-12-11 21:04:42205 // Retrieves a pointer to the TransportSecurityState associated with
206 // this profile. The TransportSecurityState is lazily created the
[email protected]77f6fb432009-09-05 14:21:09207 // first time that this method is called.
[email protected]326e6792009-12-11 21:04:42208 virtual net::TransportSecurityState*
209 GetTransportSecurityState() = 0;
[email protected]a9cea7542009-05-20 04:30:23210
[email protected]0189bc722009-08-28 21:56:48211 // Retrieves a pointer to the FaviconService associated with this
212 // profile. The FaviconService is lazily created the first time
213 // that this method is called.
214 //
215 // Although FaviconService is refcounted, this will not addref, and callers
216 // do not need to do any reference counting as long as they keep the pointer
217 // only for the local scope (which they should do anyway since the browser
218 // process may decide to shut down).
219 //
220 // |access| defines what the caller plans to do with the service. See
221 // the ServiceAccessType definition above.
222 virtual FaviconService* GetFaviconService(ServiceAccessType access) = 0;
223
initial.commit09911bf2008-07-26 23:55:29224 // Retrieves a pointer to the HistoryService associated with this
225 // profile. The HistoryService is lazily created the first time
226 // that this method is called.
[email protected]f7011fcb2009-01-28 21:54:32227 //
initial.commit09911bf2008-07-26 23:55:29228 // Although HistoryService is refcounted, this will not addref, and callers
229 // do not need to do any reference counting as long as they keep the pointer
230 // only for the local scope (which they should do anyway since the browser
231 // process may decide to shut down).
232 //
233 // |access| defines what the caller plans to do with the service. See
234 // the ServiceAccessType definition above.
235 virtual HistoryService* GetHistoryService(ServiceAccessType access) = 0;
236
[email protected]0850fa62009-10-08 22:34:29237 // Similar to GetHistoryService(), but won't create the history service if it
238 // doesn't already exist.
239 virtual HistoryService* GetHistoryServiceWithoutCreating() = 0;
240
[email protected]69c579e2010-04-23 20:01:00241 // Retrieves a pointer to the AutocompleteClassifier associated with this
242 // profile. The AutocompleteClassifier is lazily created the first time that
243 // this method is called.
244 virtual AutocompleteClassifier* GetAutocompleteClassifier() = 0;
[email protected]90085af02009-10-29 17:53:21245
initial.commit09911bf2008-07-26 23:55:29246 // Returns the WebDataService for this profile. This is owned by
247 // the Profile. Callers that outlive the life of this profile need to be
248 // sure they refcount the returned value.
249 //
250 // |access| defines what the caller plans to do with the service. See
251 // the ServiceAccessType definition above.
252 virtual WebDataService* GetWebDataService(ServiceAccessType access) = 0;
253
[email protected]9cddbe372009-10-23 21:23:53254 // Similar to GetWebDataService(), but won't create the web data service if it
255 // doesn't already exist.
256 virtual WebDataService* GetWebDataServiceWithoutCreating() = 0;
257
[email protected]e69d33952009-06-03 22:00:41258 // Returns the PasswordStore for this profile. This is owned by the Profile.
259 virtual PasswordStore* GetPasswordStore(ServiceAccessType access) = 0;
260
initial.commit09911bf2008-07-26 23:55:29261 // Retrieves a pointer to the PrefService that manages the preferences
262 // for this user profile. The PrefService is lazily created the first
263 // time that this method is called.
264 virtual PrefService* GetPrefs() = 0;
265
266 // Returns the TemplateURLModel for this profile. This is owned by the
267 // the Profile.
268 virtual TemplateURLModel* GetTemplateURLModel() = 0;
269
270 // Returns the TemplateURLFetcher for this profile. This is owned by the
271 // profile.
272 virtual TemplateURLFetcher* GetTemplateURLFetcher() = 0;
273
[email protected]def11712009-11-06 00:42:15274 // Returns the DownloadManager associated with this profile.
initial.commit09911bf2008-07-26 23:55:29275 virtual DownloadManager* GetDownloadManager() = 0;
276 virtual bool HasCreatedDownloadManager() const = 0;
277
[email protected]def11712009-11-06 00:42:15278 // Returns the PersonalDataManager associated with this profile.
279 virtual PersonalDataManager* GetPersonalDataManager() = 0;
280
[email protected]c44b7902010-08-27 21:24:43281 // Returns the HTML5 FileSystemHostContext assigned to this profile.
282 virtual FileSystemHostContext* GetFileSystemHostContext() = 0;
283
[email protected]4a190632009-05-09 01:07:42284 // Init our themes system.
285 virtual void InitThemes() = 0;
286
287 // Set the theme to the specified extension.
288 virtual void SetTheme(Extension* extension) = 0;
289
[email protected]a5166af62009-07-03 00:42:29290 // Set the theme to the machine's native theme.
291 virtual void SetNativeTheme() = 0;
292
[email protected]4a190632009-05-09 01:07:42293 // Clear the theme and reset it to default.
294 virtual void ClearTheme() = 0;
295
[email protected]51c490b2009-08-03 16:34:34296 // Gets the theme that was last set. Returns NULL if the theme is no longer
297 // installed, if there is no installed theme, or the theme was cleared.
298 virtual Extension* GetTheme() = 0;
299
[email protected]4a190632009-05-09 01:07:42300 // Returns or creates the ThemeProvider associated with this profile
[email protected]5786d3d2009-12-18 00:18:44301 virtual BrowserThemeProvider* GetThemeProvider() = 0;
[email protected]4a190632009-05-09 01:07:42302
[email protected]b3186d02008-09-15 20:33:14303 // Returns the request context information associated with this profile. Call
304 // this only on the UI thread, since it can send notifications that should
305 // happen on the UI thread.
[email protected]be180c802009-10-23 06:33:31306 virtual URLRequestContextGetter* GetRequestContext() = 0;
initial.commit09911bf2008-07-26 23:55:29307
[email protected]e7f29642009-03-02 22:53:18308 // Returns the request context for media resources asociated with this
309 // profile.
[email protected]be180c802009-10-23 06:33:31310 virtual URLRequestContextGetter* GetRequestContextForMedia() = 0;
[email protected]e7f29642009-03-02 22:53:18311
[email protected]47accfd62009-05-14 18:46:21312 // Returns the request context used for extension-related requests. This
313 // is only used for a separate cookie store currently.
[email protected]be180c802009-10-23 06:33:31314 virtual URLRequestContextGetter* GetRequestContextForExtensions() = 0;
[email protected]47accfd62009-05-14 18:46:21315
[email protected]57a777f72010-03-31 01:09:42316 // Called by the ExtensionsService that lives in this profile. Gives the
317 // profile a chance to react to the load event before the EXTENSION_LOADED
318 // notification has fired. The purpose for handling this event first is to
319 // avoid race conditions by making sure URLRequestContexts learn about new
320 // extensions before anything else needs them to know.
321 virtual void RegisterExtensionWithRequestContexts(Extension* extension) {}
322
323 // Called by the ExtensionsService that lives in this profile. Lets the
324 // profile clean up its RequestContexts once all the listeners to the
325 // EXTENSION_UNLOADED notification have finished running.
326 virtual void UnregisterExtensionWithRequestContexts(Extension* extension) {}
327
[email protected]db36938c2009-08-19 21:48:42328 // Returns the SSLConfigService for this profile.
329 virtual net::SSLConfigService* GetSSLConfigService() = 0;
330
[email protected]e284e6d82010-01-29 19:49:45331 // Returns the Hostname <-> Content settings map for this profile.
332 virtual HostContentSettingsMap* GetHostContentSettingsMap() = 0;
333
[email protected]40bd6582009-12-04 23:49:51334 // Returns the Hostname <-> Zoom Level map for this profile.
335 virtual HostZoomMap* GetHostZoomMap() = 0;
336
[email protected]aee541e2010-03-19 01:52:45337 // Returns the geolocation settings map for this profile.
338 virtual GeolocationContentSettingsMap* GetGeolocationContentSettingsMap() = 0;
339
[email protected]8b4b84ee2010-05-11 13:08:52340 // Returns the geolocation permission context for this profile.
341 virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0;
342
[email protected]6c32ce72010-03-08 05:18:06343 // Returns the user style sheet watcher.
344 virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() = 0;
345
[email protected]e5d2f7132010-04-09 18:13:53346 // Returns the find bar state for this profile. The find bar state is lazily
347 // created the first time that this method is called.
348 virtual FindBarState* GetFindBarState() = 0;
349
initial.commit09911bf2008-07-26 23:55:29350 // Returns the session service for this profile. This may return NULL. If
351 // this profile supports a session service (it isn't off the record), and
352 // the session service hasn't yet been created, this forces creation of
353 // the session service.
354 //
355 // This returns NULL in two situations: the profile is off the record, or the
356 // session service has been explicitly shutdown (browser is exiting). Callers
357 // should always check the return value for NULL.
358 virtual SessionService* GetSessionService() = 0;
359
360 // If this profile has a session service, it is shut down. To properly record
361 // the current state this forces creation of the session service, then shuts
362 // it down.
363 virtual void ShutdownSessionService() = 0;
364
365 // Returns true if this profile has a session service.
366 virtual bool HasSessionService() const = 0;
367
initial.commit09911bf2008-07-26 23:55:29368 // Returns true if the last time this profile was open it was exited cleanly.
369 virtual bool DidLastSessionExitCleanly() = 0;
370
[email protected]d8e41ed2008-09-11 15:22:32371 // Returns the BookmarkModel, creating if not yet created.
372 virtual BookmarkModel* GetBookmarkModel() = 0;
initial.commit09911bf2008-07-26 23:55:29373
[email protected]8e4c29612010-07-14 01:24:45374 // Returns the Gaia Token Service, creating if not yet created.
375 virtual TokenService* GetTokenService() = 0;
376
[email protected]48352c12009-08-15 01:19:11377 // Returns the ProfileSyncService, creating if not yet created.
378 virtual ProfileSyncService* GetProfileSyncService() = 0;
[email protected]3a453fa2008-08-15 18:46:34379
[email protected]e8234d32010-09-09 20:36:39380 // Returns the ProfileSyncService, creating if not yet created, with
381 // the specified CrOS username.
382 virtual ProfileSyncService* GetProfileSyncService(
383 const std::string& cros_user) = 0;
384
[email protected]1bd056e2010-04-20 02:03:48385 // Returns the CloudPrintProxyService, creating if not yet created.
386 virtual CloudPrintProxyService* GetCloudPrintProxyService() = 0;
387
initial.commit09911bf2008-07-26 23:55:29388 // Return whether 2 profiles are the same. 2 profiles are the same if they
389 // represent the same profile. This can happen if there is pointer equality
390 // or if one profile is the off the record version of another profile (or vice
391 // versa).
392 virtual bool IsSameProfile(Profile* profile) = 0;
393
394 // Returns the time the profile was started. This is not the time the profile
395 // was created, rather it is the time the user started chrome and logged into
396 // this profile. For the single profile case, this corresponds to the time
397 // the user started chrome.
[email protected]e1acf6f2008-10-27 20:43:33398 virtual base::Time GetStartTime() const = 0;
initial.commit09911bf2008-07-26 23:55:29399
400 // Returns the TabRestoreService. This returns NULL when off the record.
401 virtual TabRestoreService* GetTabRestoreService() = 0;
402
403 virtual void ResetTabRestoreService() = 0;
404
[email protected]85c55dc2009-11-06 03:05:46405 // May return NULL.
406 virtual SpellCheckHost* GetSpellCheckHost() = 0;
407
408 // If |force| is false, and the spellchecker is already initialized (or is in
409 // the process of initializing), then do nothing. Otherwise clobber the
410 // current spellchecker and replace it with a new one.
411 virtual void ReinitializeSpellCheckHost(bool force) = 0;
[email protected]85c55dc2009-11-06 03:05:46412
[email protected]3bf335a2009-06-26 20:46:06413 // Returns the WebKitContext assigned to this profile.
414 virtual WebKitContext* GetWebKitContext() = 0;
415
[email protected]4bb336302009-10-12 05:44:26416 // Returns the provider of desktop notifications for this profile.
417 virtual DesktopNotificationService* GetDesktopNotificationService() = 0;
418
[email protected]398206c2010-06-21 01:46:08419 // Returns the service that manages BackgroundContents for this profile.
420 virtual BackgroundContentsService* GetBackgroundContentsService() = 0;
421
[email protected]4c793f02010-08-18 20:55:45422 // Returns the StatusTray, which provides an API for displaying status icons
423 // in the system status tray. Returns NULL if status icons are not supported
424 // on this platform (or this is a unit test).
425 virtual StatusTray* GetStatusTray() = 0;
426
initial.commit09911bf2008-07-26 23:55:29427 // Marks the profile as cleanly shutdown.
428 //
429 // NOTE: this is invoked internally on a normal shutdown, but is public so
430 // that it can be invoked when the user logs out/powers down (WM_ENDSESSION).
[email protected]f0a51fb52009-03-05 12:46:38431 virtual void MarkAsCleanShutdown() = 0;
[email protected]bdbc87c2009-01-25 05:08:54432
433 virtual void InitExtensions() = 0;
434
[email protected]0ef69c72010-09-21 01:00:34435 // Start up service that gathers data from a web resource feed.
436 virtual void InitWebResources() = 0;
437
[email protected]9c8dd902009-11-19 17:50:42438 // Returns the new tab page resource cache.
439 virtual NTPResourceCache* GetNTPResourceCache() = 0;
440
[email protected]35896a32010-06-09 08:42:51441 // Returns the last directory that was chosen for uploading or opening a file.
442 virtual FilePath last_selected_directory() = 0;
443 virtual void set_last_selected_directory(const FilePath& path) = 0;
444
[email protected]22339b12010-08-27 18:29:24445 // Returns a pointer to the ChromeBlobStorageContext instance for this
446 // profile.
447 virtual ChromeBlobStorageContext* GetBlobStorageContext() = 0;
448
[email protected]f50278cd2010-08-24 17:34:08449#if defined(OS_CHROMEOS)
450 // Returns ChromeOS's ProxyConfigServiceImpl, creating if not yet created.
451 virtual chromeos::ProxyConfigServiceImpl*
452 GetChromeOSProxyConfigServiceImpl() = 0;
453#endif // defined(OS_CHROMEOS)
454
initial.commit09911bf2008-07-26 23:55:29455#ifdef UNIT_TEST
456 // Use with caution. GetDefaultRequestContext may be called on any thread!
[email protected]be180c802009-10-23 06:33:31457 static void set_default_request_context(URLRequestContextGetter* c) {
initial.commit09911bf2008-07-26 23:55:29458 default_request_context_ = c;
459 }
460#endif
461
[email protected]ea6f76572008-12-18 00:09:55462 // Did the user restore the last session? This is set by SessionRestore.
463 void set_restored_last_session(bool restored_last_session) {
464 restored_last_session_ = restored_last_session;
465 }
466 bool restored_last_session() const {
467 return restored_last_session_;
468 }
469
[email protected]5cbe1e22010-01-30 01:18:56470 // Stop sending accessibility events until ResumeAccessibilityEvents().
471 // Calls to Pause nest; no events will be sent until the number of
472 // Resume calls matches the number of Pause calls received.
473 void PauseAccessibilityEvents() {
474 accessibility_pause_level_++;
475 }
476
477 void ResumeAccessibilityEvents() {
478 DCHECK(accessibility_pause_level_ > 0);
479 accessibility_pause_level_--;
480 }
481
482 bool ShouldSendAccessibilityEvents() {
483 return 0 == accessibility_pause_level_;
484 }
485
[email protected]d3b98c82010-07-14 07:45:59486 // Checks whether sync is configurable by the user. Returns false if sync is
487 // disabled or controlled by configuration management.
488 bool IsSyncAccessible();
489
[email protected]5a0b42e2010-07-30 23:42:59490 // Creates an OffTheRecordProfile which points to this Profile.
491 Profile* CreateOffTheRecordProfile();
492
initial.commit09911bf2008-07-26 23:55:29493 protected:
[email protected]be180c802009-10-23 06:33:31494 static URLRequestContextGetter* default_request_context_;
[email protected]ea6f76572008-12-18 00:09:55495
496 private:
497 bool restored_last_session_;
[email protected]5cbe1e22010-01-30 01:18:56498
499 // Accessibility events will only be propagated when the pause
500 // level is zero. PauseAccessibilityEvents and ResumeAccessibilityEvents
501 // increment and decrement the level, respectively, rather than set it to
502 // true or false, so that calls can be nested.
503 int accessibility_pause_level_;
initial.commit09911bf2008-07-26 23:55:29504};
505
[email protected]bfd04a62009-02-01 18:16:56506#endif // CHROME_BROWSER_PROFILE_H_