Pulling custom dictionary out of spellcheck_profile as prep to combine profile and host.


BUG=154921

[email protected]

Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=164142

Review URL: https://chromiumcodereview.appspot.com/11175041

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164358 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary.h b/chrome/browser/spellchecker/spellcheck_custom_dictionary.h
new file mode 100644
index 0000000..d7a5e47
--- /dev/null
+++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary.h
@@ -0,0 +1,43 @@
+// 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_CUSTOM_DICTIONARY_H_
+#define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_CUSTOM_DICTIONARY_H_
+
+#include <string>
+#include <vector>
+
+#include "base/file_path.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/spellchecker/spellcheck_dictionary.h"
+#include "chrome/common/spellcheck_common.h"
+
+// Defines a custom dictionary which users can add their own words to.
+class SpellcheckCustomDictionary : public SpellcheckDictionary {
+ public:
+  explicit SpellcheckCustomDictionary(Profile* profile);
+  virtual ~SpellcheckCustomDictionary();
+
+  virtual void Load() OVERRIDE;
+  void WriteWordToCustomDictionary(const std::string& word);
+
+  // Returns true if successful. False otherwise. Takes ownership of
+  // custom_words and replaces pointer with an empty vector.
+  bool SetCustomWordList(chrome::spellcheck_common::WordList* custom_words);
+  const chrome::spellcheck_common::WordList& GetCustomWords() const;
+  void CustomWordAddedLocally(const std::string& word);
+  void LoadDictionaryIntoCustomWordList(
+      chrome::spellcheck_common::WordList& custom_words);
+
+ private:
+  // In-memory cache of the custom words file.
+  chrome::spellcheck_common::WordList custom_words_;
+
+  // A path for custom dictionary per profile.
+  FilePath custom_dictionary_path_;
+
+  DISALLOW_COPY_AND_ASSIGN(SpellcheckCustomDictionary);
+};
+
+#endif  // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_CUSTOM_DICTIONARY_H_