1 // Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4 //
5 // ---------------------------------------------------------------------------
6 //
7 // This file was generated by the CEF translator tool. If making changes by
8 // hand only do so within the body of existing method and function
9 // implementations. See the translator.README.txt file in the tools directory
10 // for more information.
11 //
12 // $hash=55a817af6b8dc3408785410b47e5d01313ebc9dd$
13 //
14
15 #include "libcef_dll/cpptoc/media_router_cpptoc.h"
16 #include "libcef_dll/cpptoc/media_sink_cpptoc.h"
17 #include "libcef_dll/cpptoc/media_source_cpptoc.h"
18 #include "libcef_dll/cpptoc/registration_cpptoc.h"
19 #include "libcef_dll/ctocpp/completion_callback_ctocpp.h"
20 #include "libcef_dll/ctocpp/media_observer_ctocpp.h"
21 #include "libcef_dll/ctocpp/media_route_create_callback_ctocpp.h"
22 #include "libcef_dll/shutdown_checker.h"
23
24 // GLOBAL FUNCTIONS - Body may be edited by hand.
25
cef_media_router_get_global(cef_completion_callback_t * callback)26 CEF_EXPORT cef_media_router_t* cef_media_router_get_global(
27 cef_completion_callback_t* callback) {
28 shutdown_checker::AssertNotShutdown();
29
30 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31
32 // Unverified params: callback
33
34 // Execute
35 CefRefPtr<CefMediaRouter> _retval = CefMediaRouter::GetGlobalMediaRouter(
36 CefCompletionCallbackCToCpp::Wrap(callback));
37
38 // Return type: refptr_same
39 return CefMediaRouterCppToC::Wrap(_retval);
40 }
41
42 namespace {
43
44 // MEMBER FUNCTIONS - Body may be edited by hand.
45
46 struct _cef_registration_t* CEF_CALLBACK
media_router_add_observer(struct _cef_media_router_t * self,struct _cef_media_observer_t * observer)47 media_router_add_observer(struct _cef_media_router_t* self,
48 struct _cef_media_observer_t* observer) {
49 shutdown_checker::AssertNotShutdown();
50
51 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
52
53 DCHECK(self);
54 if (!self)
55 return NULL;
56 // Verify param: observer; type: refptr_diff
57 DCHECK(observer);
58 if (!observer)
59 return NULL;
60
61 // Execute
62 CefRefPtr<CefRegistration> _retval =
63 CefMediaRouterCppToC::Get(self)->AddObserver(
64 CefMediaObserverCToCpp::Wrap(observer));
65
66 // Return type: refptr_same
67 return CefRegistrationCppToC::Wrap(_retval);
68 }
69
70 struct _cef_media_source_t* CEF_CALLBACK
media_router_get_source(struct _cef_media_router_t * self,const cef_string_t * urn)71 media_router_get_source(struct _cef_media_router_t* self,
72 const cef_string_t* urn) {
73 shutdown_checker::AssertNotShutdown();
74
75 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
76
77 DCHECK(self);
78 if (!self)
79 return NULL;
80 // Verify param: urn; type: string_byref_const
81 DCHECK(urn);
82 if (!urn)
83 return NULL;
84
85 // Execute
86 CefRefPtr<CefMediaSource> _retval =
87 CefMediaRouterCppToC::Get(self)->GetSource(CefString(urn));
88
89 // Return type: refptr_same
90 return CefMediaSourceCppToC::Wrap(_retval);
91 }
92
93 void CEF_CALLBACK
media_router_notify_current_sinks(struct _cef_media_router_t * self)94 media_router_notify_current_sinks(struct _cef_media_router_t* self) {
95 shutdown_checker::AssertNotShutdown();
96
97 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
98
99 DCHECK(self);
100 if (!self)
101 return;
102
103 // Execute
104 CefMediaRouterCppToC::Get(self)->NotifyCurrentSinks();
105 }
106
107 void CEF_CALLBACK
media_router_create_route(struct _cef_media_router_t * self,struct _cef_media_source_t * source,struct _cef_media_sink_t * sink,struct _cef_media_route_create_callback_t * callback)108 media_router_create_route(struct _cef_media_router_t* self,
109 struct _cef_media_source_t* source,
110 struct _cef_media_sink_t* sink,
111 struct _cef_media_route_create_callback_t* callback) {
112 shutdown_checker::AssertNotShutdown();
113
114 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
115
116 DCHECK(self);
117 if (!self)
118 return;
119 // Verify param: source; type: refptr_same
120 DCHECK(source);
121 if (!source)
122 return;
123 // Verify param: sink; type: refptr_same
124 DCHECK(sink);
125 if (!sink)
126 return;
127 // Verify param: callback; type: refptr_diff
128 DCHECK(callback);
129 if (!callback)
130 return;
131
132 // Execute
133 CefMediaRouterCppToC::Get(self)->CreateRoute(
134 CefMediaSourceCppToC::Unwrap(source), CefMediaSinkCppToC::Unwrap(sink),
135 CefMediaRouteCreateCallbackCToCpp::Wrap(callback));
136 }
137
138 void CEF_CALLBACK
media_router_notify_current_routes(struct _cef_media_router_t * self)139 media_router_notify_current_routes(struct _cef_media_router_t* self) {
140 shutdown_checker::AssertNotShutdown();
141
142 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
143
144 DCHECK(self);
145 if (!self)
146 return;
147
148 // Execute
149 CefMediaRouterCppToC::Get(self)->NotifyCurrentRoutes();
150 }
151
152 } // namespace
153
154 // CONSTRUCTOR - Do not edit by hand.
155
CefMediaRouterCppToC()156 CefMediaRouterCppToC::CefMediaRouterCppToC() {
157 GetStruct()->add_observer = media_router_add_observer;
158 GetStruct()->get_source = media_router_get_source;
159 GetStruct()->notify_current_sinks = media_router_notify_current_sinks;
160 GetStruct()->create_route = media_router_create_route;
161 GetStruct()->notify_current_routes = media_router_notify_current_routes;
162 }
163
164 // DESTRUCTOR - Do not edit by hand.
165
~CefMediaRouterCppToC()166 CefMediaRouterCppToC::~CefMediaRouterCppToC() {
167 shutdown_checker::AssertNotShutdown();
168 }
169
170 template <>
171 CefRefPtr<CefMediaRouter>
172 CefCppToCRefCounted<CefMediaRouterCppToC, CefMediaRouter, cef_media_router_t>::
UnwrapDerived(CefWrapperType type,cef_media_router_t * s)173 UnwrapDerived(CefWrapperType type, cef_media_router_t* s) {
174 NOTREACHED() << "Unexpected class type: " << type;
175 return nullptr;
176 }
177
178 template <>
179 CefWrapperType CefCppToCRefCounted<CefMediaRouterCppToC,
180 CefMediaRouter,
181 cef_media_router_t>::kWrapperType =
182 WT_MEDIA_ROUTER;
183