OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_PROFILE_H__ | 7 #ifndef CHROME_BROWSER_PROFILE_H__ |
8 #define CHROME_BROWSER_PROFILE_H__ | 8 #define CHROME_BROWSER_PROFILE_H__ |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // Since EXPLICIT_ACCESS means "as a result of a user action", this request | 58 // Since EXPLICIT_ACCESS means "as a result of a user action", this request |
59 // always succeeds. | 59 // always succeeds. |
60 EXPLICIT_ACCESS, | 60 EXPLICIT_ACCESS, |
61 | 61 |
62 // The caller plans to call a method that will permanently change some data | 62 // The caller plans to call a method that will permanently change some data |
63 // in the profile, as part of Chrome's implicit data logging. Use this flag | 63 // in the profile, as part of Chrome's implicit data logging. Use this flag |
64 // when you are about to perform an operation which is incompatible with the | 64 // when you are about to perform an operation which is incompatible with the |
65 // off the record mode. | 65 // off the record mode. |
66 IMPLICIT_ACCESS | 66 IMPLICIT_ACCESS |
67 }; | 67 }; |
| 68 Profile() : restored_last_session_(false) {} |
68 virtual ~Profile() {} | 69 virtual ~Profile() {} |
69 | 70 |
70 // Profile prefs are registered as soon as the prefs are loaded for the first | 71 // Profile prefs are registered as soon as the prefs are loaded for the first |
71 // time. | 72 // time. |
72 static void RegisterUserPrefs(PrefService* prefs); | 73 static void RegisterUserPrefs(PrefService* prefs); |
73 | 74 |
74 // Create a new profile given a path. | 75 // Create a new profile given a path. |
75 static Profile* CreateProfile(const std::wstring& path); | 76 static Profile* CreateProfile(const std::wstring& path); |
76 | 77 |
77 // Returns the request context for the "default" profile. This may be called | 78 // Returns the request context for the "default" profile. This may be called |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 // NOTE: this is invoked internally on a normal shutdown, but is public so | 223 // NOTE: this is invoked internally on a normal shutdown, but is public so |
223 // that it can be invoked when the user logs out/powers down (WM_ENDSESSION). | 224 // that it can be invoked when the user logs out/powers down (WM_ENDSESSION). |
224 virtual void MarkAsCleanShutdown() = 0; | 225 virtual void MarkAsCleanShutdown() = 0; |
225 #ifdef UNIT_TEST | 226 #ifdef UNIT_TEST |
226 // Use with caution. GetDefaultRequestContext may be called on any thread! | 227 // Use with caution. GetDefaultRequestContext may be called on any thread! |
227 static void set_default_request_context(URLRequestContext* c) { | 228 static void set_default_request_context(URLRequestContext* c) { |
228 default_request_context_ = c; | 229 default_request_context_ = c; |
229 } | 230 } |
230 #endif | 231 #endif |
231 | 232 |
| 233 // Did the user restore the last session? This is set by SessionRestore. |
| 234 void set_restored_last_session(bool restored_last_session) { |
| 235 restored_last_session_ = restored_last_session; |
| 236 } |
| 237 bool restored_last_session() const { |
| 238 return restored_last_session_; |
| 239 } |
| 240 |
232 protected: | 241 protected: |
233 static URLRequestContext* default_request_context_; | 242 static URLRequestContext* default_request_context_; |
| 243 |
| 244 private: |
| 245 bool restored_last_session_; |
234 }; | 246 }; |
235 | 247 |
236 class OffTheRecordProfileImpl; | 248 class OffTheRecordProfileImpl; |
237 | 249 |
238 // The default profile implementation. | 250 // The default profile implementation. |
239 class ProfileImpl : public Profile, | 251 class ProfileImpl : public Profile, |
240 public NotificationObserver { | 252 public NotificationObserver { |
241 public: | 253 public: |
242 virtual ~ProfileImpl(); | 254 virtual ~ProfileImpl(); |
243 | 255 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 366 |
355 // This struct is used to pass the spellchecker object through the notification | 367 // This struct is used to pass the spellchecker object through the notification |
356 // NOTIFY_SPELLCHECKER_REINITIALIZED. This is used as the details for the | 368 // NOTIFY_SPELLCHECKER_REINITIALIZED. This is used as the details for the |
357 // notification service. | 369 // notification service. |
358 struct SpellcheckerReinitializedDetails { | 370 struct SpellcheckerReinitializedDetails { |
359 scoped_refptr<SpellChecker> spellchecker; | 371 scoped_refptr<SpellChecker> spellchecker; |
360 }; | 372 }; |
361 | 373 |
362 #endif // CHROME_BROWSER_PROFILE_H__ | 374 #endif // CHROME_BROWSER_PROFILE_H__ |
363 | 375 |
OLD | NEW |