| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 friend class chromeos::ResetDefaultProxyConfigServiceTask; | 145 friend class chromeos::ResetDefaultProxyConfigServiceTask; |
| 154 | 146 |
| 155 static net::URLRequestContextGetter* GetDefaultRequestContext() { | 147 static net::URLRequestContextGetter* GetDefaultRequestContext() { |
| 156 return Profile::GetDefaultRequestContext(); | 148 return Profile::GetDefaultRequestContext(); |
| 157 } | 149 } |
| 158 }; | 150 }; |
| 159 | 151 |
| 160 // Key used to bind profile to the widget with which it is associated. | 152 // Key used to bind profile to the widget with which it is associated. |
| 161 static const char* const kProfileKey; | 153 static const char* const kProfileKey; |
| 162 | 154 |
| 163 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) | |
| 164 // Value that represents no local profile id. | |
| 165 static const LocalProfileId kInvalidLocalProfileId; | |
| 166 #endif | |
| 167 | |
| 168 Profile(); | 155 Profile(); |
| 169 virtual ~Profile() {} | 156 virtual ~Profile() {} |
| 170 | 157 |
| 171 // Profile prefs are registered as soon as the prefs are loaded for the first | 158 // Profile prefs are registered as soon as the prefs are loaded for the first |
| 172 // time. | 159 // time. |
| 173 static void RegisterUserPrefs(PrefService* prefs); | 160 static void RegisterUserPrefs(PrefService* prefs); |
| 174 | 161 |
| 175 // Create a new profile given a path. If |async| is true then the profile is | 162 // Create a new profile given a path. If |async| is true then the profile is |
| 176 // initialized asynchronously. | 163 // initialized asynchronously. |
| 177 static Profile* CreateProfile(const FilePath& path, | 164 static Profile* CreateProfile(const FilePath& path, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 // sure they refcount the returned value. | 287 // sure they refcount the returned value. |
| 301 // | 288 // |
| 302 // |access| defines what the caller plans to do with the service. See | 289 // |access| defines what the caller plans to do with the service. See |
| 303 // the ServiceAccessType definition above. | 290 // the ServiceAccessType definition above. |
| 304 virtual WebDataService* GetWebDataService(ServiceAccessType access) = 0; | 291 virtual WebDataService* GetWebDataService(ServiceAccessType access) = 0; |
| 305 | 292 |
| 306 // Similar to GetWebDataService(), but won't create the web data service if it | 293 // Similar to GetWebDataService(), but won't create the web data service if it |
| 307 // doesn't already exist. | 294 // doesn't already exist. |
| 308 virtual WebDataService* GetWebDataServiceWithoutCreating() = 0; | 295 virtual WebDataService* GetWebDataServiceWithoutCreating() = 0; |
| 309 | 296 |
| 310 // Returns the PasswordStore for this profile. This is owned by the Profile. | |
| 311 // This may return NULL if the implementation is unable to create a | |
| 312 // password store (e.g. a corrupt database). | |
| 313 virtual PasswordStore* GetPasswordStore(ServiceAccessType access) = 0; | |
| 314 | |
| 315 // Retrieves a pointer to the PrefService that manages the preferences | 297 // Retrieves a pointer to the PrefService that manages the preferences |
| 316 // for this user profile. The PrefService is lazily created the first | 298 // for this user profile. The PrefService is lazily created the first |
| 317 // time that this method is called. | 299 // time that this method is called. |
| 318 virtual PrefService* GetPrefs() = 0; | 300 virtual PrefService* GetPrefs() = 0; |
| 319 | 301 |
| 320 // Retrieves a pointer to the PrefService that manages the preferences | 302 // Retrieves a pointer to the PrefService that manages the preferences |
| 321 // for OffTheRecord Profiles. This PrefService is lazily created the first | 303 // for OffTheRecord Profiles. This PrefService is lazily created the first |
| 322 // time that this method is called. | 304 // time that this method is called. |
| 323 virtual PrefService* GetOffTheRecordPrefs() = 0; | 305 virtual PrefService* GetOffTheRecordPrefs() = 0; |
| 324 | 306 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 struct hash<Profile*> { | 506 struct hash<Profile*> { |
| 525 std::size_t operator()(Profile* const& p) const { | 507 std::size_t operator()(Profile* const& p) const { |
| 526 return reinterpret_cast<std::size_t>(p); | 508 return reinterpret_cast<std::size_t>(p); |
| 527 } | 509 } |
| 528 }; | 510 }; |
| 529 | 511 |
| 530 } // namespace BASE_HASH_NAMESPACE | 512 } // namespace BASE_HASH_NAMESPACE |
| 531 #endif | 513 #endif |
| 532 | 514 |
| 533 #endif // CHROME_BROWSER_PROFILES_PROFILE_H_ | 515 #endif // CHROME_BROWSER_PROFILES_PROFILE_H_ |
| OLD | NEW |