OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include "web/TextCheckerClientImpl.h" | 5 #include "web/TextCheckerClientImpl.h" |
6 #include "public/web/WebTextCheckClient.h" | 6 #include "public/web/WebTextCheckClient.h" |
7 #include "public/web/WebTextCheckingResult.h" | 7 #include "public/web/WebTextCheckingResult.h" |
8 #include "web/WebLocalFrameImpl.h" | 8 #include "web/WebLocalFrameImpl.h" |
9 #include "web/WebTextCheckingCompletionImpl.h" | 9 #include "web/WebTextCheckingCompletionImpl.h" |
10 #include "web/WebViewImpl.h" | 10 #include "web/WebViewImpl.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 TextCheckerClientImpl::TextCheckerClientImpl(WebLocalFrameImpl* webLocalFrame) | 14 TextCheckerClientImpl::TextCheckerClientImpl(WebLocalFrameImpl* webLocalFrame) |
15 : m_webLocalFrame(webLocalFrame) {} | 15 : m_webLocalFrame(webLocalFrame) {} |
16 | 16 |
17 DEFINE_TRACE(TextCheckerClientImpl) { | 17 DEFINE_TRACE(TextCheckerClientImpl) { |
18 visitor->trace(m_webLocalFrame); | 18 visitor->trace(m_webLocalFrame); |
19 } | 19 } |
20 | 20 |
21 WebTextCheckClient* TextCheckerClientImpl::webTextCheckClient() const { | 21 WebTextCheckClient* TextCheckerClientImpl::webTextCheckClient() const { |
22 // TODO(xiaochengh): Move WebTextCheckClient to WebLocalFrame. | 22 return m_webLocalFrame->textCheckClient(); |
23 return m_webLocalFrame->viewImpl()->textCheckClient(); | |
24 } | 23 } |
25 | 24 |
26 void TextCheckerClientImpl::checkSpellingOfString(const String& text, | 25 void TextCheckerClientImpl::checkSpellingOfString(const String& text, |
27 int* misspellingLocation, | 26 int* misspellingLocation, |
28 int* misspellingLength) { | 27 int* misspellingLength) { |
29 // SpellCheckWord will write (0, 0) into the output vars, which is what our | 28 // SpellCheckWord will write (0, 0) into the output vars, which is what our |
30 // caller expects if the word is spelled correctly. | 29 // caller expects if the word is spelled correctly. |
31 int spellLocation = -1; | 30 int spellLocation = -1; |
32 int spellLength = 0; | 31 int spellLength = 0; |
33 | 32 |
(...skipping 23 matching lines...) Expand all Loading... |
57 text, new WebTextCheckingCompletionImpl(request)); | 56 text, new WebTextCheckingCompletionImpl(request)); |
58 } | 57 } |
59 | 58 |
60 void TextCheckerClientImpl::cancelAllPendingRequests() { | 59 void TextCheckerClientImpl::cancelAllPendingRequests() { |
61 if (!webTextCheckClient()) | 60 if (!webTextCheckClient()) |
62 return; | 61 return; |
63 webTextCheckClient()->cancelAllPendingRequests(); | 62 webTextCheckClient()->cancelAllPendingRequests(); |
64 } | 63 } |
65 | 64 |
66 } // namespace blink | 65 } // namespace blink |
OLD | NEW |