| 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 #pragma once | 9 #pragma once |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 namespace history { | 74 namespace history { |
| 75 class TopSites; | 75 class TopSites; |
| 76 class ShortcutsBackend; | 76 class ShortcutsBackend; |
| 77 } | 77 } |
| 78 | 78 |
| 79 namespace net { | 79 namespace net { |
| 80 class SSLConfigService; | 80 class SSLConfigService; |
| 81 } | 81 } |
| 82 | 82 |
| 83 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) | |
| 84 // Local profile ids are used to associate resources stored outside the profile | |
| 85 // directory, like saved passwords in GNOME Keyring / KWallet, with a profile. | |
| 86 // With high probability, they are unique on the local machine. They are almost | |
| 87 // certainly not unique globally, by design. Do not send them over the network. | |
| 88 typedef int LocalProfileId; | |
| 89 #endif | |
| 90 | |
| 91 class Profile : public content::BrowserContext { | 83 class Profile : public content::BrowserContext { |
| 92 public: | 84 public: |
| 93 // Profile services are accessed with the following parameter. This parameter | 85 // Profile services are accessed with the following parameter. This parameter |
| 94 // defines what the caller plans to do with the service. | 86 // defines what the caller plans to do with the service. |
| 95 // The caller is responsible for not performing any operation that would | 87 // The caller is responsible for not performing any operation that would |
| 96 // result in persistent implicit records while using an OffTheRecord profile. | 88 // result in persistent implicit records while using an OffTheRecord profile. |
| 97 // This flag allows the profile to perform an additional check. | 89 // This flag allows the profile to perform an additional check. |
| 98 // | 90 // |
| 99 // It also gives us an opportunity to perform further checks in the future. We | 91 // It also gives us an opportunity to perform further checks in the future. We |
| 100 // could, for example, return an history service that only allow some specific | 92 // could, for example, return an history service that only allow some specific |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 friend class chromeos::ResetDefaultProxyConfigServiceTask; | 138 friend class chromeos::ResetDefaultProxyConfigServiceTask; |
| 147 | 139 |
| 148 static net::URLRequestContextGetter* GetDefaultRequestContext() { | 140 static net::URLRequestContextGetter* GetDefaultRequestContext() { |
| 149 return Profile::GetDefaultRequestContext(); | 141 return Profile::GetDefaultRequestContext(); |
| 150 } | 142 } |
| 151 }; | 143 }; |
| 152 | 144 |
| 153 // Key used to bind profile to the widget with which it is associated. | 145 // Key used to bind profile to the widget with which it is associated. |
| 154 static const char* const kProfileKey; | 146 static const char* const kProfileKey; |
| 155 | 147 |
| 156 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) | |
| 157 // Value that represents no local profile id. | |
| 158 static const LocalProfileId kInvalidLocalProfileId; | |
| 159 #endif | |
| 160 | |
| 161 Profile(); | 148 Profile(); |
| 162 virtual ~Profile() {} | 149 virtual ~Profile() {} |
| 163 | 150 |
| 164 // Profile prefs are registered as soon as the prefs are loaded for the first | 151 // Profile prefs are registered as soon as the prefs are loaded for the first |
| 165 // time. | 152 // time. |
| 166 static void RegisterUserPrefs(PrefService* prefs); | 153 static void RegisterUserPrefs(PrefService* prefs); |
| 167 | 154 |
| 168 // Create a new profile given a path. | 155 // Create a new profile given a path. |
| 169 static Profile* CreateProfile(const FilePath& path); | 156 static Profile* CreateProfile(const FilePath& path); |
| 170 | 157 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 // sure they refcount the returned value. | 281 // sure they refcount the returned value. |
| 295 // | 282 // |
| 296 // |access| defines what the caller plans to do with the service. See | 283 // |access| defines what the caller plans to do with the service. See |
| 297 // the ServiceAccessType definition above. | 284 // the ServiceAccessType definition above. |
| 298 virtual WebDataService* GetWebDataService(ServiceAccessType access) = 0; | 285 virtual WebDataService* GetWebDataService(ServiceAccessType access) = 0; |
| 299 | 286 |
| 300 // Similar to GetWebDataService(), but won't create the web data service if it | 287 // Similar to GetWebDataService(), but won't create the web data service if it |
| 301 // doesn't already exist. | 288 // doesn't already exist. |
| 302 virtual WebDataService* GetWebDataServiceWithoutCreating() = 0; | 289 virtual WebDataService* GetWebDataServiceWithoutCreating() = 0; |
| 303 | 290 |
| 304 // Returns the PasswordStore for this profile. This is owned by the Profile. | |
| 305 // This may return NULL if the implementation is unable to create a | |
| 306 // password store (e.g. a corrupt database). | |
| 307 virtual PasswordStore* GetPasswordStore(ServiceAccessType access) = 0; | |
| 308 | |
| 309 // Retrieves a pointer to the PrefService that manages the preferences | 291 // Retrieves a pointer to the PrefService that manages the preferences |
| 310 // for this user profile. The PrefService is lazily created the first | 292 // for this user profile. The PrefService is lazily created the first |
| 311 // time that this method is called. | 293 // time that this method is called. |
| 312 virtual PrefService* GetPrefs() = 0; | 294 virtual PrefService* GetPrefs() = 0; |
| 313 | 295 |
| 314 // Retrieves a pointer to the PrefService that manages the preferences | 296 // Retrieves a pointer to the PrefService that manages the preferences |
| 315 // for OffTheRecord Profiles. This PrefService is lazily created the first | 297 // for OffTheRecord Profiles. This PrefService is lazily created the first |
| 316 // time that this method is called. | 298 // time that this method is called. |
| 317 virtual PrefService* GetOffTheRecordPrefs() = 0; | 299 virtual PrefService* GetOffTheRecordPrefs() = 0; |
| 318 | 300 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 struct hash<Profile*> { | 500 struct hash<Profile*> { |
| 519 std::size_t operator()(Profile* const& p) const { | 501 std::size_t operator()(Profile* const& p) const { |
| 520 return reinterpret_cast<std::size_t>(p); | 502 return reinterpret_cast<std::size_t>(p); |
| 521 } | 503 } |
| 522 }; | 504 }; |
| 523 | 505 |
| 524 } // namespace BASE_HASH_NAMESPACE | 506 } // namespace BASE_HASH_NAMESPACE |
| 525 #endif | 507 #endif |
| 526 | 508 |
| 527 #endif // CHROME_BROWSER_PROFILES_PROFILE_H_ | 509 #endif // CHROME_BROWSER_PROFILES_PROFILE_H_ |
| OLD | NEW |