| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_FACTORY_H_ |
| 6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_FACTORY_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "base/memory/singleton.h" |
| 11 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
| 12 |
| 13 class SpellCheckHost; |
| 14 class SpellCheckProfile; |
| 15 |
| 16 // Entry into the SpellCheck system. |
| 17 // |
| 18 // Internally, this owns all SpellCheckProfile objects, but these aren't |
| 19 // exposed to the callers. Instead, the SpellCheckProfile may or may not hand |
| 20 // out SpellCheckHost objects for consumption outside the SpellCheck system. |
| 21 class SpellCheckFactory : public ProfileKeyedServiceFactory { |
| 22 public: |
| 23 // Returns the spell check host. This may be NULL. |
| 24 static SpellCheckHost* GetHostForProfile(Profile* profile); |
| 25 |
| 26 // If |force| is false, and the spellchecker is already initialized (or is in |
| 27 // the process of initializing), then do nothing. Otherwise clobber the |
| 28 // current spellchecker and replace it with a new one. |
| 29 static void ReinitializeSpellCheckHost(Profile* profile, bool force); |
| 30 |
| 31 static SpellCheckFactory* GetInstance(); |
| 32 |
| 33 private: |
| 34 friend struct DefaultSingletonTraits<SpellCheckFactory>; |
| 35 |
| 36 SpellCheckFactory(); |
| 37 virtual ~SpellCheckFactory(); |
| 38 |
| 39 // Fetches the internal object for |profile|. |
| 40 SpellCheckProfile* GetSpellCheckProfile(Profile* profile); |
| 41 |
| 42 // ProfileKeyedServiceFactory: |
| 43 virtual ProfileKeyedService* BuildServiceInstanceFor( |
| 44 Profile* profile) const OVERRIDE; |
| 45 virtual void RegisterUserPrefs(PrefService* user_prefs) OVERRIDE; |
| 46 virtual bool ServiceRedirectedInIncognito() OVERRIDE; |
| 47 virtual bool ServiceIsNULLWhileTesting() OVERRIDE; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(SpellCheckFactory); |
| 50 }; |
| 51 |
| 52 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_FACTORY_H_ |
| OLD | NEW |