summaryrefslogtreecommitdiffstats
path: root/chrome/browser/spellcheck_host.cc
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-09 13:34:25 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-09 13:34:25 +0000
commitaf47c8ccfc81d88575f214c6d9da70e669fb4791 (patch)
tree6d0dd51c561e31581bc614a3a9d9e4bcf7487c6e /chrome/browser/spellcheck_host.cc
parentebbbb9f1a3c6244b993fa96505b99ae49d1db732 (diff)
downloadchromium_src-af47c8ccfc81d88575f214c6d9da70e669fb4791.zip
chromium_src-af47c8ccfc81d88575f214c6d9da70e669fb4791.tar.gz
chromium_src-af47c8ccfc81d88575f214c6d9da70e669fb4791.tar.bz2
Fix a bad rebase conflict. This should fix the bots.
BUG=None TEST=None TBR=jam@chromium.org Review URL: http://codereview.chromium.org/6651021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77459 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/spellcheck_host.cc')
-rw-r--r--chrome/browser/spellcheck_host.cc101
1 files changed, 1 insertions, 100 deletions
diff --git a/chrome/browser/spellcheck_host.cc b/chrome/browser/spellcheck_host.cc
index b5aa706..900e4c7 100644
--- a/chrome/browser/spellcheck_host.cc
+++ b/chrome/browser/spellcheck_host.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -9,106 +9,8 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/spellcheck_host_impl.h"
#include "chrome/browser/spellchecker_platform_engine.h"
-#include "chrome/common/chrome_constants.h"
-#include "chrome/common/chrome_paths.h"
-#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/spellcheck_common.h"
-#include "content/common/notification_service.h"
-#include "googleurl/src/gurl.h"
-#include "third_party/hunspell/google/bdict.h"
-#include "ui/base/l10n/l10n_util.h"
-
-namespace {
-
-FilePath GetFirstChoiceFilePath(const std::string& language) {
- FilePath dict_dir;
- {
- // This should not do blocking IO from the UI thread!
- // Temporarily allow it for now.
- // http://code.google.com/p/chromium/issues/detail?id=60643
- base::ThreadRestrictions::ScopedAllowIO allow_io;
- PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir);
- }
- return SpellCheckCommon::GetVersionedFileName(language, dict_dir);
-}
-
-#if defined(OS_MACOSX)
-// Collect metrics on how often Hunspell is used on OS X vs the native
-// spellchecker.
-void RecordSpellCheckStats(bool native_spellchecker_used,
- const std::string& language) {
- static std::set<std::string> languages_seen;
-
- // Only count a language code once for each session..
- if (languages_seen.find(language) != languages_seen.end()) {
- return;
- }
- languages_seen.insert(language);
-
- enum {
- SPELLCHECK_OSX_NATIVE_SPELLCHECKER_USED = 0,
- SPELLCHECK_HUNSPELL_USED = 1
- };
-
- bool engine_used = native_spellchecker_used ?
- SPELLCHECK_OSX_NATIVE_SPELLCHECKER_USED :
- SPELLCHECK_HUNSPELL_USED;
-
- UMA_HISTOGRAM_COUNTS("SpellCheck.OSXEngineUsed", engine_used);
-}
-#endif
-
-#if defined(OS_WIN)
-FilePath GetFallbackFilePath(const FilePath& first_choice) {
- FilePath dict_dir;
- PathService::Get(chrome::DIR_USER_DATA, &dict_dir);
- return dict_dir.Append(first_choice.BaseName());
-}
-#endif
-
-} // namespace
-
-// Constructed on UI thread.
-SpellCheckHost::SpellCheckHost(SpellCheckHostObserver* observer,
- const std::string& language,
- URLRequestContextGetter* request_context_getter)
- : observer_(observer),
- language_(language),
- file_(base::kInvalidPlatformFileValue),
- tried_to_download_(false),
- use_platform_spellchecker_(false),
- request_context_getter_(request_context_getter) {
- DCHECK(observer_);
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- FilePath personal_file_directory;
- PathService::Get(chrome::DIR_USER_DATA, &personal_file_directory);
- custom_dictionary_file_ =
- personal_file_directory.Append(chrome::kCustomDictionaryFileName);
-
- bdict_file_path_ = GetFirstChoiceFilePath(language);
-}
-
-SpellCheckHost::~SpellCheckHost() {
- if (file_ != base::kInvalidPlatformFileValue)
- base::ClosePlatformFile(file_);
-}
-
-void SpellCheckHost::Initialize() {
- if (SpellCheckerPlatform::SpellCheckerAvailable() &&
- SpellCheckerPlatform::PlatformSupportsLanguage(language_)) {
-#if defined(OS_MACOSX)
- RecordSpellCheckStats(true, language_);
-#endif
- use_platform_spellchecker_ = true;
- SpellCheckerPlatform::SetLanguage(language_);
- MessageLoop::current()->PostTask(FROM_HERE,
- NewRunnableMethod(this,
- &SpellCheckHost::InformObserverOfInitialization));
- return;
- }
->>>>>>> Update a bunch of files to the new location of notification files.
// static
scoped_refptr<SpellCheckHost> SpellCheckHost::Create(
@@ -167,4 +69,3 @@ int SpellCheckHost::GetSpellCheckLanguages(
}
return -1;
}
-