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