| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // The caller plans to call a method that will permanently change some data | 96 // The caller plans to call a method that will permanently change some data |
| 97 // in the profile, as part of Chrome's implicit data logging. Use this flag | 97 // in the profile, as part of Chrome's implicit data logging. Use this flag |
| 98 // when you are about to perform an operation which is incompatible with the | 98 // when you are about to perform an operation which is incompatible with the |
| 99 // off the record mode. | 99 // off the record mode. |
| 100 IMPLICIT_ACCESS | 100 IMPLICIT_ACCESS |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 // Value that represents no profile Id. | 103 // Value that represents no profile Id. |
| 104 static const ProfileId InvalidProfileId; | 104 static const ProfileId InvalidProfileId; |
| 105 | 105 |
| 106 Profile() : restored_last_session_(false) {} | 106 Profile() : restored_last_session_(false), accessibility_pause_level_(0) {} |
| 107 virtual ~Profile() {} | 107 virtual ~Profile() {} |
| 108 | 108 |
| 109 // Profile prefs are registered as soon as the prefs are loaded for the first | 109 // Profile prefs are registered as soon as the prefs are loaded for the first |
| 110 // time. | 110 // time. |
| 111 static void RegisterUserPrefs(PrefService* prefs); | 111 static void RegisterUserPrefs(PrefService* prefs); |
| 112 | 112 |
| 113 // Create a new profile given a path. | 113 // Create a new profile given a path. |
| 114 static Profile* CreateProfile(const FilePath& path); | 114 static Profile* CreateProfile(const FilePath& path); |
| 115 | 115 |
| 116 // Returns the request context for the "default" profile. This may be called | 116 // Returns the request context for the "default" profile. This may be called |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 #endif | 378 #endif |
| 379 | 379 |
| 380 // Did the user restore the last session? This is set by SessionRestore. | 380 // Did the user restore the last session? This is set by SessionRestore. |
| 381 void set_restored_last_session(bool restored_last_session) { | 381 void set_restored_last_session(bool restored_last_session) { |
| 382 restored_last_session_ = restored_last_session; | 382 restored_last_session_ = restored_last_session; |
| 383 } | 383 } |
| 384 bool restored_last_session() const { | 384 bool restored_last_session() const { |
| 385 return restored_last_session_; | 385 return restored_last_session_; |
| 386 } | 386 } |
| 387 | 387 |
| 388 // Stop sending accessibility events until ResumeAccessibilityEvents(). |
| 389 // Calls to Pause nest; no events will be sent until the number of |
| 390 // Resume calls matches the number of Pause calls received. |
| 391 void PauseAccessibilityEvents() { |
| 392 accessibility_pause_level_++; |
| 393 } |
| 394 |
| 395 void ResumeAccessibilityEvents() { |
| 396 DCHECK(accessibility_pause_level_ > 0); |
| 397 accessibility_pause_level_--; |
| 398 } |
| 399 |
| 400 bool ShouldSendAccessibilityEvents() { |
| 401 return 0 == accessibility_pause_level_; |
| 402 } |
| 403 |
| 388 protected: | 404 protected: |
| 389 static URLRequestContextGetter* default_request_context_; | 405 static URLRequestContextGetter* default_request_context_; |
| 390 | 406 |
| 391 private: | 407 private: |
| 392 bool restored_last_session_; | 408 bool restored_last_session_; |
| 409 |
| 410 // Accessibility events will only be propagated when the pause |
| 411 // level is zero. PauseAccessibilityEvents and ResumeAccessibilityEvents |
| 412 // increment and decrement the level, respectively, rather than set it to |
| 413 // true or false, so that calls can be nested. |
| 414 int accessibility_pause_level_; |
| 393 }; | 415 }; |
| 394 | 416 |
| 395 class OffTheRecordProfileImpl; | 417 class OffTheRecordProfileImpl; |
| 396 | 418 |
| 397 // The default profile implementation. | 419 // The default profile implementation. |
| 398 class ProfileImpl : public Profile, | 420 class ProfileImpl : public Profile, |
| 399 public SpellCheckHostObserver, | 421 public SpellCheckHostObserver, |
| 400 public NotificationObserver { | 422 public NotificationObserver { |
| 401 public: | 423 public: |
| 402 virtual ~ProfileImpl(); | 424 virtual ~ProfileImpl(); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_; | 595 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_; |
| 574 | 596 |
| 575 #if defined(OS_CHROMEOS) | 597 #if defined(OS_CHROMEOS) |
| 576 chromeos::Preferences chromeos_preferences_; | 598 chromeos::Preferences chromeos_preferences_; |
| 577 #endif | 599 #endif |
| 578 | 600 |
| 579 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); | 601 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); |
| 580 }; | 602 }; |
| 581 | 603 |
| 582 #endif // CHROME_BROWSER_PROFILE_H_ | 604 #endif // CHROME_BROWSER_PROFILE_H_ |
| OLD | NEW |