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

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

Issue 11416297: [Spellcheck] remove dead file (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/spellchecker/spellcheck_host.cc
diff --git a/chrome/browser/spellchecker/spellcheck_host.cc b/chrome/browser/spellchecker/spellcheck_host.cc
deleted file mode 100644
index 10df53be544c641f231c26e3bf71a7e47344e4f9..0000000000000000000000000000000000000000
--- a/chrome/browser/spellchecker/spellcheck_host.cc
+++ /dev/null
@@ -1,124 +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/browser/spellchecker/spellcheck_host.h"
-
-#include "base/string_split.h"
-#include "base/synchronization/waitable_event.h"
-#include "chrome/browser/api/prefs/pref_member.h"
-#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/spellchecker/spellcheck_host_impl.h"
-#include "chrome/browser/spellchecker/spellcheck_platform_mac.h"
-#include "chrome/common/pref_names.h"
-#include "chrome/common/spellcheck_common.h"
-
-using content::BrowserThread;
-
-namespace {
-
-// An event used by browser tests to receive status events from this class and
-// its derived classes.
-base::WaitableEvent* g_status_event = NULL;
-SpellCheckHost::EventType g_status_type = SpellCheckHost::BDICT_NOTINITIALIZED;
-
-} // namespace
-
-// static
-SpellCheckHost* SpellCheckHost::Create(
- SpellCheckProfileProvider* profile,
- const std::string& language,
- net::URLRequestContextGetter* request_context_getter,
- SpellCheckHostMetrics* metrics) {
- SpellCheckHostImpl* host =
- new SpellCheckHostImpl(profile, language, request_context_getter,
- metrics);
- if (!host)
- return NULL;
-
- host->Initialize();
- return host;
-}
-
-// static
-int SpellCheckHost::GetSpellCheckLanguages(
- Profile* profile,
- std::vector<std::string>* languages) {
- StringPrefMember accept_languages_pref;
- StringPrefMember dictionary_language_pref;
- accept_languages_pref.Init(prefs::kAcceptLanguages, profile->GetPrefs(),
- NULL);
- dictionary_language_pref.Init(prefs::kSpellCheckDictionary,
- profile->GetPrefs(), NULL);
- std::string dictionary_language = dictionary_language_pref.GetValue();
-
- // Now scan through the list of accept languages, and find possible mappings
- // from this list to the existing list of spell check languages.
- std::vector<std::string> accept_languages;
-
-#if defined(OS_MACOSX)
- if (spellcheck_mac::SpellCheckerAvailable())
- spellcheck_mac::GetAvailableLanguages(&accept_languages);
- else
- base::SplitString(accept_languages_pref.GetValue(), ',', &accept_languages);
-#else
- base::SplitString(accept_languages_pref.GetValue(), ',', &accept_languages);
-#endif // !OS_MACOSX
-
- GetSpellCheckLanguagesFromAcceptLanguages(
- accept_languages, dictionary_language, languages);
-
- for (size_t i = 0; i < languages->size(); ++i) {
- if ((*languages)[i] == dictionary_language)
- return i;
- }
- return -1;
-}
-
-// static
-void SpellCheckHost::GetSpellCheckLanguagesFromAcceptLanguages(
- const std::vector<std::string>& accept_languages,
- const std::string& dictionary_language,
- std::vector<std::string>* languages) {
- // The current dictionary language should be there.
- languages->push_back(dictionary_language);
-
- for (std::vector<std::string>::const_iterator i = accept_languages.begin();
- i != accept_languages.end(); ++i) {
- std::string language =
- chrome::spellcheck_common::GetCorrespondingSpellCheckLanguage(*i);
- if (!language.empty() &&
- std::find(languages->begin(), languages->end(), language) ==
- languages->end()) {
- languages->push_back(language);
- }
- }
-}
-
-// static
-bool SpellCheckHost::SignalStatusEvent(SpellCheckHost::EventType status_type) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
-
- if (!g_status_event)
- return false;
- g_status_type = status_type;
- g_status_event->Signal();
- return true;
-}
-
-// static
-void SpellCheckHost::AttachStatusEvent(base::WaitableEvent* status_event) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- g_status_event = status_event;
-}
-
-// static
-SpellCheckHost::EventType SpellCheckHost::WaitStatusEvent() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- if (g_status_event)
- g_status_event->Wait();
- return g_status_type;
-}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698