| 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 // 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 #pragma once | 9 #pragma once |
| 10 | 10 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // The caller is responsible for not performing any operation that would | 116 // The caller is responsible for not performing any operation that would |
| 117 // result in persistent implicit records while using an OffTheRecord profile. | 117 // result in persistent implicit records while using an OffTheRecord profile. |
| 118 // This flag allows the profile to perform an additional check. | 118 // This flag allows the profile to perform an additional check. |
| 119 // | 119 // |
| 120 // It also gives us an opportunity to perform further checks in the future. We | 120 // It also gives us an opportunity to perform further checks in the future. We |
| 121 // could, for example, return an history service that only allow some specific | 121 // could, for example, return an history service that only allow some specific |
| 122 // methods. | 122 // methods. |
| 123 enum ServiceAccessType { | 123 enum ServiceAccessType { |
| 124 // The caller plans to perform a read or write that takes place as a result | 124 // The caller plans to perform a read or write that takes place as a result |
| 125 // of the user input. Use this flag when the operation you are doing can be | 125 // of the user input. Use this flag when the operation you are doing can be |
| 126 // performed while off the record. (ex: creating a bookmark) | 126 // performed while incognito. (ex: creating a bookmark) |
| 127 // | 127 // |
| 128 // Since EXPLICIT_ACCESS means "as a result of a user action", this request | 128 // Since EXPLICIT_ACCESS means "as a result of a user action", this request |
| 129 // always succeeds. | 129 // always succeeds. |
| 130 EXPLICIT_ACCESS, | 130 EXPLICIT_ACCESS, |
| 131 | 131 |
| 132 // The caller plans to call a method that will permanently change some data | 132 // The caller plans to call a method that will permanently change some data |
| 133 // in the profile, as part of Chrome's implicit data logging. Use this flag | 133 // in the profile, as part of Chrome's implicit data logging. Use this flag |
| 134 // when you are about to perform an operation which is incompatible with the | 134 // when you are about to perform an operation which is incompatible with the |
| 135 // off the record mode. | 135 // incognito mode. |
| 136 IMPLICIT_ACCESS | 136 IMPLICIT_ACCESS |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 // Key used to bind profile to the widget with which it is associated. | 139 // Key used to bind profile to the widget with which it is associated. |
| 140 static const char* kProfileKey; | 140 static const char* kProfileKey; |
| 141 | 141 |
| 142 // Value that represents no profile Id. | 142 // Value that represents no profile Id. |
| 143 static const ProfileId kInvalidProfileId; | 143 static const ProfileId kInvalidProfileId; |
| 144 | 144 |
| 145 Profile(); | 145 Profile(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 158 // NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE. | 158 // NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE. |
| 159 static URLRequestContextGetter* GetDefaultRequestContext(); | 159 static URLRequestContextGetter* GetDefaultRequestContext(); |
| 160 | 160 |
| 161 // Returns a unique Id that can be used to identify this profile at runtime. | 161 // Returns a unique Id that can be used to identify this profile at runtime. |
| 162 // This Id is not persistent and will not survive a restart of the browser. | 162 // This Id is not persistent and will not survive a restart of the browser. |
| 163 virtual ProfileId GetRuntimeId() = 0; | 163 virtual ProfileId GetRuntimeId() = 0; |
| 164 | 164 |
| 165 // Returns the path of the directory where this profile's data is stored. | 165 // Returns the path of the directory where this profile's data is stored. |
| 166 virtual FilePath GetPath() = 0; | 166 virtual FilePath GetPath() = 0; |
| 167 | 167 |
| 168 // Return whether this profile is off the record. Default is false. | 168 // Return whether this profile is incognito. Default is false. |
| 169 virtual bool IsOffTheRecord() = 0; | 169 virtual bool IsOffTheRecord() = 0; |
| 170 | 170 |
| 171 // Return the off the record version of this profile. The returned pointer | 171 // Return the incognito version of this profile. The returned pointer |
| 172 // is owned by the receiving profile. If the receiving profile is off the | 172 // is owned by the receiving profile. If the receiving profile is off the |
| 173 // record, the same profile is returned. | 173 // record, the same profile is returned. |
| 174 virtual Profile* GetOffTheRecordProfile() = 0; | 174 virtual Profile* GetOffTheRecordProfile() = 0; |
| 175 | 175 |
| 176 // Destroys the off the record profile. | 176 // Destroys the incognito profile. |
| 177 virtual void DestroyOffTheRecordProfile() = 0; | 177 virtual void DestroyOffTheRecordProfile() = 0; |
| 178 | 178 |
| 179 // True if an off the record profile exists. | 179 // True if an incognito profile exists. |
| 180 virtual bool HasOffTheRecordProfile() = 0; | 180 virtual bool HasOffTheRecordProfile() = 0; |
| 181 | 181 |
| 182 // Return the original "recording" profile. This method returns this if the | 182 // Return the original "recording" profile. This method returns this if the |
| 183 // profile is not off the record. | 183 // profile is not incognito. |
| 184 virtual Profile* GetOriginalProfile() = 0; | 184 virtual Profile* GetOriginalProfile() = 0; |
| 185 | 185 |
| 186 // Returns a pointer to the ChromeAppCacheService instance for this profile. | 186 // Returns a pointer to the ChromeAppCacheService instance for this profile. |
| 187 virtual ChromeAppCacheService* GetAppCacheService() = 0; | 187 virtual ChromeAppCacheService* GetAppCacheService() = 0; |
| 188 | 188 |
| 189 // Returns a pointer to the DatabaseTracker instance for this profile. | 189 // Returns a pointer to the DatabaseTracker instance for this profile. |
| 190 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0; | 190 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0; |
| 191 | 191 |
| 192 // Returns a pointer to the TopSites (thumbnail manager) instance | 192 // Returns a pointer to the TopSites (thumbnail manager) instance |
| 193 // for this profile. | 193 // for this profile. |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0; | 384 virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0; |
| 385 | 385 |
| 386 // Returns the user style sheet watcher. | 386 // Returns the user style sheet watcher. |
| 387 virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() = 0; | 387 virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() = 0; |
| 388 | 388 |
| 389 // Returns the find bar state for this profile. The find bar state is lazily | 389 // Returns the find bar state for this profile. The find bar state is lazily |
| 390 // created the first time that this method is called. | 390 // created the first time that this method is called. |
| 391 virtual FindBarState* GetFindBarState() = 0; | 391 virtual FindBarState* GetFindBarState() = 0; |
| 392 | 392 |
| 393 // Returns the session service for this profile. This may return NULL. If | 393 // Returns the session service for this profile. This may return NULL. If |
| 394 // this profile supports a session service (it isn't off the record), and | 394 // this profile supports a session service (it isn't incognito), and |
| 395 // the session service hasn't yet been created, this forces creation of | 395 // the session service hasn't yet been created, this forces creation of |
| 396 // the session service. | 396 // the session service. |
| 397 // | 397 // |
| 398 // This returns NULL in two situations: the profile is off the record, or the | 398 // This returns NULL in two situations: the profile is incognito, or the |
| 399 // session service has been explicitly shutdown (browser is exiting). Callers | 399 // session service has been explicitly shutdown (browser is exiting). Callers |
| 400 // should always check the return value for NULL. | 400 // should always check the return value for NULL. |
| 401 virtual SessionService* GetSessionService() = 0; | 401 virtual SessionService* GetSessionService() = 0; |
| 402 | 402 |
| 403 // If this profile has a session service, it is shut down. To properly record | 403 // If this profile has a session service, it is shut down. To properly record |
| 404 // the current state this forces creation of the session service, then shuts | 404 // the current state this forces creation of the session service, then shuts |
| 405 // it down. | 405 // it down. |
| 406 virtual void ShutdownSessionService() = 0; | 406 virtual void ShutdownSessionService() = 0; |
| 407 | 407 |
| 408 // Returns true if this profile has a session service. | 408 // Returns true if this profile has a session service. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 429 // Returns the ProfileSyncService, creating if not yet created, with | 429 // Returns the ProfileSyncService, creating if not yet created, with |
| 430 // the specified CrOS username. | 430 // the specified CrOS username. |
| 431 virtual ProfileSyncService* GetProfileSyncService( | 431 virtual ProfileSyncService* GetProfileSyncService( |
| 432 const std::string& cros_user) = 0; | 432 const std::string& cros_user) = 0; |
| 433 | 433 |
| 434 // Returns the CloudPrintProxyService, creating if not yet created. | 434 // Returns the CloudPrintProxyService, creating if not yet created. |
| 435 virtual CloudPrintProxyService* GetCloudPrintProxyService() = 0; | 435 virtual CloudPrintProxyService* GetCloudPrintProxyService() = 0; |
| 436 | 436 |
| 437 // Return whether 2 profiles are the same. 2 profiles are the same if they | 437 // Return whether 2 profiles are the same. 2 profiles are the same if they |
| 438 // represent the same profile. This can happen if there is pointer equality | 438 // represent the same profile. This can happen if there is pointer equality |
| 439 // or if one profile is the off the record version of another profile (or vice | 439 // or if one profile is the incognito version of another profile (or vice |
| 440 // versa). | 440 // versa). |
| 441 virtual bool IsSameProfile(Profile* profile) = 0; | 441 virtual bool IsSameProfile(Profile* profile) = 0; |
| 442 | 442 |
| 443 // Returns the time the profile was started. This is not the time the profile | 443 // Returns the time the profile was started. This is not the time the profile |
| 444 // was created, rather it is the time the user started chrome and logged into | 444 // was created, rather it is the time the user started chrome and logged into |
| 445 // this profile. For the single profile case, this corresponds to the time | 445 // this profile. For the single profile case, this corresponds to the time |
| 446 // the user started chrome. | 446 // the user started chrome. |
| 447 virtual base::Time GetStartTime() const = 0; | 447 virtual base::Time GetStartTime() const = 0; |
| 448 | 448 |
| 449 // Returns the TabRestoreService. This returns NULL when off the record. | 449 // Returns the TabRestoreService. This returns NULL when incognito. |
| 450 virtual TabRestoreService* GetTabRestoreService() = 0; | 450 virtual TabRestoreService* GetTabRestoreService() = 0; |
| 451 | 451 |
| 452 virtual void ResetTabRestoreService() = 0; | 452 virtual void ResetTabRestoreService() = 0; |
| 453 | 453 |
| 454 // May return NULL. | 454 // May return NULL. |
| 455 virtual SpellCheckHost* GetSpellCheckHost() = 0; | 455 virtual SpellCheckHost* GetSpellCheckHost() = 0; |
| 456 | 456 |
| 457 // If |force| is false, and the spellchecker is already initialized (or is in | 457 // If |force| is false, and the spellchecker is already initialized (or is in |
| 458 // the process of initializing), then do nothing. Otherwise clobber the | 458 // the process of initializing), then do nothing. Otherwise clobber the |
| 459 // current spellchecker and replace it with a new one. | 459 // current spellchecker and replace it with a new one. |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 bool restored_last_session_; | 600 bool restored_last_session_; |
| 601 | 601 |
| 602 // Accessibility events will only be propagated when the pause | 602 // Accessibility events will only be propagated when the pause |
| 603 // level is zero. PauseAccessibilityEvents and ResumeAccessibilityEvents | 603 // level is zero. PauseAccessibilityEvents and ResumeAccessibilityEvents |
| 604 // increment and decrement the level, respectively, rather than set it to | 604 // increment and decrement the level, respectively, rather than set it to |
| 605 // true or false, so that calls can be nested. | 605 // true or false, so that calls can be nested. |
| 606 int accessibility_pause_level_; | 606 int accessibility_pause_level_; |
| 607 }; | 607 }; |
| 608 | 608 |
| 609 #endif // CHROME_BROWSER_PROFILES_PROFILE_H_ | 609 #endif // CHROME_BROWSER_PROFILES_PROFILE_H_ |
| OLD | NEW |