| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/sys_info.h" | |
| 16 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
| 17 #include "chrome/common/channel_info.h" | 16 #include "chrome/common/channel_info.h" |
| 18 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/common/spellcheck_common.h" | 18 #include "chrome/common/spellcheck_common.h" |
| 20 #include "chrome/common/spellcheck_messages.h" | 19 #include "chrome/common/spellcheck_messages.h" |
| 21 #include "chrome/common/spellcheck_result.h" | 20 #include "chrome/common/spellcheck_result.h" |
| 22 #include "chrome/renderer/spellchecker/spellcheck_language.h" | 21 #include "chrome/renderer/spellchecker/spellcheck_language.h" |
| 23 #include "chrome/renderer/spellchecker/spellcheck_provider.h" | 22 #include "chrome/renderer/spellchecker/spellcheck_provider.h" |
| 24 #include "components/version_info/version_info.h" | |
| 25 #include "content/public/renderer/render_thread.h" | 23 #include "content/public/renderer/render_thread.h" |
| 26 #include "content/public/renderer/render_view.h" | 24 #include "content/public/renderer/render_view.h" |
| 27 #include "content/public/renderer/render_view_visitor.h" | 25 #include "content/public/renderer/render_view_visitor.h" |
| 28 #include "ipc/ipc_platform_file.h" | 26 #include "ipc/ipc_platform_file.h" |
| 29 #include "third_party/WebKit/public/platform/WebString.h" | 27 #include "third_party/WebKit/public/platform/WebString.h" |
| 30 #include "third_party/WebKit/public/platform/WebVector.h" | 28 #include "third_party/WebKit/public/platform/WebVector.h" |
| 31 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" | 29 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" |
| 32 #include "third_party/WebKit/public/web/WebTextCheckingResult.h" | 30 #include "third_party/WebKit/public/web/WebTextCheckingResult.h" |
| 33 #include "third_party/WebKit/public/web/WebTextDecorationType.h" | 31 #include "third_party/WebKit/public/web/WebTextDecorationType.h" |
| 34 #include "third_party/WebKit/public/web/WebView.h" | 32 #include "third_party/WebKit/public/web/WebView.h" |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 static_cast<WebTextDecorationType>(decoration), | 528 static_cast<WebTextDecorationType>(decoration), |
| 531 line_offset + spellcheck_result.location, spellcheck_result.length, | 529 line_offset + spellcheck_result.location, spellcheck_result.length, |
| 532 replacement, spellcheck_result.hash)); | 530 replacement, spellcheck_result.hash)); |
| 533 } | 531 } |
| 534 | 532 |
| 535 textcheck_results->assign(results); | 533 textcheck_results->assign(results); |
| 536 } | 534 } |
| 537 | 535 |
| 538 bool SpellCheck::IsSpellcheckEnabled() { | 536 bool SpellCheck::IsSpellcheckEnabled() { |
| 539 #if defined(OS_ANDROID) | 537 #if defined(OS_ANDROID) |
| 540 if (base::SysInfo::IsLowEndDevice()) | 538 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 541 return false; | |
| 542 | |
| 543 version_info::Channel channel = chrome::GetChannel(); | |
| 544 if (channel == version_info::Channel::DEV || | |
| 545 channel == version_info::Channel::CANARY) { | |
| 546 return true; | |
| 547 } else if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 548 switches::kEnableAndroidSpellChecker)) { | 539 switches::kEnableAndroidSpellChecker)) { |
| 549 return false; | 540 return false; |
| 550 } | 541 } |
| 551 #endif | 542 #endif |
| 552 return spellcheck_enabled_; | 543 return spellcheck_enabled_; |
| 553 } | 544 } |
| OLD | NEW |