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.
6 #include "core/dom/DocumentVisibilityObserver.h"
8 #include "core/dom/Document.h"
12 DocumentVisibilityObserver::DocumentVisibilityObserver(Document
& document
)
15 registerObserver(document
);
18 DocumentVisibilityObserver::~DocumentVisibilityObserver()
25 DEFINE_TRACE(DocumentVisibilityObserver
)
27 visitor
->trace(m_document
);
30 void DocumentVisibilityObserver::unregisterObserver()
33 m_document
->unregisterVisibilityObserver(this);
38 void DocumentVisibilityObserver::registerObserver(Document
& document
)
41 m_document
= &document
;
43 m_document
->registerVisibilityObserver(this);
46 void DocumentVisibilityObserver::setObservedDocument(Document
& document
)
49 registerObserver(document
);