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 #ifndef IdleSpellCheckCallback_h | 5 #ifndef IdleSpellCheckCallback_h |
6 #define IdleSpellCheckCallback_h | 6 #define IdleSpellCheckCallback_h |
7 | 7 |
8 #include "core/dom/IdleRequestCallback.h" | 8 #include "core/dom/IdleRequestCallback.h" |
9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
10 #include "platform/Timer.h" | 10 #include "platform/Timer.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 // Main class for the implementation of idle time spell checker. | 14 // Main class for the implementation of idle time spell checker. |
15 class IdleSpellCheckCallback final : public IdleRequestCallback { | 15 class IdleSpellCheckCallback final : public IdleRequestCallback { |
16 public: | 16 public: |
17 // TODO(xiaochengh): Make each LocalFrame own an IdleSpellCheckCallback. | |
18 static IdleSpellCheckCallback* create(LocalFrame&); | 17 static IdleSpellCheckCallback* create(LocalFrame&); |
19 ~IdleSpellCheckCallback() override; | 18 ~IdleSpellCheckCallback() override; |
20 | 19 |
21 // Transit to HotModeRequested, if possible. Called by operations that need | 20 // Transit to HotModeRequested, if possible. Called by operations that need |
22 // spell checker to follow up. | 21 // spell checker to follow up. |
23 // TODO(xiaochengh): Add proper call sites. | 22 // TODO(xiaochengh): Add proper call sites. |
24 void setNeedsHotModeInvocation(); | 23 void setNeedsHotModeInvocation(); |
25 | 24 |
26 // Transit to ColdModeTimerStarted, if possible. Sets up a timer, and requests | 25 // Transit to ColdModeTimerStarted, if possible. Sets up a timer, and requests |
27 // cold mode invocation if no critical operation occurs before timer firing. | 26 // cold mode invocation if no critical operation occurs before timer firing. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 State m_state; | 66 State m_state; |
68 const Member<LocalFrame> m_frame; | 67 const Member<LocalFrame> m_frame; |
69 | 68 |
70 // TODO(xiaochengh): assign the timer to some proper task runner. | 69 // TODO(xiaochengh): assign the timer to some proper task runner. |
71 Timer<IdleSpellCheckCallback> m_coldModeTimer; | 70 Timer<IdleSpellCheckCallback> m_coldModeTimer; |
72 }; | 71 }; |
73 | 72 |
74 } // namespace blink | 73 } // namespace blink |
75 | 74 |
76 #endif // IdleSpellCheckCallback_h | 75 #endif // IdleSpellCheckCallback_h |
OLD | NEW |