| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/shell/renderer/test_runner/spell_check_client.h" | 5 #include "content/shell/renderer/test_runner/spell_check_client.h" |
| 6 | 6 |
| 7 #include "content/shell/renderer/test_runner/WebTestDelegate.h" | |
| 8 #include "content/shell/renderer/test_runner/mock_grammar_check.h" | 7 #include "content/shell/renderer/test_runner/mock_grammar_check.h" |
| 8 #include "content/shell/renderer/test_runner/web_test_delegate.h" |
| 9 #include "content/shell/renderer/test_runner/web_test_proxy.h" | 9 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
| 10 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" | 10 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" |
| 11 #include "third_party/WebKit/public/web/WebTextCheckingResult.h" | 11 #include "third_party/WebKit/public/web/WebTextCheckingResult.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 class HostMethodTask : public WebMethodTask<SpellCheckClient> { | 17 class HostMethodTask : public WebMethodTask<SpellCheckClient> { |
| 18 public: | 18 public: |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 94 } |
| 95 | 95 |
| 96 if (last_requested_text_checking_completion_) | 96 if (last_requested_text_checking_completion_) |
| 97 last_requested_text_checking_completion_->didCancelCheckingText(); | 97 last_requested_text_checking_completion_->didCancelCheckingText(); |
| 98 | 98 |
| 99 last_requested_text_checking_completion_ = completion; | 99 last_requested_text_checking_completion_ = completion; |
| 100 last_requested_text_check_string_ = text; | 100 last_requested_text_check_string_ = text; |
| 101 if (spell_check_.HasInCache(text)) | 101 if (spell_check_.HasInCache(text)) |
| 102 FinishLastTextCheck(); | 102 FinishLastTextCheck(); |
| 103 else | 103 else |
| 104 delegate_->postDelayedTask( | 104 delegate_->PostDelayedTask( |
| 105 new HostMethodTask(this, &SpellCheckClient::FinishLastTextCheck), 0); | 105 new HostMethodTask(this, &SpellCheckClient::FinishLastTextCheck), 0); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void SpellCheckClient::FinishLastTextCheck() { | 108 void SpellCheckClient::FinishLastTextCheck() { |
| 109 if (!last_requested_text_checking_completion_) | 109 if (!last_requested_text_checking_completion_) |
| 110 return; | 110 return; |
| 111 std::vector<blink::WebTextCheckingResult> results; | 111 std::vector<blink::WebTextCheckingResult> results; |
| 112 int offset = 0; | 112 int offset = 0; |
| 113 base::string16 text = last_requested_text_check_string_; | 113 base::string16 text = last_requested_text_check_string_; |
| 114 if (!spell_check_.IsMultiWordMisspelling(blink::WebString(text), &results)) { | 114 if (!spell_check_.IsMultiWordMisspelling(blink::WebString(text), &results)) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 143 blink::WebString SpellCheckClient::autoCorrectWord( | 143 blink::WebString SpellCheckClient::autoCorrectWord( |
| 144 const blink::WebString& word) { | 144 const blink::WebString& word) { |
| 145 // Returns an empty string as Mac WebKit ('WebKitSupport/WebEditorClient.mm') | 145 // Returns an empty string as Mac WebKit ('WebKitSupport/WebEditorClient.mm') |
| 146 // does. (If this function returns a non-empty string, WebKit replaces the | 146 // does. (If this function returns a non-empty string, WebKit replaces the |
| 147 // given misspelled string with the result one. This process executes some | 147 // given misspelled string with the result one. This process executes some |
| 148 // editor commands and causes layout-test failures.) | 148 // editor commands and causes layout-test failures.) |
| 149 return blink::WebString(); | 149 return blink::WebString(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace content | 152 } // namespace content |
| OLD | NEW |