| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 15 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
| 16 #include "base/timer.h" | 16 #include "base/timer.h" |
| 17 #if defined(SPELLCHECKER_IN_RENDERER) | |
| 18 #include "chrome/browser/spellcheck_host.h" | 17 #include "chrome/browser/spellcheck_host.h" |
| 19 #endif | |
| 20 #include "chrome/browser/web_resource/web_resource_service.h" | 18 #include "chrome/browser/web_resource/web_resource_service.h" |
| 21 #include "chrome/common/notification_registrar.h" | 19 #include "chrome/common/notification_registrar.h" |
| 22 | 20 |
| 23 #if defined(OS_CHROMEOS) | 21 #if defined(OS_CHROMEOS) |
| 24 #include "chrome/browser/chromeos/preferences.h" | 22 #include "chrome/browser/chromeos/preferences.h" |
| 25 #endif | 23 #endif |
| 26 | 24 |
| 27 namespace net { | 25 namespace net { |
| 28 class StrictTransportSecurityState; | 26 class StrictTransportSecurityState; |
| 29 class SSLConfigService; | 27 class SSLConfigService; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 46 class ExtensionsService; | 44 class ExtensionsService; |
| 47 class FaviconService; | 45 class FaviconService; |
| 48 class HistoryService; | 46 class HistoryService; |
| 49 class NavigationController; | 47 class NavigationController; |
| 50 class PasswordStore; | 48 class PasswordStore; |
| 51 class PersonalDataManager; | 49 class PersonalDataManager; |
| 52 class PrefService; | 50 class PrefService; |
| 53 class ProfileSyncService; | 51 class ProfileSyncService; |
| 54 class SearchVersusNavigateClassifier; | 52 class SearchVersusNavigateClassifier; |
| 55 class SessionService; | 53 class SessionService; |
| 56 class SpellChecker; | |
| 57 class SSLConfigServiceManager; | 54 class SSLConfigServiceManager; |
| 58 class SSLHostState; | 55 class SSLHostState; |
| 59 class StrictTransportSecurityPersister; | 56 class StrictTransportSecurityPersister; |
| 60 class SQLitePersistentCookieStore; | 57 class SQLitePersistentCookieStore; |
| 61 class TabRestoreService; | 58 class TabRestoreService; |
| 62 class TemplateURLFetcher; | 59 class TemplateURLFetcher; |
| 63 class TemplateURLModel; | 60 class TemplateURLModel; |
| 64 class ThemeProvider; | 61 class ThemeProvider; |
| 65 class ThumbnailStore; | 62 class ThumbnailStore; |
| 66 class URLRequestContextGetter; | 63 class URLRequestContextGetter; |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 // was created, rather it is the time the user started chrome and logged into | 337 // was created, rather it is the time the user started chrome and logged into |
| 341 // this profile. For the single profile case, this corresponds to the time | 338 // this profile. For the single profile case, this corresponds to the time |
| 342 // the user started chrome. | 339 // the user started chrome. |
| 343 virtual base::Time GetStartTime() const = 0; | 340 virtual base::Time GetStartTime() const = 0; |
| 344 | 341 |
| 345 // Returns the TabRestoreService. This returns NULL when off the record. | 342 // Returns the TabRestoreService. This returns NULL when off the record. |
| 346 virtual TabRestoreService* GetTabRestoreService() = 0; | 343 virtual TabRestoreService* GetTabRestoreService() = 0; |
| 347 | 344 |
| 348 virtual void ResetTabRestoreService() = 0; | 345 virtual void ResetTabRestoreService() = 0; |
| 349 | 346 |
| 350 // This reinitializes the spellchecker according to the current dictionary | |
| 351 // language, and enable spell check option, in the prefs. Then a | |
| 352 // SPELLCHECKER_REINITIALIZED notification is sent on the IO thread. | |
| 353 virtual void ReinitializeSpellChecker() = 0; | |
| 354 | |
| 355 // Returns the spell checker object for this profile. THIS OBJECT MUST ONLY | |
| 356 // BE USED ON THE I/O THREAD! This pointer is retrieved from the profile and | |
| 357 // sent to the I/O thread where it is actually used. | |
| 358 virtual SpellChecker* GetSpellChecker() = 0; | |
| 359 | |
| 360 // Deletes the spellchecker. This is only really useful when we need to purge | |
| 361 // memory. | |
| 362 virtual void DeleteSpellChecker() = 0; | |
| 363 | |
| 364 #if defined(SPELLCHECKER_IN_RENDERER) | |
| 365 // May return NULL. | 347 // May return NULL. |
| 366 virtual SpellCheckHost* GetSpellCheckHost() = 0; | 348 virtual SpellCheckHost* GetSpellCheckHost() = 0; |
| 367 | 349 |
| 368 // If |force| is false, and the spellchecker is already initialized (or is in | 350 // If |force| is false, and the spellchecker is already initialized (or is in |
| 369 // the process of initializing), then do nothing. Otherwise clobber the | 351 // the process of initializing), then do nothing. Otherwise clobber the |
| 370 // current spellchecker and replace it with a new one. | 352 // current spellchecker and replace it with a new one. |
| 371 virtual void ReinitializeSpellCheckHost(bool force) = 0; | 353 virtual void ReinitializeSpellCheckHost(bool force) = 0; |
| 372 #endif | |
| 373 | 354 |
| 374 // Returns the WebKitContext assigned to this profile. | 355 // Returns the WebKitContext assigned to this profile. |
| 375 virtual WebKitContext* GetWebKitContext() = 0; | 356 virtual WebKitContext* GetWebKitContext() = 0; |
| 376 | 357 |
| 377 // Returns the provider of desktop notifications for this profile. | 358 // Returns the provider of desktop notifications for this profile. |
| 378 virtual DesktopNotificationService* GetDesktopNotificationService() = 0; | 359 virtual DesktopNotificationService* GetDesktopNotificationService() = 0; |
| 379 | 360 |
| 380 // Marks the profile as cleanly shutdown. | 361 // Marks the profile as cleanly shutdown. |
| 381 // | 362 // |
| 382 // NOTE: this is invoked internally on a normal shutdown, but is public so | 363 // NOTE: this is invoked internally on a normal shutdown, but is public so |
| (...skipping 24 matching lines...) Expand all Loading... |
| 407 static URLRequestContextGetter* default_request_context_; | 388 static URLRequestContextGetter* default_request_context_; |
| 408 | 389 |
| 409 private: | 390 private: |
| 410 bool restored_last_session_; | 391 bool restored_last_session_; |
| 411 }; | 392 }; |
| 412 | 393 |
| 413 class OffTheRecordProfileImpl; | 394 class OffTheRecordProfileImpl; |
| 414 | 395 |
| 415 // The default profile implementation. | 396 // The default profile implementation. |
| 416 class ProfileImpl : public Profile, | 397 class ProfileImpl : public Profile, |
| 417 #if defined(SPELLCHECKER_IN_RENDERER) | |
| 418 public SpellCheckHost::Observer, | 398 public SpellCheckHost::Observer, |
| 419 #endif | |
| 420 public NotificationObserver { | 399 public NotificationObserver { |
| 421 public: | 400 public: |
| 422 virtual ~ProfileImpl(); | 401 virtual ~ProfileImpl(); |
| 423 | 402 |
| 424 // Profile implementation. | 403 // Profile implementation. |
| 425 virtual ProfileId GetRuntimeId(); | 404 virtual ProfileId GetRuntimeId(); |
| 426 virtual FilePath GetPath(); | 405 virtual FilePath GetPath(); |
| 427 virtual bool IsOffTheRecord(); | 406 virtual bool IsOffTheRecord(); |
| 428 virtual Profile* GetOffTheRecordProfile(); | 407 virtual Profile* GetOffTheRecordProfile(); |
| 429 virtual void DestroyOffTheRecordProfile(); | 408 virtual void DestroyOffTheRecordProfile(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 virtual std::wstring GetName(); | 447 virtual std::wstring GetName(); |
| 469 virtual void SetName(const std::wstring& name); | 448 virtual void SetName(const std::wstring& name); |
| 470 virtual std::wstring GetID(); | 449 virtual std::wstring GetID(); |
| 471 virtual void SetID(const std::wstring& id); | 450 virtual void SetID(const std::wstring& id); |
| 472 virtual bool DidLastSessionExitCleanly(); | 451 virtual bool DidLastSessionExitCleanly(); |
| 473 virtual BookmarkModel* GetBookmarkModel(); | 452 virtual BookmarkModel* GetBookmarkModel(); |
| 474 virtual bool IsSameProfile(Profile* profile); | 453 virtual bool IsSameProfile(Profile* profile); |
| 475 virtual base::Time GetStartTime() const; | 454 virtual base::Time GetStartTime() const; |
| 476 virtual TabRestoreService* GetTabRestoreService(); | 455 virtual TabRestoreService* GetTabRestoreService(); |
| 477 virtual void ResetTabRestoreService(); | 456 virtual void ResetTabRestoreService(); |
| 478 virtual void ReinitializeSpellChecker(); | |
| 479 virtual SpellChecker* GetSpellChecker(); | |
| 480 virtual void DeleteSpellChecker() { DeleteSpellCheckerImpl(true); } | |
| 481 #if defined(SPELLCHECKER_IN_RENDERER) | |
| 482 virtual SpellCheckHost* GetSpellCheckHost(); | 457 virtual SpellCheckHost* GetSpellCheckHost(); |
| 483 virtual void ReinitializeSpellCheckHost(bool force); | 458 virtual void ReinitializeSpellCheckHost(bool force); |
| 484 #endif | |
| 485 virtual WebKitContext* GetWebKitContext(); | 459 virtual WebKitContext* GetWebKitContext(); |
| 486 virtual DesktopNotificationService* GetDesktopNotificationService(); | 460 virtual DesktopNotificationService* GetDesktopNotificationService(); |
| 487 virtual void MarkAsCleanShutdown(); | 461 virtual void MarkAsCleanShutdown(); |
| 488 virtual void InitExtensions(); | 462 virtual void InitExtensions(); |
| 489 virtual void InitWebResources(); | 463 virtual void InitWebResources(); |
| 490 virtual ProfileSyncService* GetProfileSyncService(); | 464 virtual ProfileSyncService* GetProfileSyncService(); |
| 491 void InitSyncService(); | 465 void InitSyncService(); |
| 492 | 466 |
| 493 // NotificationObserver implementation. | 467 // NotificationObserver implementation. |
| 494 virtual void Observe(NotificationType type, | 468 virtual void Observe(NotificationType type, |
| 495 const NotificationSource& source, | 469 const NotificationSource& source, |
| 496 const NotificationDetails& details); | 470 const NotificationDetails& details); |
| 497 | 471 |
| 498 #if defined(SPELLCHECKER_IN_RENDERER) | |
| 499 // SpellCheckHost::Observer implementation. | 472 // SpellCheckHost::Observer implementation. |
| 500 virtual void SpellCheckHostInitialized(); | 473 virtual void SpellCheckHostInitialized(); |
| 501 #endif | |
| 502 | 474 |
| 503 private: | 475 private: |
| 504 friend class Profile; | 476 friend class Profile; |
| 505 | 477 |
| 506 explicit ProfileImpl(const FilePath& path); | 478 explicit ProfileImpl(const FilePath& path); |
| 507 | 479 |
| 508 void CreateWebDataService(); | 480 void CreateWebDataService(); |
| 509 FilePath GetPrefFilePath(); | 481 FilePath GetPrefFilePath(); |
| 510 | 482 |
| 511 void CreatePasswordStore(); | 483 void CreatePasswordStore(); |
| 512 | 484 |
| 513 void StopCreateSessionServiceTimer(); | 485 void StopCreateSessionServiceTimer(); |
| 514 | 486 |
| 515 void EnsureRequestContextCreated() { | 487 void EnsureRequestContextCreated() { |
| 516 GetRequestContext(); | 488 GetRequestContext(); |
| 517 } | 489 } |
| 518 | 490 |
| 519 void EnsureSessionServiceCreated() { | 491 void EnsureSessionServiceCreated() { |
| 520 GetSessionService(); | 492 GetSessionService(); |
| 521 } | 493 } |
| 522 | 494 |
| 523 void NotifySpellCheckerChanged(); | |
| 524 void DeleteSpellCheckerImpl(bool notify); | |
| 525 | |
| 526 NotificationRegistrar registrar_; | 495 NotificationRegistrar registrar_; |
| 527 | 496 |
| 528 FilePath path_; | 497 FilePath path_; |
| 529 FilePath base_cache_path_; | 498 FilePath base_cache_path_; |
| 530 scoped_ptr<VisitedLinkEventListener> visited_link_event_listener_; | 499 scoped_ptr<VisitedLinkEventListener> visited_link_event_listener_; |
| 531 scoped_ptr<VisitedLinkMaster> visited_link_master_; | 500 scoped_ptr<VisitedLinkMaster> visited_link_master_; |
| 532 scoped_refptr<ExtensionsService> extensions_service_; | 501 scoped_refptr<ExtensionsService> extensions_service_; |
| 533 scoped_refptr<UserScriptMaster> user_script_master_; | 502 scoped_refptr<UserScriptMaster> user_script_master_; |
| 534 scoped_refptr<ExtensionDevToolsManager> extension_devtools_manager_; | 503 scoped_refptr<ExtensionDevToolsManager> extension_devtools_manager_; |
| 535 scoped_ptr<ExtensionProcessManager> extension_process_manager_; | 504 scoped_ptr<ExtensionProcessManager> extension_process_manager_; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 | 549 |
| 581 base::OneShotTimer<ProfileImpl> create_session_service_timer_; | 550 base::OneShotTimer<ProfileImpl> create_session_service_timer_; |
| 582 | 551 |
| 583 scoped_ptr<OffTheRecordProfileImpl> off_the_record_profile_; | 552 scoped_ptr<OffTheRecordProfileImpl> off_the_record_profile_; |
| 584 | 553 |
| 585 // See GetStartTime for details. | 554 // See GetStartTime for details. |
| 586 base::Time start_time_; | 555 base::Time start_time_; |
| 587 | 556 |
| 588 scoped_refptr<TabRestoreService> tab_restore_service_; | 557 scoped_refptr<TabRestoreService> tab_restore_service_; |
| 589 | 558 |
| 590 // This can not be a scoped_refptr because we must release it on the I/O | |
| 591 // thread. | |
| 592 SpellChecker* spellchecker_; | |
| 593 | |
| 594 #if defined(SPELLCHECKER_IN_RENDERER) | |
| 595 scoped_refptr<SpellCheckHost> spellcheck_host_; | 559 scoped_refptr<SpellCheckHost> spellcheck_host_; |
| 596 | 560 |
| 597 // Indicates whether |spellcheck_host_| has told us initialization is | 561 // Indicates whether |spellcheck_host_| has told us initialization is |
| 598 // finished. | 562 // finished. |
| 599 bool spellcheck_host_ready_; | 563 bool spellcheck_host_ready_; |
| 600 #endif | |
| 601 | 564 |
| 602 // Set to true when ShutdownSessionService is invoked. If true | 565 // Set to true when ShutdownSessionService is invoked. If true |
| 603 // GetSessionService won't recreate the SessionService. | 566 // GetSessionService won't recreate the SessionService. |
| 604 bool shutdown_session_service_; | 567 bool shutdown_session_service_; |
| 605 | 568 |
| 606 // The main database tracker for this profile. | 569 // The main database tracker for this profile. |
| 607 // Should be used only on the file thread. | 570 // Should be used only on the file thread. |
| 608 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_; | 571 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_; |
| 609 | 572 |
| 610 #if defined(OS_CHROMEOS) | 573 #if defined(OS_CHROMEOS) |
| 611 chromeos::Preferences chromeos_preferences_; | 574 chromeos::Preferences chromeos_preferences_; |
| 612 #endif | 575 #endif |
| 613 | 576 |
| 614 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); | 577 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); |
| 615 }; | 578 }; |
| 616 | 579 |
| 617 // This struct is used to pass the spellchecker object through the notification | |
| 618 // SPELLCHECKER_REINITIALIZED. This is used as the details for the notification | |
| 619 // service. | |
| 620 struct SpellcheckerReinitializedDetails { | |
| 621 scoped_refptr<SpellChecker> spellchecker; | |
| 622 }; | |
| 623 | |
| 624 #endif // CHROME_BROWSER_PROFILE_H_ | 580 #endif // CHROME_BROWSER_PROFILE_H_ |
| OLD | NEW |