OLD | NEW |
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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | |
10 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
18 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
20 #include "chrome/common/channel_info.h" | 20 #include "chrome/common/channel_info.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 content::RenderView::ForEach(&collector); | 257 content::RenderView::ForEach(&collector); |
258 content::RenderThread::Get()->Send( | 258 content::RenderThread::Get()->Send( |
259 new SpellCheckHostMsg_RespondDocumentMarkers(collector.markers())); | 259 new SpellCheckHostMsg_RespondDocumentMarkers(collector.markers())); |
260 } | 260 } |
261 | 261 |
262 // TODO(groby): Make sure we always have a spelling engine, even before | 262 // TODO(groby): Make sure we always have a spelling engine, even before |
263 // AddSpellcheckLanguage() is called. | 263 // AddSpellcheckLanguage() is called. |
264 void SpellCheck::AddSpellcheckLanguage(base::File file, | 264 void SpellCheck::AddSpellcheckLanguage(base::File file, |
265 const std::string& language) { | 265 const std::string& language) { |
266 languages_.push_back(new SpellcheckLanguage()); | 266 languages_.push_back(new SpellcheckLanguage()); |
267 languages_.back()->Init(file.Pass(), language); | 267 languages_.back()->Init(std::move(file), language); |
268 } | 268 } |
269 | 269 |
270 bool SpellCheck::SpellCheckWord( | 270 bool SpellCheck::SpellCheckWord( |
271 const base::char16* text_begin, | 271 const base::char16* text_begin, |
272 int position_in_text, | 272 int position_in_text, |
273 int text_length, | 273 int text_length, |
274 int tag, | 274 int tag, |
275 int* misspelling_start, | 275 int* misspelling_start, |
276 int* misspelling_len, | 276 int* misspelling_len, |
277 std::vector<base::string16>* optional_suggestions) { | 277 std::vector<base::string16>* optional_suggestions) { |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 | 539 |
540 bool SpellCheck::IsSpellcheckEnabled() { | 540 bool SpellCheck::IsSpellcheckEnabled() { |
541 #if defined(OS_ANDROID) | 541 #if defined(OS_ANDROID) |
542 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 542 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
543 switches::kEnableAndroidSpellChecker)) { | 543 switches::kEnableAndroidSpellChecker)) { |
544 return false; | 544 return false; |
545 } | 545 } |
546 #endif | 546 #endif |
547 return spellcheck_enabled_; | 547 return spellcheck_enabled_; |
548 } | 548 } |
OLD | NEW |