Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: third_party/WebKit/Source/core/frame/PlatformEventController.h

Issue 2645823002: Change PlatformEventController to take LocalFrame rather than Page. (Closed)
Patch Set: Change PlatformEventController to take LocalFrame rather than Page. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 PlatformEventController_h 5 #ifndef PlatformEventController_h
6 #define PlatformEventController_h 6 #define PlatformEventController_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/page/PageVisibilityObserver.h" 9 #include "core/page/PageVisibilityObserver.h"
10 #include "platform/Timer.h" 10 #include "platform/Timer.h"
11 #include "platform/heap/Handle.h" 11 #include "platform/heap/Handle.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 // Base controller class for registering controllers with a dispatcher. 15 // Base controller class for registering controllers with a dispatcher.
16 // It watches page visibility and calls stopUpdating when page is not visible. 16 // It watches page visibility and calls stopUpdating when page is not visible.
17 // It provides a didUpdateData() callback method which is called when new data 17 // It provides a didUpdateData() callback method which is called when new data
18 // it available. 18 // it available.
19 class CORE_EXPORT PlatformEventController : public PageVisibilityObserver { 19 class CORE_EXPORT PlatformEventController : public PageVisibilityObserver {
20 public: 20 public:
21 void startUpdating(); 21 void startUpdating();
22 void stopUpdating(); 22 void stopUpdating();
23 23
24 // This is called when new data becomes available. 24 // This is called when new data becomes available.
25 virtual void didUpdateData() = 0; 25 virtual void didUpdateData() = 0;
26 26
27 protected: 27 protected:
28 explicit PlatformEventController(Page*); 28 explicit PlatformEventController(LocalFrame*);
29 virtual ~PlatformEventController(); 29 virtual ~PlatformEventController();
30 30
31 virtual void registerWithDispatcher() = 0; 31 virtual void registerWithDispatcher() = 0;
32 virtual void unregisterWithDispatcher() = 0; 32 virtual void unregisterWithDispatcher() = 0;
33 33
34 // When true initiates a one-shot didUpdateData() when startUpdating() is 34 // When true initiates a one-shot didUpdateData() when startUpdating() is
35 // called. 35 // called.
36 virtual bool hasLastData() = 0; 36 virtual bool hasLastData() = 0;
37 37
38 bool m_hasEventListener; 38 bool m_hasEventListener;
39 39
40 private: 40 private:
41 // Inherited from PageVisibilityObserver. 41 // Inherited from PageVisibilityObserver.
42 void pageVisibilityChanged() override; 42 void pageVisibilityChanged() override;
43 43
44 void oneShotCallback(TimerBase*); 44 void oneShotCallback(TimerBase*);
45 45
46 bool m_isActive; 46 bool m_isActive;
47 Timer<PlatformEventController> m_timer; 47 Timer<PlatformEventController> m_timer;
48 }; 48 };
49 49
50 } // namespace blink 50 } // namespace blink
51 51
52 #endif // PlatformEventController_h 52 #endif // PlatformEventController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698