| OLD | NEW |
| 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 #include "config.h" | 5 #include "config.h" |
| 6 #include "modules/presentation/PresentationAvailability.h" | 6 #include "modules/presentation/PresentationAvailability.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/events/Event.h" | 10 #include "core/events/Event.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 Document* document = toDocument(executionContext); | 24 Document* document = toDocument(executionContext); |
| 25 if (!document->frame()) | 25 if (!document->frame()) |
| 26 return nullptr; | 26 return nullptr; |
| 27 PresentationController* controller = PresentationController::from(*document-
>frame()); | 27 PresentationController* controller = PresentationController::from(*document-
>frame()); |
| 28 return controller ? controller->client() : nullptr; | 28 return controller ? controller->client() : nullptr; |
| 29 } | 29 } |
| 30 | 30 |
| 31 } // anonymous namespace | 31 } // anonymous namespace |
| 32 | 32 |
| 33 // static | 33 // static |
| 34 PresentationAvailability* PresentationAvailability::take(ScriptPromiseResolver*
resolver, PassOwnPtr<bool> value) | 34 PresentationAvailability* PresentationAvailability::take(ScriptPromiseResolver*
resolver, bool value) |
| 35 { | 35 { |
| 36 PresentationAvailability* presentationAvailability = new PresentationAvailab
ility(resolver->executionContext(), *value); | 36 PresentationAvailability* presentationAvailability = new PresentationAvailab
ility(resolver->executionContext(), value); |
| 37 presentationAvailability->suspendIfNeeded(); | 37 presentationAvailability->suspendIfNeeded(); |
| 38 presentationAvailability->updateListening(); | 38 presentationAvailability->updateListening(); |
| 39 return presentationAvailability; | 39 return presentationAvailability; |
| 40 } | 40 } |
| 41 | 41 |
| 42 PresentationAvailability::PresentationAvailability(ExecutionContext* executionCo
ntext, bool value) | 42 PresentationAvailability::PresentationAvailability(ExecutionContext* executionCo
ntext, bool value) |
| 43 : ActiveDOMObject(executionContext) | 43 : ActiveDOMObject(executionContext) |
| 44 , DocumentVisibilityObserver(*toDocument(executionContext)) | 44 , DocumentVisibilityObserver(*toDocument(executionContext)) |
| 45 , m_value(value) | 45 , m_value(value) |
| 46 , m_state(State::Active) | 46 , m_state(State::Active) |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 121 } |
| 122 | 122 |
| 123 DEFINE_TRACE(PresentationAvailability) | 123 DEFINE_TRACE(PresentationAvailability) |
| 124 { | 124 { |
| 125 RefCountedGarbageCollectedEventTargetWithInlineData<PresentationAvailability
>::trace(visitor); | 125 RefCountedGarbageCollectedEventTargetWithInlineData<PresentationAvailability
>::trace(visitor); |
| 126 DocumentVisibilityObserver::trace(visitor); | 126 DocumentVisibilityObserver::trace(visitor); |
| 127 ActiveDOMObject::trace(visitor); | 127 ActiveDOMObject::trace(visitor); |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace | 130 } // namespace |
| OLD | NEW |