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 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 17 matching lines...) Expand all Loading... |
28 class PromoCounter; | 28 class PromoCounter; |
29 class ProtocolHandlerRegistry; | 29 class ProtocolHandlerRegistry; |
30 class TestingProfile; | 30 class TestingProfile; |
31 class WebDataService; | 31 class WebDataService; |
32 | 32 |
33 namespace android { | 33 namespace android { |
34 class TabContentsProvider; | 34 class TabContentsProvider; |
35 } | 35 } |
36 | 36 |
37 namespace base { | 37 namespace base { |
| 38 class SequencedTaskRunner; |
38 class Time; | 39 class Time; |
39 } | 40 } |
40 | 41 |
41 namespace chrome_browser_net { | 42 namespace chrome_browser_net { |
42 class Predictor; | 43 class Predictor; |
43 } | 44 } |
44 | 45 |
45 namespace chromeos { | 46 namespace chromeos { |
46 class LibCrosServiceLibraryImpl; | 47 class LibCrosServiceLibraryImpl; |
47 class ResetDefaultProxyConfigServiceTask; | 48 class ResetDefaultProxyConfigServiceTask; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // Key used to bind profile to the widget with which it is associated. | 134 // Key used to bind profile to the widget with which it is associated. |
134 static const char* const kProfileKey; | 135 static const char* const kProfileKey; |
135 | 136 |
136 Profile(); | 137 Profile(); |
137 virtual ~Profile() {} | 138 virtual ~Profile() {} |
138 | 139 |
139 // Profile prefs are registered as soon as the prefs are loaded for the first | 140 // Profile prefs are registered as soon as the prefs are loaded for the first |
140 // time. | 141 // time. |
141 static void RegisterUserPrefs(PrefService* prefs); | 142 static void RegisterUserPrefs(PrefService* prefs); |
142 | 143 |
| 144 // Gets task runner for I/O operations associated with |profile|. |
| 145 static scoped_refptr<base::SequencedTaskRunner> GetTaskRunnerForProfile( |
| 146 Profile* profile); |
| 147 |
143 // Create a new profile given a path. If |create_mode| is | 148 // Create a new profile given a path. If |create_mode| is |
144 // CREATE_MODE_ASYNCHRONOUS then the profile is initialized asynchronously. | 149 // CREATE_MODE_ASYNCHRONOUS then the profile is initialized asynchronously. |
145 static Profile* CreateProfile(const FilePath& path, | 150 static Profile* CreateProfile(const FilePath& path, |
146 Delegate* delegate, | 151 Delegate* delegate, |
147 CreateMode create_mode); | 152 CreateMode create_mode); |
148 | 153 |
149 // Returns the profile corresponding to the given browser context. | 154 // Returns the profile corresponding to the given browser context. |
150 static Profile* FromBrowserContext(content::BrowserContext* browser_context); | 155 static Profile* FromBrowserContext(content::BrowserContext* browser_context); |
151 | 156 |
152 // Returns the profile corresponding to the given WebUI. | 157 // Returns the profile corresponding to the given WebUI. |
153 static Profile* FromWebUI(content::WebUI* web_ui); | 158 static Profile* FromWebUI(content::WebUI* web_ui); |
154 | 159 |
155 // content::BrowserContext implementation ------------------------------------ | 160 // content::BrowserContext implementation ------------------------------------ |
156 | 161 |
157 // Typesafe upcast. | 162 // Typesafe upcast. |
158 virtual TestingProfile* AsTestingProfile(); | 163 virtual TestingProfile* AsTestingProfile(); |
159 | 164 |
| 165 // Returns sequenced task runner where browser context dependent I/O |
| 166 // operations should be performed. |
| 167 virtual scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() = 0; |
| 168 |
160 // Returns the name associated with this profile. This name is displayed in | 169 // Returns the name associated with this profile. This name is displayed in |
161 // the browser frame. | 170 // the browser frame. |
162 virtual std::string GetProfileName() = 0; | 171 virtual std::string GetProfileName() = 0; |
163 | 172 |
164 // Return the incognito version of this profile. The returned pointer | 173 // Return the incognito version of this profile. The returned pointer |
165 // is owned by the receiving profile. If the receiving profile is off the | 174 // is owned by the receiving profile. If the receiving profile is off the |
166 // record, the same profile is returned. | 175 // record, the same profile is returned. |
167 // | 176 // |
168 // WARNING: This will create the OffTheRecord profile if it doesn't already | 177 // WARNING: This will create the OffTheRecord profile if it doesn't already |
169 // exist. If this isn't what you want, you need to check | 178 // exist. If this isn't what you want, you need to check |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 struct hash<Profile*> { | 406 struct hash<Profile*> { |
398 std::size_t operator()(Profile* const& p) const { | 407 std::size_t operator()(Profile* const& p) const { |
399 return reinterpret_cast<std::size_t>(p); | 408 return reinterpret_cast<std::size_t>(p); |
400 } | 409 } |
401 }; | 410 }; |
402 | 411 |
403 } // namespace BASE_HASH_NAMESPACE | 412 } // namespace BASE_HASH_NAMESPACE |
404 #endif | 413 #endif |
405 | 414 |
406 #endif // CHROME_BROWSER_PROFILES_PROFILE_H_ | 415 #endif // CHROME_BROWSER_PROFILES_PROFILE_H_ |
OLD | NEW |