[email protected] | e284e6d8 | 2010-01-29 19:49:45 | [diff] [blame] | 1 | // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
| 5 | // This class gathers state related to a single user profile. |
| 6 | |
[email protected] | bfd04a6 | 2009-02-01 18:16:56 | [diff] [blame] | 7 | #ifndef CHROME_BROWSER_PROFILE_H_ |
| 8 | #define CHROME_BROWSER_PROFILE_H_ |
[email protected] | 32b76ef | 2010-07-26 23:08:24 | [diff] [blame] | 9 | #pragma once |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 10 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 11 | #include "base/basictypes.h" |
[email protected] | ca5e740 | 2010-08-19 17:22:47 | [diff] [blame] | 12 | #include "base/logging.h" |
[email protected] | e5047ff | 2010-07-31 00:18:25 | [diff] [blame] | 13 | |
[email protected] | ca5e740 | 2010-08-19 17:22:47 | [diff] [blame] | 14 | namespace base { |
| 15 | class Time; |
| 16 | } |
[email protected] | f50278cd | 2010-08-24 17:34:08 | [diff] [blame] | 17 | |
| 18 | #if defined(OS_CHROMEOS) |
| 19 | namespace chromeos { |
| 20 | class ProxyConfigServiceImpl; |
| 21 | } |
| 22 | #endif |
| 23 | |
[email protected] | 523623c | 2010-05-19 16:03:42 | [diff] [blame] | 24 | namespace history { |
| 25 | class TopSites; |
| 26 | } |
| 27 | |
[email protected] | a9cea754 | 2009-05-20 04:30:23 | [diff] [blame] | 28 | namespace net { |
[email protected] | 326e679 | 2009-12-11 21:04:42 | [diff] [blame] | 29 | class TransportSecurityState; |
[email protected] | db36938c | 2009-08-19 21:48:42 | [diff] [blame] | 30 | class SSLConfigService; |
[email protected] | a9cea754 | 2009-05-20 04:30:23 | [diff] [blame] | 31 | } |
[email protected] | be180c80 | 2009-10-23 06:33:31 | [diff] [blame] | 32 | |
[email protected] | 2f351cb | 2009-11-09 23:43:34 | [diff] [blame] | 33 | namespace webkit_database { |
| 34 | class DatabaseTracker; |
| 35 | } |
| 36 | |
[email protected] | 69c579e | 2010-04-23 20:01:00 | [diff] [blame] | 37 | class AutocompleteClassifier; |
[email protected] | 398206c | 2010-06-21 01:46:08 | [diff] [blame] | 38 | class BackgroundContentsService; |
[email protected] | 4c793f0 | 2010-08-18 20:55:45 | [diff] [blame] | 39 | class BackgroundModeManager; |
[email protected] | d8e41ed | 2008-09-11 15:22:32 | [diff] [blame] | 40 | class BookmarkModel; |
[email protected] | 44947830 | 2009-06-09 20:04:28 | [diff] [blame] | 41 | class BrowserThemeProvider; |
[email protected] | 02a5cdb | 2010-08-11 20:47:32 | [diff] [blame] | 42 | class ChromeAppCacheService; |
[email protected] | 22339b1 | 2010-08-27 18:29:24 | [diff] [blame] | 43 | class ChromeBlobStorageContext; |
[email protected] | be180c80 | 2009-10-23 06:33:31 | [diff] [blame] | 44 | class ChromeURLRequestContextGetter; |
[email protected] | 4bb33630 | 2009-10-12 05:44:26 | [diff] [blame] | 45 | class DesktopNotificationService; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 46 | class DownloadManager; |
[email protected] | 4a19063 | 2009-05-09 01:07:42 | [diff] [blame] | 47 | class Extension; |
[email protected] | 89ebc7e | 2009-08-24 22:11:07 | [diff] [blame] | 48 | class ExtensionDevToolsManager; |
[email protected] | 481e1a4 | 2009-05-06 20:56:05 | [diff] [blame] | 49 | class ExtensionProcessManager; |
[email protected] | 7120f13 | 2009-07-20 21:05:37 | [diff] [blame] | 50 | class ExtensionMessageService; |
[email protected] | 6014d67 | 2008-12-05 00:38:25 | [diff] [blame] | 51 | class ExtensionsService; |
[email protected] | 0189bc72 | 2009-08-28 21:56:48 | [diff] [blame] | 52 | class FaviconService; |
[email protected] | 864b136 | 2010-08-19 03:49:38 | [diff] [blame] | 53 | class FilePath; |
[email protected] | c44b790 | 2010-08-27 21:24:43 | [diff] [blame] | 54 | class FileSystemHostContext; |
[email protected] | e5d2f713 | 2010-04-09 18:13:53 | [diff] [blame] | 55 | class FindBarState; |
[email protected] | aee541e | 2010-03-19 01:52:45 | [diff] [blame] | 56 | class GeolocationContentSettingsMap; |
[email protected] | 8b4b84ee | 2010-05-11 13:08:52 | [diff] [blame] | 57 | class GeolocationPermissionContext; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 58 | class HistoryService; |
[email protected] | e284e6d8 | 2010-01-29 19:49:45 | [diff] [blame] | 59 | class HostContentSettingsMap; |
[email protected] | 40bd658 | 2009-12-04 23:49:51 | [diff] [blame] | 60 | class HostZoomMap; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 61 | class NavigationController; |
[email protected] | 9c8dd90 | 2009-11-19 17:50:42 | [diff] [blame] | 62 | class NTPResourceCache; |
[email protected] | e69d3395 | 2009-06-03 22:00:41 | [diff] [blame] | 63 | class PasswordStore; |
[email protected] | def1171 | 2009-11-06 00:42:15 | [diff] [blame] | 64 | class PersonalDataManager; |
[email protected] | 911f815 | 2010-03-18 16:46:40 | [diff] [blame] | 65 | class PinnedTabService; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 66 | class PrefService; |
[email protected] | 48352c1 | 2009-08-15 01:19:11 | [diff] [blame] | 67 | class ProfileSyncService; |
[email protected] | 4aea04a | 2010-02-10 20:13:43 | [diff] [blame] | 68 | class ProfileSyncFactory; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 69 | class SessionService; |
[email protected] | 9c92d19 | 2009-12-02 08:03:16 | [diff] [blame] | 70 | class SpellCheckHost; |
[email protected] | db36938c | 2009-08-19 21:48:42 | [diff] [blame] | 71 | class SSLConfigServiceManager; |
[email protected] | 34cc84f | 2009-02-13 10:04:35 | [diff] [blame] | 72 | class SSLHostState; |
[email protected] | 4c793f0 | 2010-08-18 20:55:45 | [diff] [blame] | 73 | class StatusTray; |
[email protected] | 326e679 | 2009-12-11 21:04:42 | [diff] [blame] | 74 | class TransportSecurityPersister; |
[email protected] | 47accfd6 | 2009-05-14 18:46:21 | [diff] [blame] | 75 | class SQLitePersistentCookieStore; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 76 | class TabRestoreService; |
| 77 | class TemplateURLFetcher; |
| 78 | class TemplateURLModel; |
[email protected] | 2735e369 | 2009-09-25 18:19:39 | [diff] [blame] | 79 | class ThemeProvider; |
[email protected] | 8e4c2961 | 2010-07-14 01:24:45 | [diff] [blame] | 80 | class TokenService; |
[email protected] | be180c80 | 2009-10-23 06:33:31 | [diff] [blame] | 81 | class URLRequestContextGetter; |
[email protected] | 0938d3c | 2009-01-09 20:37:35 | [diff] [blame] | 82 | class UserScriptMaster; |
[email protected] | 6c32ce7 | 2010-03-08 05:18:06 | [diff] [blame] | 83 | class UserStyleSheetWatcher; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 84 | class VisitedLinkMaster; |
[email protected] | a6d0f18 | 2010-01-12 08:01:44 | [diff] [blame] | 85 | class VisitedLinkEventListener; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 86 | class WebDataService; |
[email protected] | 3bf335a | 2009-06-26 20:46:06 | [diff] [blame] | 87 | class WebKitContext; |
[email protected] | b1748b1d8 | 2009-11-30 20:32:56 | [diff] [blame] | 88 | class WebResourceService; |
[email protected] | 1bd056e | 2010-04-20 02:03:48 | [diff] [blame] | 89 | class CloudPrintProxyService; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 90 | |
[email protected] | 4bf6afd | 2009-10-08 14:00:11 | [diff] [blame] | 91 | typedef intptr_t ProfileId; |
| 92 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 93 | class Profile { |
| 94 | public: |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 95 | // Profile services are accessed with the following parameter. This parameter |
| 96 | // defines what the caller plans to do with the service. |
[email protected] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 97 | // The caller is responsible for not performing any operation that would |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 98 | // 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] | 4bf6afd | 2009-10-08 14:00:11 | [diff] [blame] | 119 | |
| 120 | // Value that represents no profile Id. |
| 121 | static const ProfileId InvalidProfileId; |
| 122 | |
[email protected] | 5cbe1e2 | 2010-01-30 01:18:56 | [diff] [blame] | 123 | Profile() : restored_last_session_(false), accessibility_pause_level_(0) {} |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 124 | 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] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 131 | static Profile* CreateProfile(const FilePath& path); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 132 | |
[email protected] | b3186d0 | 2008-09-15 20:33:14 | [diff] [blame] | 133 | // 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] | be180c80 | 2009-10-23 06:33:31 | [diff] [blame] | 137 | static URLRequestContextGetter* GetDefaultRequestContext(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 138 | |
[email protected] | 4bf6afd | 2009-10-08 14:00:11 | [diff] [blame] | 139 | // 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.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 143 | // Returns the path of the directory where this profile's data is stored. |
[email protected] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 144 | virtual FilePath GetPath() = 0; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 145 | |
| 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] | 860f5549 | 2009-03-27 19:50:59 | [diff] [blame] | 154 | // Destroys the off the record profile. |
| 155 | virtual void DestroyOffTheRecordProfile() = 0; |
| 156 | |
[email protected] | 6c8909c | 2010-07-02 07:31:11 | [diff] [blame] | 157 | // True if an off the record profile exists. |
| 158 | virtual bool HasOffTheRecordProfile() = 0; |
| 159 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 160 | // 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] | 02a5cdb | 2010-08-11 20:47:32 | [diff] [blame] | 164 | // Returns a pointer to the ChromeAppCacheService instance for this profile. |
| 165 | virtual ChromeAppCacheService* GetAppCacheService() = 0; |
| 166 | |
[email protected] | 2f351cb | 2009-11-09 23:43:34 | [diff] [blame] | 167 | // Returns a pointer to the DatabaseTracker instance for this profile. |
| 168 | virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0; |
| 169 | |
[email protected] | 523623c | 2010-05-19 16:03:42 | [diff] [blame] | 170 | // Returns a pointer to the TopSites (thumbnail manager) instance |
| 171 | // for this profile. |
| 172 | virtual history::TopSites* GetTopSites() = 0; |
| 173 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 174 | // 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] | 6014d67 | 2008-12-05 00:38:25 | [diff] [blame] | 179 | // 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] | 0938d3c | 2009-01-09 20:37:35 | [diff] [blame] | 183 | // Retrieves a pointer to the UserScriptMaster associated with this |
| 184 | // profile. The UserScriptMaster is lazily created the first time |
[email protected] | 04fba9a9 | 2008-10-28 17:25:25 | [diff] [blame] | 185 | // that this method is called. |
[email protected] | 0938d3c | 2009-01-09 20:37:35 | [diff] [blame] | 186 | virtual UserScriptMaster* GetUserScriptMaster() = 0; |
[email protected] | 04fba9a9 | 2008-10-28 17:25:25 | [diff] [blame] | 187 | |
[email protected] | 89ebc7e | 2009-08-24 22:11:07 | [diff] [blame] | 188 | // 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] | 481e1a4 | 2009-05-06 20:56:05 | [diff] [blame] | 192 | // 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] | 7120f13 | 2009-07-20 21:05:37 | [diff] [blame] | 196 | // 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] | 34cc84f | 2009-02-13 10:04:35 | [diff] [blame] | 200 | // 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] | 326e679 | 2009-12-11 21:04:42 | [diff] [blame] | 205 | // Retrieves a pointer to the TransportSecurityState associated with |
| 206 | // this profile. The TransportSecurityState is lazily created the |
[email protected] | 77f6fb43 | 2009-09-05 14:21:09 | [diff] [blame] | 207 | // first time that this method is called. |
[email protected] | 326e679 | 2009-12-11 21:04:42 | [diff] [blame] | 208 | virtual net::TransportSecurityState* |
| 209 | GetTransportSecurityState() = 0; |
[email protected] | a9cea754 | 2009-05-20 04:30:23 | [diff] [blame] | 210 | |
[email protected] | 0189bc72 | 2009-08-28 21:56:48 | [diff] [blame] | 211 | // 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.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 224 | // 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] | f7011fcb | 2009-01-28 21:54:32 | [diff] [blame] | 227 | // |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 228 | // 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] | 0850fa6 | 2009-10-08 22:34:29 | [diff] [blame] | 237 | // 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] | 69c579e | 2010-04-23 20:01:00 | [diff] [blame] | 241 | // 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] | 90085af0 | 2009-10-29 17:53:21 | [diff] [blame] | 245 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 246 | // 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] | 9cddbe37 | 2009-10-23 21:23:53 | [diff] [blame] | 254 | // 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] | e69d3395 | 2009-06-03 22:00:41 | [diff] [blame] | 258 | // Returns the PasswordStore for this profile. This is owned by the Profile. |
| 259 | virtual PasswordStore* GetPasswordStore(ServiceAccessType access) = 0; |
| 260 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 261 | // 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] | def1171 | 2009-11-06 00:42:15 | [diff] [blame] | 274 | // Returns the DownloadManager associated with this profile. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 275 | virtual DownloadManager* GetDownloadManager() = 0; |
| 276 | virtual bool HasCreatedDownloadManager() const = 0; |
| 277 | |
[email protected] | def1171 | 2009-11-06 00:42:15 | [diff] [blame] | 278 | // Returns the PersonalDataManager associated with this profile. |
| 279 | virtual PersonalDataManager* GetPersonalDataManager() = 0; |
| 280 | |
[email protected] | c44b790 | 2010-08-27 21:24:43 | [diff] [blame] | 281 | // Returns the HTML5 FileSystemHostContext assigned to this profile. |
| 282 | virtual FileSystemHostContext* GetFileSystemHostContext() = 0; |
| 283 | |
[email protected] | 4a19063 | 2009-05-09 01:07:42 | [diff] [blame] | 284 | // 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] | a5166af6 | 2009-07-03 00:42:29 | [diff] [blame] | 290 | // Set the theme to the machine's native theme. |
| 291 | virtual void SetNativeTheme() = 0; |
| 292 | |
[email protected] | 4a19063 | 2009-05-09 01:07:42 | [diff] [blame] | 293 | // Clear the theme and reset it to default. |
| 294 | virtual void ClearTheme() = 0; |
| 295 | |
[email protected] | 51c490b | 2009-08-03 16:34:34 | [diff] [blame] | 296 | // 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] | 4a19063 | 2009-05-09 01:07:42 | [diff] [blame] | 300 | // Returns or creates the ThemeProvider associated with this profile |
[email protected] | 5786d3d | 2009-12-18 00:18:44 | [diff] [blame] | 301 | virtual BrowserThemeProvider* GetThemeProvider() = 0; |
[email protected] | 4a19063 | 2009-05-09 01:07:42 | [diff] [blame] | 302 | |
[email protected] | b3186d0 | 2008-09-15 20:33:14 | [diff] [blame] | 303 | // 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] | be180c80 | 2009-10-23 06:33:31 | [diff] [blame] | 306 | virtual URLRequestContextGetter* GetRequestContext() = 0; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 307 | |
[email protected] | e7f2964 | 2009-03-02 22:53:18 | [diff] [blame] | 308 | // Returns the request context for media resources asociated with this |
| 309 | // profile. |
[email protected] | be180c80 | 2009-10-23 06:33:31 | [diff] [blame] | 310 | virtual URLRequestContextGetter* GetRequestContextForMedia() = 0; |
[email protected] | e7f2964 | 2009-03-02 22:53:18 | [diff] [blame] | 311 | |
[email protected] | 47accfd6 | 2009-05-14 18:46:21 | [diff] [blame] | 312 | // Returns the request context used for extension-related requests. This |
| 313 | // is only used for a separate cookie store currently. |
[email protected] | be180c80 | 2009-10-23 06:33:31 | [diff] [blame] | 314 | virtual URLRequestContextGetter* GetRequestContextForExtensions() = 0; |
[email protected] | 47accfd6 | 2009-05-14 18:46:21 | [diff] [blame] | 315 | |
[email protected] | 57a777f7 | 2010-03-31 01:09:42 | [diff] [blame] | 316 | // 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] | db36938c | 2009-08-19 21:48:42 | [diff] [blame] | 328 | // Returns the SSLConfigService for this profile. |
| 329 | virtual net::SSLConfigService* GetSSLConfigService() = 0; |
| 330 | |
[email protected] | e284e6d8 | 2010-01-29 19:49:45 | [diff] [blame] | 331 | // Returns the Hostname <-> Content settings map for this profile. |
| 332 | virtual HostContentSettingsMap* GetHostContentSettingsMap() = 0; |
| 333 | |
[email protected] | 40bd658 | 2009-12-04 23:49:51 | [diff] [blame] | 334 | // Returns the Hostname <-> Zoom Level map for this profile. |
| 335 | virtual HostZoomMap* GetHostZoomMap() = 0; |
| 336 | |
[email protected] | aee541e | 2010-03-19 01:52:45 | [diff] [blame] | 337 | // Returns the geolocation settings map for this profile. |
| 338 | virtual GeolocationContentSettingsMap* GetGeolocationContentSettingsMap() = 0; |
| 339 | |
[email protected] | 8b4b84ee | 2010-05-11 13:08:52 | [diff] [blame] | 340 | // Returns the geolocation permission context for this profile. |
| 341 | virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0; |
| 342 | |
[email protected] | 6c32ce7 | 2010-03-08 05:18:06 | [diff] [blame] | 343 | // Returns the user style sheet watcher. |
| 344 | virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() = 0; |
| 345 | |
[email protected] | e5d2f713 | 2010-04-09 18:13:53 | [diff] [blame] | 346 | // 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.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 350 | // 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.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 368 | // Returns true if the last time this profile was open it was exited cleanly. |
| 369 | virtual bool DidLastSessionExitCleanly() = 0; |
| 370 | |
[email protected] | d8e41ed | 2008-09-11 15:22:32 | [diff] [blame] | 371 | // Returns the BookmarkModel, creating if not yet created. |
| 372 | virtual BookmarkModel* GetBookmarkModel() = 0; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 373 | |
[email protected] | 8e4c2961 | 2010-07-14 01:24:45 | [diff] [blame] | 374 | // Returns the Gaia Token Service, creating if not yet created. |
| 375 | virtual TokenService* GetTokenService() = 0; |
| 376 | |
[email protected] | 48352c1 | 2009-08-15 01:19:11 | [diff] [blame] | 377 | // Returns the ProfileSyncService, creating if not yet created. |
| 378 | virtual ProfileSyncService* GetProfileSyncService() = 0; |
[email protected] | 3a453fa | 2008-08-15 18:46:34 | [diff] [blame] | 379 | |
[email protected] | e8234d3 | 2010-09-09 20:36:39 | [diff] [blame] | 380 | // 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] | 1bd056e | 2010-04-20 02:03:48 | [diff] [blame] | 385 | // Returns the CloudPrintProxyService, creating if not yet created. |
| 386 | virtual CloudPrintProxyService* GetCloudPrintProxyService() = 0; |
| 387 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 388 | // 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] | e1acf6f | 2008-10-27 20:43:33 | [diff] [blame] | 398 | virtual base::Time GetStartTime() const = 0; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 399 | |
| 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] | 85c55dc | 2009-11-06 03:05:46 | [diff] [blame] | 405 | // 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] | 85c55dc | 2009-11-06 03:05:46 | [diff] [blame] | 412 | |
[email protected] | 3bf335a | 2009-06-26 20:46:06 | [diff] [blame] | 413 | // Returns the WebKitContext assigned to this profile. |
| 414 | virtual WebKitContext* GetWebKitContext() = 0; |
| 415 | |
[email protected] | 4bb33630 | 2009-10-12 05:44:26 | [diff] [blame] | 416 | // Returns the provider of desktop notifications for this profile. |
| 417 | virtual DesktopNotificationService* GetDesktopNotificationService() = 0; |
| 418 | |
[email protected] | 398206c | 2010-06-21 01:46:08 | [diff] [blame] | 419 | // Returns the service that manages BackgroundContents for this profile. |
| 420 | virtual BackgroundContentsService* GetBackgroundContentsService() = 0; |
| 421 | |
[email protected] | 4c793f0 | 2010-08-18 20:55:45 | [diff] [blame] | 422 | // 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.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 427 | // 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] | f0a51fb5 | 2009-03-05 12:46:38 | [diff] [blame] | 431 | virtual void MarkAsCleanShutdown() = 0; |
[email protected] | bdbc87c | 2009-01-25 05:08:54 | [diff] [blame] | 432 | |
| 433 | virtual void InitExtensions() = 0; |
| 434 | |
[email protected] | 0ef69c7 | 2010-09-21 01:00:34 | [diff] [blame] | 435 | // Start up service that gathers data from a web resource feed. |
| 436 | virtual void InitWebResources() = 0; |
| 437 | |
[email protected] | 9c8dd90 | 2009-11-19 17:50:42 | [diff] [blame] | 438 | // Returns the new tab page resource cache. |
| 439 | virtual NTPResourceCache* GetNTPResourceCache() = 0; |
| 440 | |
[email protected] | 35896a3 | 2010-06-09 08:42:51 | [diff] [blame] | 441 | // 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] | 22339b1 | 2010-08-27 18:29:24 | [diff] [blame] | 445 | // Returns a pointer to the ChromeBlobStorageContext instance for this |
| 446 | // profile. |
| 447 | virtual ChromeBlobStorageContext* GetBlobStorageContext() = 0; |
| 448 | |
[email protected] | f50278cd | 2010-08-24 17:34:08 | [diff] [blame] | 449 | #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.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 455 | #ifdef UNIT_TEST |
| 456 | // Use with caution. GetDefaultRequestContext may be called on any thread! |
[email protected] | be180c80 | 2009-10-23 06:33:31 | [diff] [blame] | 457 | static void set_default_request_context(URLRequestContextGetter* c) { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 458 | default_request_context_ = c; |
| 459 | } |
| 460 | #endif |
| 461 | |
[email protected] | ea6f7657 | 2008-12-18 00:09:55 | [diff] [blame] | 462 | // 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] | 5cbe1e2 | 2010-01-30 01:18:56 | [diff] [blame] | 470 | // 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] | d3b98c8 | 2010-07-14 07:45:59 | [diff] [blame] | 486 | // 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] | 5a0b42e | 2010-07-30 23:42:59 | [diff] [blame] | 490 | // Creates an OffTheRecordProfile which points to this Profile. |
| 491 | Profile* CreateOffTheRecordProfile(); |
| 492 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 493 | protected: |
[email protected] | be180c80 | 2009-10-23 06:33:31 | [diff] [blame] | 494 | static URLRequestContextGetter* default_request_context_; |
[email protected] | ea6f7657 | 2008-12-18 00:09:55 | [diff] [blame] | 495 | |
| 496 | private: |
| 497 | bool restored_last_session_; |
[email protected] | 5cbe1e2 | 2010-01-30 01:18:56 | [diff] [blame] | 498 | |
| 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.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 504 | }; |
| 505 | |
[email protected] | bfd04a6 | 2009-02-01 18:16:56 | [diff] [blame] | 506 | #endif // CHROME_BROWSER_PROFILE_H_ |