1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef DocumentVisibilityObserver_h
6 #define DocumentVisibilityObserver_h
8 #include "core/CoreExport.h"
9 #include "core/page/PageVisibilityState.h"
10 #include "platform/heap/Handle.h"
16 class CORE_EXPORT DocumentVisibilityObserver
: public WillBeGarbageCollectedMixin
{
17 WTF_MAKE_NONCOPYABLE(DocumentVisibilityObserver
);
19 explicit DocumentVisibilityObserver(Document
&);
20 virtual ~DocumentVisibilityObserver();
22 virtual void didChangeVisibilityState(PageVisibilityState
) = 0;
24 // Classes that inherit Node and DocumentVisibilityObserver must have a
25 // virtual override of Node::didMoveToNewDocument that calls
26 // DocumentVisibilityObserver::setDocument
27 void setObservedDocument(Document
&);
30 DECLARE_VIRTUAL_TRACE();
33 void registerObserver(Document
&);
34 void unregisterObserver();
36 RawPtrWillBeMember
<Document
> m_document
;
41 #endif // DocumentVisibilityObserver_h