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

Unified Diff: chrome/renderer/spellchecker/custom_dictionary_engine.cc

Issue 2198143002: Componentize spellcheck [3]: move renderer/ files to component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 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/renderer/spellchecker/custom_dictionary_engine.cc
diff --git a/chrome/renderer/spellchecker/custom_dictionary_engine.cc b/chrome/renderer/spellchecker/custom_dictionary_engine.cc
deleted file mode 100644
index f2bf49d505ac712cca5770e904e1ad11a9c63c35..0000000000000000000000000000000000000000
--- a/chrome/renderer/spellchecker/custom_dictionary_engine.cc
+++ /dev/null
@@ -1,49 +0,0 @@
-// 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.
-
-#include "chrome/renderer/spellchecker/custom_dictionary_engine.h"
-
-#include <stddef.h>
-
-#include "base/strings/utf_string_conversions.h"
-
-CustomDictionaryEngine::CustomDictionaryEngine() {
-}
-
-CustomDictionaryEngine::~CustomDictionaryEngine() {
-}
-
-void CustomDictionaryEngine::Init(const std::set<std::string>& custom_words) {
- dictionary_.clear();
-
- // SpellingMenuOberver calls UTF16ToUTF8(word) to convert words for storage,
- // synchronization, and use in the custom dictionary engine. Since
- // (UTF8ToUTF16(UTF16ToUTF8(word)) == word) holds, the engine does not need to
- // normalize the strings.
- for (const std::string& word : custom_words)
- dictionary_.insert(base::UTF8ToUTF16(word));
-}
-
-void CustomDictionaryEngine::OnCustomDictionaryChanged(
- const std::set<std::string>& words_added,
- const std::set<std::string>& words_removed) {
- for (const std::string& word : words_added)
- dictionary_.insert(base::UTF8ToUTF16(word));
-
- for (const std::string& word : words_removed)
- dictionary_.erase(base::UTF8ToUTF16(word));
-}
-
-bool CustomDictionaryEngine::SpellCheckWord(
- const base::string16& text,
- int misspelling_start,
- int misspelling_len) {
- // The text to be checked is empty on OSX(async) right now.
- // TODO(groby): Fix as part of async hook-up. (http://crbug.com/178241)
- return
- misspelling_start >= 0 &&
- misspelling_len > 0 &&
- size_t(misspelling_start + misspelling_len) <= text.length() &&
- dictionary_.count(text.substr(misspelling_start, misspelling_len)) > 0;
-}

Powered by Google App Engine
This is Rietveld 408576698