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

Unified Diff: chrome/browser/spellchecker/spellcheck_custom_dictionary.cc

Issue 2159283003: [WIP][DO NOT LAND] Componentize spellcheck Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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_custom_dictionary.cc
diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc
index 3a06283d748605bf08b2df6186dbd9ef87d3dd00..984a275338c64046ef9362042d5c613d33c6a861 100644
--- a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc
+++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc
@@ -14,9 +14,8 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
-#include "chrome/browser/spellchecker/spellcheck_host_metrics.h"
-#include "chrome/common/chrome_constants.h"
-#include "chrome/common/spellcheck_common.h"
+#include "components/spellcheck/browser/spellcheck_host_metrics.h"
+#include "components/spellcheck/common/spellcheck_common.h"
#include "content/public/browser/browser_thread.h"
#include "sync/api/sync_change.h"
#include "sync/api/sync_error_factory.h"
@@ -83,7 +82,7 @@ bool IsValidWord(const std::string& word) {
std::string tmp;
return !word.empty() &&
word.size() <=
- chrome::spellcheck_common::MAX_CUSTOM_DICTIONARY_WORD_BYTES &&
+ spellcheck_common::MAX_CUSTOM_DICTIONARY_WORD_BYTES &&
base::IsStringUTF8(word) &&
base::TRIM_NONE ==
base::TrimWhitespaceASCII(word, base::TRIM_ALL, &tmp);
@@ -178,6 +177,9 @@ int SanitizeWordsToRemove(const std::set<std::string>& existing,
} // namespace
+const base::FilePath::CharType SpellcheckCustomDictionary::kCustomDictionaryFileName[] =
+ FILE_PATH_LITERAL("Custom Dictionary.txt");
+
SpellcheckCustomDictionary::Change::Change() {
}
@@ -210,7 +212,7 @@ int SpellcheckCustomDictionary::Change::Sanitize(
SpellcheckCustomDictionary::SpellcheckCustomDictionary(
const base::FilePath& dictionary_directory_name)
: custom_dictionary_path_(
- dictionary_directory_name.Append(chrome::kCustomDictionaryFileName)),
+ dictionary_directory_name.Append(kCustomDictionaryFileName)),
is_loaded_(false),
weak_ptr_factory_(this) {
}
@@ -336,7 +338,7 @@ syncer::SyncDataList SpellcheckCustomDictionary::GetAllSyncData(
syncer::SyncDataList data;
size_t i = 0;
for (const auto& word : words_) {
- if (i++ >= chrome::spellcheck_common::MAX_SYNCABLE_DICTIONARY_WORDS)
+ if (i++ >= spellcheck_common::MAX_SYNCABLE_DICTIONARY_WORDS)
break;
sync_pb::EntitySpecifics specifics;
specifics.mutable_dictionary()->set_word(word);
@@ -479,7 +481,7 @@ syncer::SyncError SpellcheckCustomDictionary::Sync(
int max_upload_size = std::max(
0,
static_cast<int>(
- chrome::spellcheck_common::MAX_SYNCABLE_DICTIONARY_WORDS) -
+ spellcheck_common::MAX_SYNCABLE_DICTIONARY_WORDS) -
server_size);
int upload_size = std::min(
static_cast<int>(dictionary_change.to_add().size()),
@@ -514,7 +516,7 @@ syncer::SyncError SpellcheckCustomDictionary::Sync(
// Turn off syncing of this dictionary if the server already has the maximum
// number of words.
- if (words_.size() > chrome::spellcheck_common::MAX_SYNCABLE_DICTIONARY_WORDS)
+ if (words_.size() > spellcheck_common::MAX_SYNCABLE_DICTIONARY_WORDS)
StopSyncing(syncer::DICTIONARY);
return error;

Powered by Google App Engine
This is Rietveld 408576698