Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: chrome/browser/profile.h

Issue 357003: Move the spellchecker to the renderer.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rename Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
19 #endif
17 #include "chrome/browser/web_resource/web_resource_service.h" 20 #include "chrome/browser/web_resource/web_resource_service.h"
18 #include "chrome/common/notification_registrar.h" 21 #include "chrome/common/notification_registrar.h"
19 22
20 #if defined(OS_CHROMEOS) 23 #if defined(OS_CHROMEOS)
21 #include "chrome/browser/chromeos/preferences.h" 24 #include "chrome/browser/chromeos/preferences.h"
22 #endif 25 #endif
23 26
24 namespace net { 27 namespace net {
25 class StrictTransportSecurityState; 28 class StrictTransportSecurityState;
26 class SSLConfigService; 29 class SSLConfigService;
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 343
341 // Returns the spell checker object for this profile. THIS OBJECT MUST ONLY 344 // Returns the spell checker object for this profile. THIS OBJECT MUST ONLY
342 // BE USED ON THE I/O THREAD! This pointer is retrieved from the profile and 345 // BE USED ON THE I/O THREAD! This pointer is retrieved from the profile and
343 // sent to the I/O thread where it is actually used. 346 // sent to the I/O thread where it is actually used.
344 virtual SpellChecker* GetSpellChecker() = 0; 347 virtual SpellChecker* GetSpellChecker() = 0;
345 348
346 // Deletes the spellchecker. This is only really useful when we need to purge 349 // Deletes the spellchecker. This is only really useful when we need to purge
347 // memory. 350 // memory.
348 virtual void DeleteSpellChecker() = 0; 351 virtual void DeleteSpellChecker() = 0;
349 352
353 #if defined(SPELLCHECKER_IN_RENDERER)
354 // May return NULL.
355 virtual SpellCheckHost* GetSpellCheckHost() = 0;
356
357 // If |force| is false, and the spellchecker is already initialized (or is in
358 // the process of initializing), then do nothing. Otherwise clobber the
359 // current spellchecker and replace it with a new one.
360 virtual void ReinitializeSpellCheckHost(bool force) = 0;
361 #endif
362
350 // Returns the WebKitContext assigned to this profile. 363 // Returns the WebKitContext assigned to this profile.
351 virtual WebKitContext* GetWebKitContext() = 0; 364 virtual WebKitContext* GetWebKitContext() = 0;
352 365
353 // Returns the provider of desktop notifications for this profile. 366 // Returns the provider of desktop notifications for this profile.
354 virtual DesktopNotificationService* GetDesktopNotificationService() = 0; 367 virtual DesktopNotificationService* GetDesktopNotificationService() = 0;
355 368
356 // Marks the profile as cleanly shutdown. 369 // Marks the profile as cleanly shutdown.
357 // 370 //
358 // NOTE: this is invoked internally on a normal shutdown, but is public so 371 // NOTE: this is invoked internally on a normal shutdown, but is public so
359 // that it can be invoked when the user logs out/powers down (WM_ENDSESSION). 372 // that it can be invoked when the user logs out/powers down (WM_ENDSESSION).
(...skipping 23 matching lines...) Expand all
383 static URLRequestContextGetter* default_request_context_; 396 static URLRequestContextGetter* default_request_context_;
384 397
385 private: 398 private:
386 bool restored_last_session_; 399 bool restored_last_session_;
387 }; 400 };
388 401
389 class OffTheRecordProfileImpl; 402 class OffTheRecordProfileImpl;
390 403
391 // The default profile implementation. 404 // The default profile implementation.
392 class ProfileImpl : public Profile, 405 class ProfileImpl : public Profile,
406 #if defined(SPELLCHECKER_IN_RENDERER)
407 public SpellCheckHost::Observer,
408 #endif
393 public NotificationObserver { 409 public NotificationObserver {
394 public: 410 public:
395 virtual ~ProfileImpl(); 411 virtual ~ProfileImpl();
396 412
397 // Profile implementation. 413 // Profile implementation.
398 virtual ProfileId GetRuntimeId(); 414 virtual ProfileId GetRuntimeId();
399 virtual FilePath GetPath(); 415 virtual FilePath GetPath();
400 virtual bool IsOffTheRecord(); 416 virtual bool IsOffTheRecord();
401 virtual Profile* GetOffTheRecordProfile(); 417 virtual Profile* GetOffTheRecordProfile();
402 virtual void DestroyOffTheRecordProfile(); 418 virtual void DestroyOffTheRecordProfile();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 virtual void SetID(const std::wstring& id); 458 virtual void SetID(const std::wstring& id);
443 virtual bool DidLastSessionExitCleanly(); 459 virtual bool DidLastSessionExitCleanly();
444 virtual BookmarkModel* GetBookmarkModel(); 460 virtual BookmarkModel* GetBookmarkModel();
445 virtual bool IsSameProfile(Profile* profile); 461 virtual bool IsSameProfile(Profile* profile);
446 virtual base::Time GetStartTime() const; 462 virtual base::Time GetStartTime() const;
447 virtual TabRestoreService* GetTabRestoreService(); 463 virtual TabRestoreService* GetTabRestoreService();
448 virtual void ResetTabRestoreService(); 464 virtual void ResetTabRestoreService();
449 virtual void ReinitializeSpellChecker(); 465 virtual void ReinitializeSpellChecker();
450 virtual SpellChecker* GetSpellChecker(); 466 virtual SpellChecker* GetSpellChecker();
451 virtual void DeleteSpellChecker() { DeleteSpellCheckerImpl(true); } 467 virtual void DeleteSpellChecker() { DeleteSpellCheckerImpl(true); }
468 #if defined(SPELLCHECKER_IN_RENDERER)
469 virtual SpellCheckHost* GetSpellCheckHost();
470 virtual void ReinitializeSpellCheckHost(bool force);
471 #endif
452 virtual WebKitContext* GetWebKitContext(); 472 virtual WebKitContext* GetWebKitContext();
453 virtual DesktopNotificationService* GetDesktopNotificationService(); 473 virtual DesktopNotificationService* GetDesktopNotificationService();
454 virtual void MarkAsCleanShutdown(); 474 virtual void MarkAsCleanShutdown();
455 virtual void InitExtensions(); 475 virtual void InitExtensions();
456 virtual void InitWebResources(); 476 virtual void InitWebResources();
457 virtual ProfileSyncService* GetProfileSyncService(); 477 virtual ProfileSyncService* GetProfileSyncService();
458 void InitSyncService(); 478 void InitSyncService();
459 479
460 // NotificationObserver implementation. 480 // NotificationObserver implementation.
461 virtual void Observe(NotificationType type, 481 virtual void Observe(NotificationType type,
462 const NotificationSource& source, 482 const NotificationSource& source,
463 const NotificationDetails& details); 483 const NotificationDetails& details);
464 484
485 #if defined(SPELLCHECKER_IN_RENDERER)
486 // SpellCheckHost::Observer implementation.
487 virtual void SpellCheckHostInitialized();
488 #endif
489
465 private: 490 private:
466 friend class Profile; 491 friend class Profile;
467 492
468 explicit ProfileImpl(const FilePath& path); 493 explicit ProfileImpl(const FilePath& path);
469 494
470 void CreateWebDataService(); 495 void CreateWebDataService();
471 FilePath GetPrefFilePath(); 496 FilePath GetPrefFilePath();
472 497
473 void CreatePasswordStore(); 498 void CreatePasswordStore();
474 499
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 570
546 // See GetStartTime for details. 571 // See GetStartTime for details.
547 base::Time start_time_; 572 base::Time start_time_;
548 573
549 scoped_refptr<TabRestoreService> tab_restore_service_; 574 scoped_refptr<TabRestoreService> tab_restore_service_;
550 575
551 // This can not be a scoped_refptr because we must release it on the I/O 576 // This can not be a scoped_refptr because we must release it on the I/O
552 // thread. 577 // thread.
553 SpellChecker* spellchecker_; 578 SpellChecker* spellchecker_;
554 579
580 #if defined(SPELLCHECKER_IN_RENDERER)
581 scoped_refptr<SpellCheckHost> spellcheck_host_;
582
583 // Indicates whether |spellcheck_host_| has told us initialization is
584 // finished.
585 bool spellcheck_host_ready_;
586 #endif
587
555 // Set to true when ShutdownSessionService is invoked. If true 588 // Set to true when ShutdownSessionService is invoked. If true
556 // GetSessionService won't recreate the SessionService. 589 // GetSessionService won't recreate the SessionService.
557 bool shutdown_session_service_; 590 bool shutdown_session_service_;
558 591
559 #if defined(OS_CHROMEOS) 592 #if defined(OS_CHROMEOS)
560 chromeos::Preferences chromeos_preferences_; 593 chromeos::Preferences chromeos_preferences_;
561 #endif 594 #endif
562 595
563 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); 596 DISALLOW_COPY_AND_ASSIGN(ProfileImpl);
564 }; 597 };
565 598
566 // This struct is used to pass the spellchecker object through the notification 599 // This struct is used to pass the spellchecker object through the notification
567 // SPELLCHECKER_REINITIALIZED. This is used as the details for the notification 600 // SPELLCHECKER_REINITIALIZED. This is used as the details for the notification
568 // service. 601 // service.
569 struct SpellcheckerReinitializedDetails { 602 struct SpellcheckerReinitializedDetails {
570 scoped_refptr<SpellChecker> spellchecker; 603 scoped_refptr<SpellChecker> spellchecker;
571 }; 604 };
572 605
573 #endif // CHROME_BROWSER_PROFILE_H_ 606 #endif // CHROME_BROWSER_PROFILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698