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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 } | 383 } |
384 | 384 |
385 bool ShouldSendAccessibilityEvents() { | 385 bool ShouldSendAccessibilityEvents() { |
386 return 0 == accessibility_pause_level_; | 386 return 0 == accessibility_pause_level_; |
387 } | 387 } |
388 | 388 |
389 // Checks whether sync is configurable by the user. Returns false if sync is | 389 // Checks whether sync is configurable by the user. Returns false if sync is |
390 // disabled or controlled by configuration management. | 390 // disabled or controlled by configuration management. |
391 bool IsSyncAccessible(); | 391 bool IsSyncAccessible(); |
392 | 392 |
| 393 // Send NOTIFICATION_PROFILE_DESTROYED for this Profile, if it has not |
| 394 // already been sent. It is necessary because most Profiles are destroyed by |
| 395 // ProfileDestroyer, but in tests, some are not. |
| 396 void MaybeSendDestroyedNotification(); |
| 397 |
393 // Creates an OffTheRecordProfile which points to this Profile. | 398 // Creates an OffTheRecordProfile which points to this Profile. |
394 Profile* CreateOffTheRecordProfile(); | 399 Profile* CreateOffTheRecordProfile(); |
395 | 400 |
396 protected: | 401 protected: |
397 // TODO(erg, willchan): Remove friendship once |ProfileIOData| is made into | 402 // TODO(erg, willchan): Remove friendship once |ProfileIOData| is made into |
398 // a |ProfileKeyedService|. | 403 // a |ProfileKeyedService|. |
399 friend class ChromeURLDataManagerFactory; | 404 friend class ChromeURLDataManagerFactory; |
400 friend class OffTheRecordProfileImpl; | 405 friend class OffTheRecordProfileImpl; |
401 | 406 |
402 // Returns a callback to a method returning a |ChromeURLDataManagerBackend|. | 407 // Returns a callback to a method returning a |ChromeURLDataManagerBackend|. |
403 // Used to create a |ChromeURLDataManager| for this |Profile|. | 408 // Used to create a |ChromeURLDataManager| for this |Profile|. |
404 // TODO(erg, willchan): Remove this once |ProfileIOData| is made into a | 409 // TODO(erg, willchan): Remove this once |ProfileIOData| is made into a |
405 // |ProfileKeyedService|. | 410 // |ProfileKeyedService|. |
406 virtual base::Callback<ChromeURLDataManagerBackend*(void)> | 411 virtual base::Callback<ChromeURLDataManagerBackend*(void)> |
407 GetChromeURLDataManagerBackendGetter() const = 0; | 412 GetChromeURLDataManagerBackendGetter() const = 0; |
408 | 413 |
409 private: | 414 private: |
410 bool restored_last_session_; | 415 bool restored_last_session_; |
411 | 416 |
| 417 // Used to prevent the notification that this Profile is destroyed from |
| 418 // being sent twice. |
| 419 bool sent_destroyed_notification_; |
| 420 |
412 // Accessibility events will only be propagated when the pause | 421 // Accessibility events will only be propagated when the pause |
413 // level is zero. PauseAccessibilityEvents and ResumeAccessibilityEvents | 422 // level is zero. PauseAccessibilityEvents and ResumeAccessibilityEvents |
414 // increment and decrement the level, respectively, rather than set it to | 423 // increment and decrement the level, respectively, rather than set it to |
415 // true or false, so that calls can be nested. | 424 // true or false, so that calls can be nested. |
416 int accessibility_pause_level_; | 425 int accessibility_pause_level_; |
417 }; | 426 }; |
418 | 427 |
419 #if defined(COMPILER_GCC) | 428 #if defined(COMPILER_GCC) |
420 namespace BASE_HASH_NAMESPACE { | 429 namespace BASE_HASH_NAMESPACE { |
421 | 430 |
422 template<> | 431 template<> |
423 struct hash<Profile*> { | 432 struct hash<Profile*> { |
424 std::size_t operator()(Profile* const& p) const { | 433 std::size_t operator()(Profile* const& p) const { |
425 return reinterpret_cast<std::size_t>(p); | 434 return reinterpret_cast<std::size_t>(p); |
426 } | 435 } |
427 }; | 436 }; |
428 | 437 |
429 } // namespace BASE_HASH_NAMESPACE | 438 } // namespace BASE_HASH_NAMESPACE |
430 #endif | 439 #endif |
431 | 440 |
432 #endif // CHROME_BROWSER_PROFILES_PROFILE_H_ | 441 #endif // CHROME_BROWSER_PROFILES_PROFILE_H_ |
OLD | NEW |