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

Unified Diff: chrome/browser/spellchecker/spellcheck_factory.h

Issue 9289007: Profiles: Move the Spelling system onto a ProfileKeyedServiceFactory. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/spellchecker/spellcheck_factory.h
diff --git a/chrome/browser/spellchecker/spellcheck_factory.h b/chrome/browser/spellchecker/spellcheck_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..9ac98e7a2ac82dbd22f6326b125ba6aa3e0018ba
--- /dev/null
+++ b/chrome/browser/spellchecker/spellcheck_factory.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_FACTORY_H_
+#define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_FACTORY_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/memory/singleton.h"
+#include "chrome/browser/profiles/profile_keyed_service_factory.h"
+
+class SpellCheckHost;
+class SpellCheckProfile;
+
+// Entry into the SpellCheck system.
+//
+// Internally, this owns all SpellCheckProfile objects, but these aren't
+// exposed to the callers. Instead, the SpellCheckProfile may or may not hand
+// out SpellCheckHost objects for consumption outside the SpellCheck system.
+class SpellCheckFactory : public ProfileKeyedServiceFactory {
+ public:
+ // Returns the spell check host. This may be NULL.
+ static SpellCheckHost* GetHostForProfile(Profile* profile);
+
+ // If |force| is false, and the spellchecker is already initialized (or is in
+ // the process of initializing), then do nothing. Otherwise clobber the
+ // current spellchecker and replace it with a new one.
+ static void ReinitializeSpellCheckHost(Profile* profile, bool force);
+
+ static SpellCheckFactory* GetInstance();
+
+ private:
+ friend struct DefaultSingletonTraits<SpellCheckFactory>;
+
+ SpellCheckFactory();
+ virtual ~SpellCheckFactory();
+
+ // Fetches the internal object for |profile|.
+ SpellCheckProfile* GetSpellCheckProfile(Profile* profile);
+
+ // ProfileKeyedServiceFactory:
+ virtual ProfileKeyedService* BuildServiceInstanceFor(
+ Profile* profile) const OVERRIDE;
+ virtual void RegisterUserPrefs(PrefService* user_prefs) OVERRIDE;
+ virtual bool ServiceRedirectedInIncognito() OVERRIDE;
+ virtual bool ServiceIsNULLWhileTesting() OVERRIDE;
+
+ DISALLOW_COPY_AND_ASSIGN(SpellCheckFactory);
+};
+
+#endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698