OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/editing/spellcheck/IdleSpellCheckCallback.h" | 5 #include "core/editing/spellcheck/IdleSpellCheckCallback.h" |
6 | 6 |
7 #include "core/dom/IdleRequestOptions.h" | 7 #include "core/dom/IdleRequestOptions.h" |
| 8 #include "core/dom/TaskRunnerHelper.h" |
8 #include "core/editing/EditingUtilities.h" | 9 #include "core/editing/EditingUtilities.h" |
9 #include "core/editing/FrameSelection.h" | 10 #include "core/editing/FrameSelection.h" |
10 #include "core/editing/VisibleSelection.h" | 11 #include "core/editing/VisibleSelection.h" |
11 #include "core/editing/VisibleUnits.h" | 12 #include "core/editing/VisibleUnits.h" |
12 #include "core/editing/commands/CompositeEditCommand.h" | 13 #include "core/editing/commands/CompositeEditCommand.h" |
13 #include "core/editing/commands/UndoStep.h" | 14 #include "core/editing/commands/UndoStep.h" |
14 #include "core/editing/iterators/BackwardsCharacterIterator.h" | 15 #include "core/editing/iterators/BackwardsCharacterIterator.h" |
15 #include "core/editing/iterators/CharacterIterator.h" | 16 #include "core/editing/iterators/CharacterIterator.h" |
16 #include "core/editing/spellcheck/SpellCheckRequester.h" | 17 #include "core/editing/spellcheck/SpellCheckRequester.h" |
17 #include "core/editing/spellcheck/SpellChecker.h" | 18 #include "core/editing/spellcheck/SpellChecker.h" |
(...skipping 22 matching lines...) Expand all Loading... |
40 IdleRequestCallback::trace(visitor); | 41 IdleRequestCallback::trace(visitor); |
41 } | 42 } |
42 | 43 |
43 IdleSpellCheckCallback* IdleSpellCheckCallback::create(LocalFrame& frame) { | 44 IdleSpellCheckCallback* IdleSpellCheckCallback::create(LocalFrame& frame) { |
44 return new IdleSpellCheckCallback(frame); | 45 return new IdleSpellCheckCallback(frame); |
45 } | 46 } |
46 | 47 |
47 IdleSpellCheckCallback::IdleSpellCheckCallback(LocalFrame& frame) | 48 IdleSpellCheckCallback::IdleSpellCheckCallback(LocalFrame& frame) |
48 : m_state(State::kInactive), | 49 : m_state(State::kInactive), |
49 m_frame(frame), | 50 m_frame(frame), |
50 m_coldModeTimer(this, &IdleSpellCheckCallback::coldModeTimerFired) {} | 51 m_coldModeTimer(TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame), |
| 52 this, |
| 53 &IdleSpellCheckCallback::coldModeTimerFired) {} |
51 | 54 |
52 SpellCheckRequester& IdleSpellCheckCallback::spellCheckRequester() const { | 55 SpellCheckRequester& IdleSpellCheckCallback::spellCheckRequester() const { |
53 // TODO(xiaochengh): decouple with SpellChecker after SpellCheckRequester is | 56 // TODO(xiaochengh): decouple with SpellChecker after SpellCheckRequester is |
54 // moved to IdleSpellCheckCallback. | 57 // moved to IdleSpellCheckCallback. |
55 return frame().spellChecker().spellCheckRequester(); | 58 return frame().spellChecker().spellCheckRequester(); |
56 } | 59 } |
57 | 60 |
58 bool IdleSpellCheckCallback::isSpellCheckingEnabled() const { | 61 bool IdleSpellCheckCallback::isSpellCheckingEnabled() const { |
59 // TODO(xiaochengh): decouple with SpellChecker. | 62 // TODO(xiaochengh): decouple with SpellChecker. |
60 return frame().spellChecker().isSpellCheckingEnabled(); | 63 return frame().spellChecker().isSpellCheckingEnabled(); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 if (coldModeFinishesFullDocument()) | 164 if (coldModeFinishesFullDocument()) |
162 m_state = State::kInactive; | 165 m_state = State::kInactive; |
163 else | 166 else |
164 setNeedsColdModeInvocation(); | 167 setNeedsColdModeInvocation(); |
165 } else { | 168 } else { |
166 NOTREACHED(); | 169 NOTREACHED(); |
167 } | 170 } |
168 } | 171 } |
169 | 172 |
170 } // namespace blink | 173 } // namespace blink |
OLD | NEW |