[email protected] | b38c8f31 | 2014-08-01 23:21:37 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
jochen | 73e711c | 2015-06-03 10:01:46 | [diff] [blame] | 5 | #ifndef COMPONENTS_TEST_RUNNER_SPELL_CHECK_CLIENT_H_ |
| 6 | #define COMPONENTS_TEST_RUNNER_SPELL_CHECK_CLIENT_H_ |
[email protected] | b38c8f31 | 2014-08-01 23:21:37 | [diff] [blame] | 7 | |
| 8 | #include "base/basictypes.h" |
jochen | 73e711c | 2015-06-03 10:01:46 | [diff] [blame] | 9 | #include "components/test_runner/mock_spell_check.h" |
| 10 | #include "components/test_runner/web_task.h" |
[email protected] | b38c8f31 | 2014-08-01 23:21:37 | [diff] [blame] | 11 | #include "third_party/WebKit/public/web/WebSpellCheckClient.h" |
| 12 | |
jochen | f5f3175 | 2015-06-03 12:06:34 | [diff] [blame] | 13 | namespace test_runner { |
[email protected] | b38c8f31 | 2014-08-01 23:21:37 | [diff] [blame] | 14 | |
| 15 | class WebTestDelegate; |
| 16 | class WebTestProxyBase; |
| 17 | |
| 18 | class SpellCheckClient : public blink::WebSpellCheckClient { |
| 19 | public: |
| 20 | explicit SpellCheckClient(WebTestProxyBase* web_test_proxy); |
| 21 | virtual ~SpellCheckClient(); |
| 22 | |
| 23 | void SetDelegate(WebTestDelegate* delegate); |
| 24 | |
| 25 | WebTaskList* mutable_task_list() { return &task_list_; } |
| 26 | MockSpellCheck* MockSpellCheckWord() { return &spell_check_; } |
| 27 | |
| 28 | // blink::WebSpellCheckClient implementation. |
| 29 | virtual void spellCheck( |
| 30 | const blink::WebString& text, |
| 31 | int& offset, |
| 32 | int& length, |
| 33 | blink::WebVector<blink::WebString>* optional_suggestions); |
| 34 | virtual void checkTextOfParagraph( |
| 35 | const blink::WebString& text, |
| 36 | blink::WebTextCheckingTypeMask mask, |
| 37 | blink::WebVector<blink::WebTextCheckingResult>* web_results); |
| 38 | virtual void requestCheckingOfText( |
| 39 | const blink::WebString& text, |
| 40 | const blink::WebVector<uint32_t>& markers, |
| 41 | const blink::WebVector<unsigned>& marker_offsets, |
| 42 | blink::WebTextCheckingCompletion* completion); |
| 43 | virtual blink::WebString autoCorrectWord(const blink::WebString& word); |
| 44 | |
| 45 | private: |
| 46 | void FinishLastTextCheck(); |
| 47 | |
| 48 | // The mock spellchecker used in spellCheck(). |
| 49 | MockSpellCheck spell_check_; |
| 50 | |
| 51 | blink::WebString last_requested_text_check_string_; |
| 52 | blink::WebTextCheckingCompletion* last_requested_text_checking_completion_; |
| 53 | |
| 54 | WebTaskList task_list_; |
| 55 | |
| 56 | WebTestDelegate* delegate_; |
| 57 | |
| 58 | WebTestProxyBase* web_test_proxy_; |
| 59 | |
| 60 | DISALLOW_COPY_AND_ASSIGN(SpellCheckClient); |
| 61 | }; |
| 62 | |
jochen | f5f3175 | 2015-06-03 12:06:34 | [diff] [blame] | 63 | } // namespace test_runner |
[email protected] | b38c8f31 | 2014-08-01 23:21:37 | [diff] [blame] | 64 | |
jochen | 73e711c | 2015-06-03 10:01:46 | [diff] [blame] | 65 | #endif // COMPONENTS_TEST_RUNNER_SPELL_CHECK_CLIENT_H_ |