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

Side by Side Diff: Source/modules/navigatorconnect/ServicePortConnectEvent.cpp

Issue 1210633002: Update navigator.services API to use the new services.onconnect event [1/3]. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@serviceport-part3
Patch Set: rebase Created 5 years, 5 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
(Empty)
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.
4
5 #include "config.h"
6 #include "modules/navigatorconnect/ServicePortConnectEvent.h"
7
8 #include "core/dom/DOMException.h"
9 #include "core/dom/ExceptionCode.h"
10 #include "modules/navigatorconnect/AcceptConnectionObserver.h"
11 #include "modules/navigatorconnect/ServicePortConnectEventInit.h"
12
13 namespace blink {
14
15 PassRefPtrWillBeRawPtr<ServicePortConnectEvent> ServicePortConnectEvent::create( )
16 {
17 return adoptRefWillBeNoop(new ServicePortConnectEvent());
18 }
19
20 PassRefPtrWillBeRawPtr<ServicePortConnectEvent> ServicePortConnectEvent::create( const AtomicString& type, const ServicePortConnectEventInit& initializer)
21 {
22 return adoptRefWillBeNoop(new ServicePortConnectEvent(type, initializer, nul lptr));
23 }
24
25 PassRefPtrWillBeRawPtr<ServicePortConnectEvent> ServicePortConnectEvent::create( const AtomicString& type, const ServicePortConnectEventInit& initializer, Accept ConnectionObserver* observer)
26 {
27 return adoptRefWillBeNoop(new ServicePortConnectEvent(type, initializer, obs erver));
28 }
29
30 ScriptPromise ServicePortConnectEvent::respondWith(ScriptState* scriptState, con st ScriptPromise& response, ExceptionState& exceptionState)
31 {
32 stopImmediatePropagation();
33 if (m_observer)
34 return m_observer->respondWith(scriptState, response, exceptionState);
35 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::crea te(NotSupportedError));
36 }
37
38 const AtomicString& ServicePortConnectEvent::interfaceName() const
39 {
40 return EventNames::ServicePortConnectEvent;
41 }
42
43 DEFINE_TRACE(ServicePortConnectEvent)
44 {
45 visitor->trace(m_observer);
46 ExtendableEvent::trace(visitor);
47 }
48
49 ServicePortConnectEvent::ServicePortConnectEvent()
50 {
51 }
52
53 ServicePortConnectEvent::ServicePortConnectEvent(const AtomicString& type, const ServicePortConnectEventInit& initializer, AcceptConnectionObserver* observer)
54 : ExtendableEvent(type, initializer)
55 , m_observer(observer)
56 , m_targetURL(initializer.targetURL())
57 , m_origin(initializer.origin())
58 {
59 }
60
61 } // namespace blink
62
OLDNEW
« no previous file with comments | « Source/modules/navigatorconnect/ServicePortConnectEvent.h ('k') | Source/modules/navigatorconnect/ServicePortConnectEvent.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698