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

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

Issue 15940004: Add HasWord(string) method to SpellcheckCustomDictionary (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Clarified message direction (browser-to-renderer) in spellcheck_messages.h Created 7 years, 6 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
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/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 IPC_MESSAGE_HANDLER(SpellCheckMsg_EnableSpellCheck, OnEnableSpellCheck) 123 IPC_MESSAGE_HANDLER(SpellCheckMsg_EnableSpellCheck, OnEnableSpellCheck)
124 IPC_MESSAGE_HANDLER(SpellCheckMsg_RequestDocumentMarkers, 124 IPC_MESSAGE_HANDLER(SpellCheckMsg_RequestDocumentMarkers,
125 OnRequestDocumentMarkers) 125 OnRequestDocumentMarkers)
126 IPC_MESSAGE_UNHANDLED(handled = false) 126 IPC_MESSAGE_UNHANDLED(handled = false)
127 IPC_END_MESSAGE_MAP() 127 IPC_END_MESSAGE_MAP()
128 128
129 return handled; 129 return handled;
130 } 130 }
131 131
132 void SpellCheck::OnInit(IPC::PlatformFileForTransit bdict_file, 132 void SpellCheck::OnInit(IPC::PlatformFileForTransit bdict_file,
133 const std::vector<std::string>& custom_words, 133 const std::set<std::string>& custom_words,
134 const std::string& language, 134 const std::string& language,
135 bool auto_spell_correct) { 135 bool auto_spell_correct) {
136 Init(IPC::PlatformFileForTransitToPlatformFile(bdict_file), 136 Init(IPC::PlatformFileForTransitToPlatformFile(bdict_file),
137 custom_words, language); 137 custom_words, language);
138 auto_spell_correct_turned_on_ = auto_spell_correct; 138 auto_spell_correct_turned_on_ = auto_spell_correct;
139 #if !defined(OS_MACOSX) 139 #if !defined(OS_MACOSX)
140 PostDelayedSpellCheckTask(pending_request_param_.release()); 140 PostDelayedSpellCheckTask(pending_request_param_.release());
141 #endif 141 #endif
142 } 142 }
143 143
(...skipping 16 matching lines...) Expand all
160 void SpellCheck::OnRequestDocumentMarkers() { 160 void SpellCheck::OnRequestDocumentMarkers() {
161 DocumentMarkersCollector collector; 161 DocumentMarkersCollector collector;
162 content::RenderView::ForEach(&collector); 162 content::RenderView::ForEach(&collector);
163 content::RenderThread::Get()->Send( 163 content::RenderThread::Get()->Send(
164 new SpellCheckHostMsg_RespondDocumentMarkers(collector.markers())); 164 new SpellCheckHostMsg_RespondDocumentMarkers(collector.markers()));
165 } 165 }
166 166
167 // TODO(groby): Make sure we always have a spelling engine, even before Init() 167 // TODO(groby): Make sure we always have a spelling engine, even before Init()
168 // is called. 168 // is called.
169 void SpellCheck::Init(base::PlatformFile file, 169 void SpellCheck::Init(base::PlatformFile file,
170 const std::vector<std::string>& custom_words, 170 const std::set<std::string>& custom_words,
171 const std::string& language) { 171 const std::string& language) {
172 spellcheck_.Init(file, language); 172 spellcheck_.Init(file, language);
173 custom_dictionary_.Init(custom_words); 173 custom_dictionary_.Init(custom_words);
174 } 174 }
175 175
176 bool SpellCheck::SpellCheckWord( 176 bool SpellCheck::SpellCheckWord(
177 const char16* in_word, 177 const char16* in_word,
178 int in_word_len, 178 int in_word_len,
179 int tag, 179 int tag,
180 int* misspelling_start, 180 int* misspelling_start,
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 list.push_back(WebTextCheckingResult( 372 list.push_back(WebTextCheckingResult(
373 type, 373 type,
374 word_location + line_offset, 374 word_location + line_offset,
375 word_length, 375 word_length,
376 spellcheck_results[i].replacement, 376 spellcheck_results[i].replacement,
377 spellcheck_results[i].hash)); 377 spellcheck_results[i].hash));
378 } 378 }
379 } 379 }
380 textcheck_results->assign(list); 380 textcheck_results->assign(list);
381 } 381 }
OLDNEW
« no previous file with comments | « chrome/renderer/spellchecker/spellcheck.h ('k') | chrome/renderer/spellchecker/spellcheck_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698