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