| 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/dom/TaskRunnerHelper.h" |
| 9 #include "core/editing/EditingUtilities.h" | 9 #include "core/editing/EditingUtilities.h" |
| 10 #include "core/editing/FrameSelection.h" | 10 #include "core/editing/FrameSelection.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 if (m_needsMoreColdModeInvocationForTesting) { | 144 if (m_needsMoreColdModeInvocationForTesting) { |
| 145 m_needsMoreColdModeInvocationForTesting = false; | 145 m_needsMoreColdModeInvocationForTesting = false; |
| 146 return false; | 146 return false; |
| 147 } | 147 } |
| 148 | 148 |
| 149 // TODO(xiaochengh): Implementation. | 149 // TODO(xiaochengh): Implementation. |
| 150 return true; | 150 return true; |
| 151 } | 151 } |
| 152 | 152 |
| 153 void IdleSpellCheckCallback::handleEvent(IdleDeadline* deadline) { | 153 void IdleSpellCheckCallback::handleEvent(IdleDeadline* deadline) { |
| 154 DCHECK(RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()); |
| 154 DCHECK(frame().document()); | 155 DCHECK(frame().document()); |
| 155 DCHECK(frame().document()->isActive()); | 156 DCHECK(frame().document()->isActive()); |
| 156 DCHECK_NE(m_idleCallbackHandle, kInvalidHandle); | 157 DCHECK_NE(m_idleCallbackHandle, kInvalidHandle); |
| 157 m_idleCallbackHandle = kInvalidHandle; | 158 m_idleCallbackHandle = kInvalidHandle; |
| 158 | 159 |
| 159 if (!isSpellCheckingEnabled()) { | 160 if (!isSpellCheckingEnabled()) { |
| 160 deactivate(); | 161 deactivate(); |
| 161 return; | 162 return; |
| 162 } | 163 } |
| 163 | 164 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 } | 214 } |
| 214 } | 215 } |
| 215 | 216 |
| 216 void IdleSpellCheckCallback::skipColdModeTimerForTesting() { | 217 void IdleSpellCheckCallback::skipColdModeTimerForTesting() { |
| 217 DCHECK(m_coldModeTimer.isActive()); | 218 DCHECK(m_coldModeTimer.isActive()); |
| 218 m_coldModeTimer.stop(); | 219 m_coldModeTimer.stop(); |
| 219 coldModeTimerFired(&m_coldModeTimer); | 220 coldModeTimerFired(&m_coldModeTimer); |
| 220 } | 221 } |
| 221 | 222 |
| 222 } // namespace blink | 223 } // namespace blink |
| OLD | NEW |