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