Chromium Code Reviews| 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" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 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 void SetEnabled(bool enabled); | |
| 33 | 34 |
| 34 // blink::WebSpellCheckClient implementation. | 35 // blink::WebSpellCheckClient implementation. |
| 35 void spellCheck( | 36 void spellCheck( |
| 36 const blink::WebString& text, | 37 const blink::WebString& text, |
| 37 int& offset, | 38 int& offset, |
| 38 int& length, | 39 int& length, |
| 39 blink::WebVector<blink::WebString>* optional_suggestions) override; | 40 blink::WebVector<blink::WebString>* optional_suggestions) override; |
| 40 void requestCheckingOfText( | 41 void requestCheckingOfText( |
| 41 const blink::WebString& text, | 42 const blink::WebString& text, |
| 42 const blink::WebVector<uint32_t>& markers, | 43 const blink::WebVector<uint32_t>& markers, |
| 43 const blink::WebVector<unsigned>& marker_offsets, | 44 const blink::WebVector<unsigned>& marker_offsets, |
| 44 blink::WebTextCheckingCompletion* completion) override; | 45 blink::WebTextCheckingCompletion* completion) override; |
| 45 void cancelAllPendingRequests() override; | 46 void cancelAllPendingRequests() override; |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 void FinishLastTextCheck(); | 49 void FinishLastTextCheck(); |
| 49 | 50 |
| 51 // Do not perform any checking when |enabled_ == false|. | |
| 52 // Tests related to spell checking should enable it manually. | |
| 53 bool enabled_; | |
|
yosin_UTC9
2016/08/24 08:00:38
s/enabled_;/enabled_ = false;/
Xiaocheng
2016/08/24 08:28:23
Done.
| |
| 54 | |
| 50 // The mock spellchecker used in spellCheck(). | 55 // The mock spellchecker used in spellCheck(). |
| 51 MockSpellCheck spell_check_; | 56 MockSpellCheck spell_check_; |
| 52 | 57 |
| 53 blink::WebString last_requested_text_check_string_; | 58 blink::WebString last_requested_text_check_string_; |
| 54 blink::WebTextCheckingCompletion* last_requested_text_checking_completion_; | 59 blink::WebTextCheckingCompletion* last_requested_text_checking_completion_; |
| 55 | 60 |
| 56 TestRunner* test_runner_; | 61 TestRunner* test_runner_; |
| 57 WebTestDelegate* delegate_; | 62 WebTestDelegate* delegate_; |
| 58 | 63 |
| 59 base::WeakPtrFactory<SpellCheckClient> weak_factory_; | 64 base::WeakPtrFactory<SpellCheckClient> weak_factory_; |
| 60 | 65 |
| 61 DISALLOW_COPY_AND_ASSIGN(SpellCheckClient); | 66 DISALLOW_COPY_AND_ASSIGN(SpellCheckClient); |
| 62 }; | 67 }; |
| 63 | 68 |
| 64 } // namespace test_runner | 69 } // namespace test_runner |
| 65 | 70 |
| 66 #endif // COMPONENTS_TEST_RUNNER_SPELL_CHECK_CLIENT_H_ | 71 #endif // COMPONENTS_TEST_RUNNER_SPELL_CHECK_CLIENT_H_ |
| OLD | NEW |