| 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_provider.h" | 5 #include "chrome/renderer/spellchecker/spellcheck_provider.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "chrome/common/spellcheck_marker.h" | 10 #include "chrome/common/spellcheck_marker.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 last_results_.assign(WebKit::WebVector<WebKit::WebTextCheckingResult>()); | 68 last_results_.assign(WebKit::WebVector<WebKit::WebTextCheckingResult>()); |
| 69 | 69 |
| 70 #if defined(OS_MACOSX) | 70 #if defined(OS_MACOSX) |
| 71 // Text check (unified request for grammar and spell check) is only | 71 // Text check (unified request for grammar and spell check) is only |
| 72 // available for browser process, so we ask the system spellchecker | 72 // available for browser process, so we ask the system spellchecker |
| 73 // over IPC or return an empty result if the checker is not | 73 // over IPC or return an empty result if the checker is not |
| 74 // available. | 74 // available. |
| 75 Send(new SpellCheckHostMsg_RequestTextCheck( | 75 Send(new SpellCheckHostMsg_RequestTextCheck( |
| 76 routing_id(), | 76 routing_id(), |
| 77 text_check_completions_.Add(completion), | 77 text_check_completions_.Add(completion), |
| 78 text)); | 78 text, |
| 79 markers)); |
| 79 #else | 80 #else |
| 80 Send(new SpellCheckHostMsg_CallSpellingService( | 81 Send(new SpellCheckHostMsg_CallSpellingService( |
| 81 routing_id(), | 82 routing_id(), |
| 82 text_check_completions_.Add(completion), | 83 text_check_completions_.Add(completion), |
| 83 string16(text), | 84 string16(text), |
| 84 markers)); | 85 markers)); |
| 85 #endif // !OS_MACOSX | 86 #endif // !OS_MACOSX |
| 86 } | 87 } |
| 87 | 88 |
| 88 bool SpellCheckProvider::OnMessageReceived(const IPC::Message& message) { | 89 bool SpellCheckProvider::OnMessageReceived(const IPC::Message& message) { |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 results[i].length = last_results_[i].length; | 349 results[i].length = last_results_[i].length; |
| 349 results[i].replacement = last_results_[i].replacement; | 350 results[i].replacement = last_results_[i].replacement; |
| 350 } | 351 } |
| 351 completion->didFinishCheckingText(results); | 352 completion->didFinishCheckingText(results); |
| 352 return true; | 353 return true; |
| 353 } | 354 } |
| 354 } | 355 } |
| 355 | 356 |
| 356 return false; | 357 return false; |
| 357 } | 358 } |
| OLD | NEW |