Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / modules / presentation / Presentation.h
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
3 // found in the LICENSE file.
4
5 #ifndef Presentation_h
6 #define Presentation_h
7
8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "core/dom/ContextLifecycleObserver.h"
10 #include "core/events/EventTarget.h"
11 #include "modules/presentation/PresentationSession.h"
12
13 namespace blink {
14
15 class ScriptState;
16
17 class Presentation final
18     : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<Presentation>
19     , public EventTargetWithInlineData
20     , public ContextLifecycleObserver {
21     DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<Presentation>);
22     WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Presentation);
23     DEFINE_WRAPPERTYPEINFO();
24 public:
25     static Presentation* create(ExecutionContext*);
26     virtual ~Presentation();
27
28     // EventTarget implementation.
29     virtual const AtomicString& interfaceName() const override;
30     virtual ExecutionContext* executionContext() const override;
31
32     virtual void trace(Visitor*) override;
33
34     PresentationSession* session() const;
35
36     ScriptPromise startSession(ScriptState*, const String& senderId, const String& presentationId);
37     ScriptPromise joinSession(ScriptState*, const String& senderId, const String& presentationId);
38
39     DEFINE_ATTRIBUTE_EVENT_LISTENER(availablechange);
40
41 private:
42     explicit Presentation(ExecutionContext*);
43
44     Member<PresentationSession> m_session;
45 };
46
47 } // namespace blink
48
49 #endif // Presentation_h