summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/profile.cc4
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc15
-rw-r--r--chrome/browser/spellcheck_host.cc84
-rw-r--r--chrome/browser/spellcheck_host.h18
-rwxr-xr-xchrome/chrome.gyp23
-rw-r--r--chrome/common/notification_type.h2
-rw-r--r--chrome/common/render_messages.h19
-rw-r--r--chrome/common/render_messages_internal.h3
-rw-r--r--chrome/renderer/render_thread.cc6
-rw-r--r--chrome/renderer/render_thread.h3
-rw-r--r--chrome/renderer/render_view.cc20
-rw-r--r--chrome/renderer/spellchecker/spellcheck.cc14
-rw-r--r--chrome/renderer/spellchecker/spellcheck.h10
13 files changed, 80 insertions, 141 deletions
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 6926557..76d9b3d 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -1339,8 +1339,8 @@ void ProfileImpl::ReinitializeSpellCheckHost(bool force) {
}
void ProfileImpl::SpellCheckHostInitialized() {
- spellcheck_host_ready_ = spellcheck_host_ &&
- spellcheck_host_->bdict_file() != base::kInvalidPlatformFileValue;
+ spellcheck_host_ready_ =
+ spellcheck_host_ && spellcheck_host_->bdict_fd().fd != -1;
NotificationService::current()->Notify(
NotificationType::SPELLCHECK_HOST_REINITIALIZED,
Source<Profile>(this), NotificationService::NoDetails());
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 200fecf..0face77 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -57,7 +57,6 @@
#include "grit/generated_resources.h"
#include "ipc/ipc_logging.h"
#include "ipc/ipc_message.h"
-#include "ipc/ipc_platform_file.h"
#include "ipc/ipc_switches.h"
#if defined(OS_WIN)
@@ -1137,23 +1136,13 @@ void BrowserRenderProcessHost::InitSpellChecker() {
SpellCheckHost* spellcheck_host = profile()->GetSpellCheckHost();
if (spellcheck_host) {
PrefService* prefs = profile()->GetPrefs();
- IPC::PlatformFileForTransit file;
-#if defined(OS_POSIX)
- file = base::FileDescriptor(spellcheck_host->bdict_file(), false);
-#elif defined(OS_WIN)
- ::DuplicateHandle(::GetCurrentProcess(), spellcheck_host->bdict_file(),
- GetHandle(), &file, 0, false, DUPLICATE_SAME_ACCESS);
-#endif
Send(new ViewMsg_SpellChecker_Init(
- file,
- spellcheck_host->custom_words(),
+ spellcheck_host->bdict_fd(), spellcheck_host->custom_words(),
spellcheck_host->language(),
prefs->GetBoolean(prefs::kEnableAutoSpellCorrect)));
} else {
Send(new ViewMsg_SpellChecker_Init(
- IPC::PlatformFileForTransit(),
- std::vector<std::string>(),
- std::string(),
+ base::FileDescriptor(), std::vector<std::string>(), std::string(),
false));
}
}
diff --git a/chrome/browser/spellcheck_host.cc b/chrome/browser/spellcheck_host.cc
index 05e328d..c9fea3ecf 100644
--- a/chrome/browser/spellcheck_host.cc
+++ b/chrome/browser/spellcheck_host.cc
@@ -121,18 +121,6 @@ FilePath GetVersionedFileName(const std::string& input_language,
return dict_dir.AppendASCII(versioned_bdict_file_name);
}
-FilePath GetFirstChoiceFilePath(const std::string& language) {
- FilePath dict_dir;
- PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir);
- return GetVersionedFileName(language, dict_dir);
-}
-
-FilePath GetFallbackFilePath(const FilePath& first_choice) {
- FilePath dict_dir;
- PathService::Get(chrome::DIR_USER_DATA, &dict_dir);
- return dict_dir.Append(first_choice.BaseName());
-}
-
} // namespace
// Constructed on UI thread.
@@ -141,26 +129,29 @@ SpellCheckHost::SpellCheckHost(Observer* observer,
URLRequestContextGetter* request_context_getter)
: observer_(observer),
language_(language),
- file_(base::kInvalidPlatformFileValue),
tried_to_download_(false),
request_context_getter_(request_context_getter) {
DCHECK(observer_);
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+ // TODO(estade): for Windows, we need to fall back to DIR_USER_DATA if
+ // DIR_APP_DICTIONARIES is not writeable.
+ FilePath dict_dir;
+ PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir);
+ bdict_file_ = GetVersionedFileName(language, dict_dir);
+
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);
-
ChromeThread::PostTask(ChromeThread::FILE, FROM_HERE,
- NewRunnableMethod(this, &SpellCheckHost::InitializeDictionaryLocation));
+ NewRunnableMethod(this, &SpellCheckHost::Initialize));
}
SpellCheckHost::~SpellCheckHost() {
- if (file_ != base::kInvalidPlatformFileValue)
- base::ClosePlatformFile(file_);
+ if (fd_.fd != -1)
+ close(fd_.fd);
}
void SpellCheckHost::UnsetObserver() {
@@ -181,39 +172,24 @@ void SpellCheckHost::AddWord(const std::string& word) {
Source<SpellCheckHost>(this), NotificationService::NoDetails());
}
-void SpellCheckHost::InitializeDictionaryLocation() {
- DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
-
-#if defined(OS_WIN)
- // Check if the dictionary exists in the fallback location. If so, use it
- // rather than downloading anew.
- FilePath fallback = GetFallbackFilePath(bdict_file_path_);
- if (!file_util::PathExists(bdict_file_path_) &&
- file_util::PathExists(fallback)) {
- bdict_file_path_ = fallback;
- }
-#endif
-
- Initialize();
-}
-
void SpellCheckHost::Initialize() {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
if (!observer_)
return;
- file_ = base::CreatePlatformFile(bdict_file_path_,
- base::PLATFORM_FILE_READ | base::PLATFORM_FILE_OPEN,
- NULL);
+ // We set |auto_close| to false because we don't want IPC to close the fd.
+ // We will close it manually in the destructor.
+ fd_ = base::FileDescriptor(open(bdict_file_.value().c_str(), O_RDONLY),
+ false);
// File didn't exist. Download it.
- if (file_ == base::kInvalidPlatformFileValue && !tried_to_download_) {
+ if (fd_.fd == -1 && !tried_to_download_) {
DownloadDictionary();
return;
}
- if (file_ != base::kInvalidPlatformFileValue) {
+ if (fd_.fd != -1) {
// Load custom dictionary.
std::string contents;
file_util::ReadFileToString(custom_dictionary_file_, &contents);
@@ -242,7 +218,7 @@ void SpellCheckHost::DownloadDictionary() {
static const char kDownloadServerUrl[] =
"http://cache.pack.google.com/edgedl/chrome/dict/";
GURL url = GURL(std::string(kDownloadServerUrl) + WideToUTF8(
- l10n_util::ToLower(bdict_file_path_.BaseName().ToWStringHack())));
+ l10n_util::ToLower(bdict_file_.BaseName().ToWStringHack())));
fetcher_.reset(new URLFetcher(url, URLFetcher::GET, this));
fetcher_->set_request_context(request_context_getter_.get());
tried_to_download_ = true;
@@ -287,27 +263,15 @@ void SpellCheckHost::OnURLFetchComplete(const URLFetcher* source,
}
size_t bytes_written =
- file_util::WriteFile(bdict_file_path_, data.data(), data.length());
+ file_util::WriteFile(bdict_file_, data.data(), data.length());
if (bytes_written != data.length()) {
- bool success = false;
-#if defined(OS_WIN)
- bdict_file_path_ = GetFallbackFilePath(bdict_file_path_);
- bytes_written =
- file_util::WriteFile(GetFallbackFilePath(bdict_file_path_),
- data.data(), data.length());
- if (bytes_written == data.length())
- success = true;
-#endif
-
- if (!success) {
- LOG(ERROR) << "Failure to save dictionary.";
- // To avoid trying to load a partially saved dictionary, shortcut the
- // Initialize() call.
- ChromeThread::PostTask(ChromeThread::UI, FROM_HERE,
- NewRunnableMethod(this,
- &SpellCheckHost::InformObserverOfInitialization));
- return;
- }
+ LOG(ERROR) << "Failure to save dictionary.";
+ // To avoid trying to load a partially saved dictionary, shortcut the
+ // Initialize() call.
+ ChromeThread::PostTask(ChromeThread::UI, FROM_HERE,
+ NewRunnableMethod(this,
+ &SpellCheckHost::InformObserverOfInitialization));
+ return;
}
Initialize();
diff --git a/chrome/browser/spellcheck_host.h b/chrome/browser/spellcheck_host.h
index d0bc6ee..8c2ef55 100644
--- a/chrome/browser/spellcheck_host.h
+++ b/chrome/browser/spellcheck_host.h
@@ -8,8 +8,8 @@
#include <string>
#include <vector>
+#include "base/file_descriptor_posix.h"
#include "base/file_path.h"
-#include "base/platform_file.h"
#include "base/ref_counted.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/net/url_fetcher.h"
@@ -35,7 +35,7 @@ class SpellCheckHost : public base::RefCountedThreadSafe<SpellCheckHost,
// update.
void AddWord(const std::string& word);
- const base::PlatformFile& bdict_file() const { return file_; }
+ const base::FileDescriptor& bdict_fd() const { return fd_; };
const std::vector<std::string>& custom_words() const { return custom_words_; }
@@ -50,14 +50,6 @@ class SpellCheckHost : public base::RefCountedThreadSafe<SpellCheckHost,
virtual ~SpellCheckHost();
- // Figure out the location for the dictionary. This is only non-trivial for
- // Windows:
- // The default place whether the spellcheck dictionary can reside is
- // chrome::DIR_APP_DICTIONARIES. However, for systemwide installations,
- // this directory may not have permissions for download. In that case, the
- // alternate directory for download is chrome::DIR_USER_DATA.
- void InitializeDictionaryLocation();
-
// Load and parse the custom words dictionary and open the bdic file.
// Executed on the file thread.
void Initialize();
@@ -84,7 +76,7 @@ class SpellCheckHost : public base::RefCountedThreadSafe<SpellCheckHost,
Observer* observer_;
// The desired location of the dictionary file (whether or not it exists yet).
- FilePath bdict_file_path_;
+ FilePath bdict_file_;
// The location of the custom words file.
FilePath custom_dictionary_file_;
@@ -92,8 +84,8 @@ class SpellCheckHost : public base::RefCountedThreadSafe<SpellCheckHost,
// The language of the dictionary file.
std::string language_;
- // The file descriptor/handle for the dictionary file.
- base::PlatformFile file_;
+ // On POSIX, the file descriptor for the dictionary file.
+ base::FileDescriptor fd_;
// In-memory cache of the custom words file.
std::vector<std::string> custom_words_;
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index a074b7a..ae65611 100755
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -2123,8 +2123,6 @@
'browser/shell_integration_mac.mm',
'browser/shell_integration_linux.cc',
'browser/shell_integration_win.cc',
- 'browser/spellcheck_host.cc',
- 'browser/spellcheck_host.h',
'browser/spellcheck_worditerator.cc',
'browser/spellcheck_worditerator.h',
'browser/spellchecker.cc',
@@ -2567,6 +2565,8 @@
'sources': [
'browser/crash_handler_host_linux.h',
'browser/net/ssl_config_service_manager_pref.cc',
+ 'browser/spellcheck_host.cc',
+ 'browser/spellcheck_host.h',
],
'sources/': [
# Exclude most of printing.
@@ -3377,10 +3377,6 @@
'renderer/renderer_web_database_observer.h',
'renderer/socket_stream_dispatcher.cc',
'renderer/socket_stream_dispatcher.h',
- 'renderer/spellchecker/spellcheck.cc',
- 'renderer/spellchecker/spellcheck.h',
- 'renderer/spellchecker/spellcheck_worditerator.cc',
- 'renderer/spellchecker/spellcheck_worditerator.h',
'renderer/user_script_idle_scheduler.cc',
'renderer/user_script_idle_scheduler.h',
'renderer/user_script_slave.cc',
@@ -3417,6 +3413,12 @@
'../build/linux/system.gyp:gtk',
'../sandbox/sandbox.gyp:sandbox',
],
+ 'sources': [
+ 'renderer/spellchecker/spellcheck.cc',
+ 'renderer/spellchecker/spellcheck.h',
+ 'renderer/spellchecker/spellcheck_worditerator.cc',
+ 'renderer/spellchecker/spellcheck_worditerator.h',
+ ],
}],
# Windows-specific rules.
['OS=="win"', {
@@ -3430,15 +3432,6 @@
'../third_party/tcmalloc/tcmalloc.gyp:tcmalloc',
],
},],
- # Mac-specific rules.
- ['OS=="mac"', {
- 'sources!': [
- 'renderer/spellchecker/spellcheck.cc',
- 'renderer/spellchecker/spellcheck.h',
- 'renderer/spellchecker/spellcheck_worditerator.cc',
- 'renderer/spellchecker/spellcheck_worditerator.h',
- ],
- },],
],
},
{
diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h
index 8d4b747..c8439bf 100644
--- a/chrome/common/notification_type.h
+++ b/chrome/common/notification_type.h
@@ -545,6 +545,7 @@ class NotificationType {
// profile.
SPELLCHECKER_REINITIALIZED,
+#if defined(SPELLCHECKER_IN_RENDERER)
// Sent when SpellCheckHost has been reloaded. The source is the profile,
// the details are NoDetails.
SPELLCHECK_HOST_REINITIALIZED,
@@ -552,6 +553,7 @@ class NotificationType {
// Sent when a new word has been added to the custom dictionary. The source
// is the SpellCheckHost, the details are NoDetails.
SPELLCHECK_WORD_ADDED,
+#endif
// Sent when the bookmark bubble is shown for a particular URL. The source
// is the profile, the details the URL.
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 3403448..c2410ce 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -12,7 +12,6 @@
#include "app/clipboard/clipboard.h"
#include "app/gfx/native_widget_types.h"
#include "base/basictypes.h"
-#include "base/platform_file.h"
#include "base/ref_counted.h"
#include "base/shared_memory.h"
#include "base/string16.h"
@@ -32,7 +31,6 @@
#include "chrome/common/webkit_param_traits.h"
#include "googleurl/src/gurl.h"
#include "ipc/ipc_message_utils.h"
-#include "ipc/ipc_platform_file.h"
#include "media/audio/audio_output.h"
#include "net/base/upload_data.h"
#include "net/http/http_response_headers.h"
@@ -52,7 +50,12 @@
#include "webkit/glue/webplugininfo.h"
#include "webkit/glue/webpreferences.h"
+#if defined(OS_WIN)
+#include "base/platform_file.h"
+#endif
+
#if defined(OS_POSIX)
+#include "base/file_descriptor_posix.h"
#endif
namespace base {
@@ -407,8 +410,10 @@ struct ViewMsg_PrintPages_Params {
};
struct ViewMsg_DatabaseOpenFileResponse_Params {
- IPC::PlatformFileForTransit file_handle; // DB file handle
-#if defined(OS_POSIX)
+#if defined(OS_WIN)
+ base::PlatformFile file_handle; // DB file handle
+#elif defined(OS_POSIX)
+ base::FileDescriptor file_handle; // DB file handle
base::FileDescriptor dir_handle; // DB directory handle
#endif
};
@@ -416,7 +421,11 @@ struct ViewMsg_DatabaseOpenFileResponse_Params {
struct ViewMsg_OpenFileForPluginResponse_Params {
// Note: if we end up having to add a directory handle, this should be
// combined with the DatabaseOpenFileResponse_Params struct.
- IPC::PlatformFileForTransit file_handle;
+#if defined(OS_WIN)
+ base::PlatformFile file_handle;
+#elif defined(OS_POSIX)
+ base::FileDescriptor file_handle;
+#endif
};
// Parameters to describe a rendered page.
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 3240bf63..275ac51 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -29,7 +29,6 @@
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_message.h"
#include "ipc/ipc_message_macros.h"
-#include "ipc/ipc_platform_file.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "webkit/appcache/appcache_interfaces.h"
#include "webkit/glue/dom_operations.h"
@@ -840,7 +839,7 @@ IPC_BEGIN_MESSAGES(View)
// be called directly after startup or in (async) response to a
// RequestDictionary ViewHost message.
IPC_MESSAGE_CONTROL4(ViewMsg_SpellChecker_Init,
- IPC::PlatformFileForTransit /* bdict_file */,
+ base::FileDescriptor /* bdict_file */,
std::vector<std::string> /* custom_dict_words */,
std::string /* language */,
bool /* auto spell correct */)
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc
index 7779a01..fc76f86 100644
--- a/chrome/renderer/render_thread.cc
+++ b/chrome/renderer/render_thread.cc
@@ -58,7 +58,6 @@
#endif
#include "chrome/renderer/user_script_slave.h"
#include "ipc/ipc_message.h"
-#include "ipc/ipc_platform_file.h"
#include "third_party/tcmalloc/tcmalloc/src/google/malloc_extension.h"
#include "third_party/WebKit/WebKit/chromium/public/WebCache.h"
#include "third_party/WebKit/WebKit/chromium/public/WebColor.h"
@@ -661,12 +660,11 @@ void RenderThread::OnPurgePluginListCache(bool reload_pages) {
#if defined(SPELLCHECKER_IN_RENDERER)
void RenderThread::OnInitSpellChecker(
- IPC::PlatformFileForTransit bdict_file,
+ const base::FileDescriptor& bdict_fd,
const std::vector<std::string>& custom_words,
const std::string& language,
bool auto_spell_correct) {
- spellchecker_->Init(IPC::PlatformFileForTransitToPlatformFile(bdict_file),
- custom_words, language);
+ spellchecker_->Init(bdict_fd, custom_words, language);
spellchecker_->EnableAutoSpellCorrect(auto_spell_correct);
}
diff --git a/chrome/renderer/render_thread.h b/chrome/renderer/render_thread.h
index 44dc6ab..aadeafc 100644
--- a/chrome/renderer/render_thread.h
+++ b/chrome/renderer/render_thread.h
@@ -18,7 +18,6 @@
#include "chrome/common/dom_storage_type.h"
#include "chrome/renderer/renderer_histogram_snapshots.h"
#include "chrome/renderer/visitedlink_slave.h"
-#include "ipc/ipc_platform_file.h"
class AppCacheDispatcher;
class DBMessageFilter;
@@ -201,7 +200,7 @@ class RenderThread : public RenderThreadBase,
void OnPurgePluginListCache(bool reload_pages);
#if defined(SPELLCHECKER_IN_RENDERER)
- void OnInitSpellChecker(IPC::PlatformFileForTransit bdict_file,
+ void OnInitSpellChecker(const base::FileDescriptor& bdict_fd,
const std::vector<std::string>& custom_words,
const std::string& language,
bool auto_spell_correct);
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 7541ceb..aa8d86d 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -1505,13 +1505,9 @@ void RenderView::spellCheck(const WebString& text,
#if defined(SPELLCHECKER_IN_RENDERER)
string16 word(text);
- RenderThread* thread = RenderThread::current();
- // Will be NULL during unit tests.
- if (thread) {
- RenderThread::current()->spellchecker()->SpellCheckWord(
- word.c_str(), word.size(), document_tag_,
- &misspelled_offset, &misspelled_length, NULL);
- }
+ RenderThread::current()->spellchecker()->SpellCheckWord(
+ word.c_str(), word.size(), document_tag_,
+ &misspelled_offset, &misspelled_length, NULL);
#else
Send(new ViewHostMsg_SpellCheck(routing_id_, text, document_tag_,
&misspelled_offset, &misspelled_length));
@@ -1524,13 +1520,9 @@ WebString RenderView::autoCorrectWord(const WebKit::WebString& word) {
if (command_line.HasSwitch(switches::kExperimentalSpellcheckerFeatures)) {
EnsureDocumentTag();
#if defined(SPELLCHECKER_IN_RENDERER)
- RenderThread* thread = RenderThread::current();
- // Will be NULL during unit tests.
- if (thread) {
- autocorrect_word =
- RenderThread::current()->spellchecker()->GetAutoCorrectionWord(
- word, document_tag_);
- }
+ autocorrect_word =
+ RenderThread::current()->spellchecker()->GetAutoCorrectionWord(
+ word, document_tag_);
#else
Send(new ViewHostMsg_GetAutoCorrectWord(
routing_id_, word, document_tag_, &autocorrect_word));
diff --git a/chrome/renderer/spellchecker/spellcheck.cc b/chrome/renderer/spellchecker/spellcheck.cc
index 3b02b54..a565b08 100644
--- a/chrome/renderer/spellchecker/spellcheck.cc
+++ b/chrome/renderer/spellchecker/spellcheck.cc
@@ -16,8 +16,7 @@ static const int kMaxSuggestions = 5;
using base::TimeTicks;
SpellCheck::SpellCheck()
- : file_(base::kInvalidPlatformFileValue),
- auto_spell_correct_turned_on_(false),
+ : auto_spell_correct_turned_on_(false),
// TODO(estade): initialize this properly.
is_using_platform_spelling_engine_(false),
initialized_(false) {
@@ -27,13 +26,13 @@ SpellCheck::SpellCheck()
SpellCheck::~SpellCheck() {
}
-void SpellCheck::Init(base::PlatformFile file,
+void SpellCheck::Init(const base::FileDescriptor& fd,
const std::vector<std::string>& custom_words,
const std::string language) {
initialized_ = true;
hunspell_.reset();
bdict_file_.reset();
- file_ = file;
+ fd_ = fd;
character_attributes_.SetDefaultLanguage(language);
custom_words_.insert(custom_words_.end(),
@@ -58,7 +57,7 @@ bool SpellCheck::SpellCheckWord(
return true;
// Do nothing if spell checking is disabled.
- if (initialized_ && file_ == base::kInvalidPlatformFileValue)
+ if (initialized_ && fd_.fd == -1)
return true;
*misspelling_start = 0;
@@ -165,7 +164,7 @@ void SpellCheck::InitializeHunspell() {
bdict_file_.reset(new file_util::MemoryMappedFile);
- if (bdict_file_->Initialize(file_)) {
+ if (bdict_file_->Initialize(fd_)) {
TimeTicks start_time = TimeTicks::Now();
hunspell_.reset(
@@ -195,8 +194,7 @@ bool SpellCheck::InitializeIfNeeded() {
}
// Check if the platform spellchecker is being used.
- if (!is_using_platform_spelling_engine_ &&
- file_ != base::kInvalidPlatformFileValue) {
+ if (!is_using_platform_spelling_engine_ && fd_.fd != -1) {
// If it isn't, init hunspell.
InitializeHunspell();
}
diff --git a/chrome/renderer/spellchecker/spellcheck.h b/chrome/renderer/spellchecker/spellcheck.h
index ef194bd..b482770 100644
--- a/chrome/renderer/spellchecker/spellcheck.h
+++ b/chrome/renderer/spellchecker/spellcheck.h
@@ -10,7 +10,7 @@
#include <vector>
#include "app/l10n_util.h"
-#include "base/platform_file.h"
+#include "base/file_descriptor_posix.h"
#include "base/string16.h"
#include "base/time.h"
#include "chrome/renderer/spellchecker/spellcheck_worditerator.h"
@@ -18,6 +18,10 @@
class Hunspell;
+namespace base {
+class FileDescriptor;
+}
+
namespace file_util {
class MemoryMappedFile;
}
@@ -28,7 +32,7 @@ class SpellCheck {
~SpellCheck();
- void Init(base::PlatformFile file,
+ void Init(const base::FileDescriptor& bdict_fd,
const std::vector<std::string>& custom_words,
const std::string language);
@@ -97,7 +101,7 @@ class SpellCheck {
// The hunspell dictionary in use.
scoped_ptr<Hunspell> hunspell_;
- base::PlatformFile file_;
+ base::FileDescriptor fd_;
std::vector<std::string> custom_words_;
// Represents character attributes used for filtering out characters which