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

Side by Side Diff: chrome/renderer/spellchecker/spellcheck.cc

Issue 209193002: Remove PlatformFile from spell checker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert IsEnabled behavior Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/spellchecker/spellcheck.h" 5 #include "chrome/renderer/spellchecker/spellcheck.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 IPC_MESSAGE_UNHANDLED(handled = false) 127 IPC_MESSAGE_UNHANDLED(handled = false)
128 IPC_END_MESSAGE_MAP() 128 IPC_END_MESSAGE_MAP()
129 129
130 return handled; 130 return handled;
131 } 131 }
132 132
133 void SpellCheck::OnInit(IPC::PlatformFileForTransit bdict_file, 133 void SpellCheck::OnInit(IPC::PlatformFileForTransit bdict_file,
134 const std::set<std::string>& custom_words, 134 const std::set<std::string>& custom_words,
135 const std::string& language, 135 const std::string& language,
136 bool auto_spell_correct) { 136 bool auto_spell_correct) {
137 Init(IPC::PlatformFileForTransitToPlatformFile(bdict_file), 137 Init(IPC::PlatformFileForTransitToFile(bdict_file),
138 custom_words, language); 138 custom_words, language);
139 auto_spell_correct_turned_on_ = auto_spell_correct; 139 auto_spell_correct_turned_on_ = auto_spell_correct;
140 #if !defined(OS_MACOSX) 140 #if !defined(OS_MACOSX)
141 PostDelayedSpellCheckTask(pending_request_param_.release()); 141 PostDelayedSpellCheckTask(pending_request_param_.release());
142 #endif 142 #endif
143 } 143 }
144 144
145 void SpellCheck::OnCustomDictionaryChanged( 145 void SpellCheck::OnCustomDictionaryChanged(
146 const std::vector<std::string>& words_added, 146 const std::vector<std::string>& words_added,
147 const std::vector<std::string>& words_removed) { 147 const std::vector<std::string>& words_removed) {
(...skipping 12 matching lines...) Expand all
160 160
161 void SpellCheck::OnRequestDocumentMarkers() { 161 void SpellCheck::OnRequestDocumentMarkers() {
162 DocumentMarkersCollector collector; 162 DocumentMarkersCollector collector;
163 content::RenderView::ForEach(&collector); 163 content::RenderView::ForEach(&collector);
164 content::RenderThread::Get()->Send( 164 content::RenderThread::Get()->Send(
165 new SpellCheckHostMsg_RespondDocumentMarkers(collector.markers())); 165 new SpellCheckHostMsg_RespondDocumentMarkers(collector.markers()));
166 } 166 }
167 167
168 // TODO(groby): Make sure we always have a spelling engine, even before Init() 168 // TODO(groby): Make sure we always have a spelling engine, even before Init()
169 // is called. 169 // is called.
170 void SpellCheck::Init(base::PlatformFile file, 170 void SpellCheck::Init(base::File file,
171 const std::set<std::string>& custom_words, 171 const std::set<std::string>& custom_words,
172 const std::string& language) { 172 const std::string& language) {
173 spellcheck_.Init(file, language); 173 spellcheck_.Init(file.Pass(), language);
174 custom_dictionary_.Init(custom_words); 174 custom_dictionary_.Init(custom_words);
175 } 175 }
176 176
177 bool SpellCheck::SpellCheckWord( 177 bool SpellCheck::SpellCheckWord(
178 const base::char16* in_word, 178 const base::char16* in_word,
179 int in_word_len, 179 int in_word_len,
180 int tag, 180 int tag,
181 int* misspelling_start, 181 int* misspelling_start,
182 int* misspelling_len, 182 int* misspelling_len,
183 std::vector<base::string16>* optional_suggestions) { 183 std::vector<base::string16>* optional_suggestions) {
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 list.push_back(WebTextCheckingResult( 374 list.push_back(WebTextCheckingResult(
375 static_cast<WebTextDecorationType>(decoration), 375 static_cast<WebTextDecorationType>(decoration),
376 word_location + line_offset, 376 word_location + line_offset,
377 word_length, 377 word_length,
378 spellcheck_results[i].replacement, 378 spellcheck_results[i].replacement,
379 spellcheck_results[i].hash)); 379 spellcheck_results[i].hash));
380 } 380 }
381 } 381 }
382 textcheck_results->assign(list); 382 textcheck_results->assign(list);
383 } 383 }
OLDNEW
« no previous file with comments | « chrome/renderer/spellchecker/spellcheck.h ('k') | chrome/renderer/spellchecker/spellcheck_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698