1 : //
2 : // Automatically generated by ipdlc.
3 : // Edit at your own risk
4 : //
5 :
6 : #ifndef PPluginModuleChild_h
7 : #define PPluginModuleChild_h
8 :
9 : #include "mozilla/plugins/PPluginModule.h"
10 : namespace mozilla {
11 : namespace plugins {
12 : class PPluginIdentifierChild;
13 : } // namespace plugins
14 : } // namespace mozilla
15 :
16 : namespace mozilla {
17 : namespace plugins {
18 : class PPluginInstanceChild;
19 : } // namespace plugins
20 : } // namespace mozilla
21 :
22 : namespace mozilla {
23 : namespace plugins {
24 : class PPluginScriptableObjectChild;
25 : } // namespace plugins
26 : } // namespace mozilla
27 :
28 : namespace mozilla {
29 : namespace dom {
30 : class PCrashReporterChild;
31 : } // namespace dom
32 : } // namespace mozilla
33 :
34 : #ifdef DEBUG
35 : #include "prenv.h"
36 : #endif // DEBUG
37 : #include "base/id_map.h"
38 : #include "mozilla/ipc/RPCChannel.h"
39 :
40 :
41 : namespace mozilla {
42 : namespace plugins {
43 : class PPluginInstanceChild;
44 : } // namespace plugins
45 : } // namespace mozilla
46 :
47 :
48 : namespace mozilla {
49 : namespace dom {
50 : class PCrashReporterChild;
51 : } // namespace dom
52 : } // namespace mozilla
53 :
54 :
55 : namespace mozilla {
56 : namespace plugins {
57 : class PPluginIdentifierChild;
58 : } // namespace plugins
59 : } // namespace mozilla
60 :
61 : namespace mozilla {
62 : namespace plugins {
63 :
64 :
65 : class /*NS_ABSTRACT_CLASS*/ PPluginModuleChild :
66 : protected mozilla::ipc::RPCChannel::RPCListener,
67 : protected mozilla::ipc::IProtocolManager<mozilla::ipc::RPCChannel::RPCListener>
68 : {
69 : friend class mozilla::plugins::PPluginInstanceChild;
70 :
71 : friend class mozilla::dom::PCrashReporterChild;
72 :
73 : friend class mozilla::plugins::PPluginIdentifierChild;
74 :
75 : protected:
76 : typedef mozilla::ipc::ActorHandle ActorHandle;
77 : typedef mozilla::ipc::Shmem Shmem;
78 : typedef base::FileDescriptor FileDescriptor;
79 : typedef mozilla::dom::NativeThreadId NativeThreadId;
80 : typedef mac_plugin_interposing::NSCursorInfo NSCursorInfo;
81 : typedef mozilla::plugins::PPluginIdentifierChild PPluginIdentifierChild;
82 : typedef mozilla::plugins::PPluginInstanceChild PPluginInstanceChild;
83 : typedef mozilla::plugins::PPluginScriptableObjectChild PPluginScriptableObjectChild;
84 : typedef mozilla::dom::PCrashReporterChild PCrashReporterChild;
85 : typedef base::ProcessId ProcessId;
86 : typedef mozilla::ipc::ProtocolId ProtocolId;
87 : typedef mozilla::ipc::Transport Transport;
88 : typedef mozilla::ipc::TransportDescriptor TransportDescriptor;
89 :
90 : typedef PPluginModule::State State;
91 :
92 : virtual bool
93 : RecvPPluginIdentifierConstructor(
94 : PPluginIdentifierChild* actor,
95 : const nsCString& aString,
96 : const int32_t& aInt,
97 : const bool& temporary);
98 : virtual bool
99 : RecvProcessNativeEventsInRPCCall() = 0;
100 : virtual bool
101 : AnswerNP_GetEntryPoints(NPError* rv) = 0;
102 : virtual bool
103 : AnswerNP_Initialize(
104 : const uint32_t& aFlags,
105 : NPError* rv) = 0;
106 : virtual bool
107 : AnswerPPluginInstanceConstructor(
108 : PPluginInstanceChild* actor,
109 : const nsCString& aMimeType,
110 : const uint16_t& aMode,
111 : const InfallibleTArray<nsCString>& aNames,
112 : const InfallibleTArray<nsCString>& aValues,
113 : NPError* rv);
114 : virtual bool
115 : AnswerNP_Shutdown(NPError* rv) = 0;
116 : virtual bool
117 : AnswerOptionalFunctionsSupported(
118 : bool* aURLRedirectNotify,
119 : bool* aClearSiteData,
120 : bool* aGetSitesWithData) = 0;
121 : virtual bool
122 : AnswerNPP_ClearSiteData(
123 : const nsCString& site,
124 : const uint64_t& flags,
125 : const uint64_t& maxAge,
126 : NPError* rv) = 0;
127 : virtual bool
128 : AnswerNPP_GetSitesWithData(InfallibleTArray<nsCString>* sites) = 0;
129 : virtual bool
130 : RecvSetAudioSessionData(
131 : const nsID& aID,
132 : const nsString& aDisplayName,
133 : const nsString& aIconPath) = 0;
134 : virtual bool
135 : RecvSetParentHangTimeout(const uint32_t& seconds) = 0;
136 : virtual bool
137 : AnswerPCrashReporterConstructor(
138 : PCrashReporterChild* actor,
139 : NativeThreadId* tid,
140 : PRUint32* processType);
141 : virtual PPluginIdentifierChild*
142 : AllocPPluginIdentifier(
143 : const nsCString& aString,
144 : const int32_t& aInt,
145 : const bool& temporary) = 0;
146 : virtual bool
147 : DeallocPPluginIdentifier(PPluginIdentifierChild* actor) = 0;
148 : virtual PPluginInstanceChild*
149 : AllocPPluginInstance(
150 : const nsCString& aMimeType,
151 : const uint16_t& aMode,
152 : const InfallibleTArray<nsCString>& aNames,
153 : const InfallibleTArray<nsCString>& aValues,
154 : NPError* rv) = 0;
155 : virtual bool
156 : DeallocPPluginInstance(PPluginInstanceChild* actor) = 0;
157 : virtual PCrashReporterChild*
158 : AllocPCrashReporter(
159 : NativeThreadId* tid,
160 : PRUint32* processType) = 0;
161 : virtual bool
162 : DeallocPCrashReporter(PCrashReporterChild* actor) = 0;
163 :
164 : virtual void
165 : ActorDestroy(ActorDestroyReason why);
166 :
167 : virtual void
168 : ProcessingError(Result code);
169 : virtual bool
170 : ShouldContinueFromReplyTimeout();
171 : virtual void
172 : EnteredCxxStack();
173 : virtual void
174 : ExitedCxxStack();
175 : virtual void
176 : EnteredCall();
177 : virtual void
178 : ExitedCall();
179 :
180 : public:
181 : typedef IPC::Message Message;
182 : typedef mozilla::ipc::RPCChannel Channel;
183 : typedef mozilla::ipc::RPCChannel::RPCListener ChannelListener;
184 : typedef base::ProcessHandle ProcessHandle;
185 : typedef mozilla::ipc::AsyncChannel AsyncChannel;
186 : typedef mozilla::ipc::SharedMemory SharedMemory;
187 : typedef mozilla::ipc::Trigger Trigger;
188 :
189 : public:
190 : PPluginModuleChild();
191 :
192 : virtual ~PPluginModuleChild();
193 :
194 : bool
195 : Open(
196 : Channel::Transport* aTransport,
197 : ProcessHandle aOtherProcess,
198 : MessageLoop* aThread = 0,
199 : AsyncChannel::Side aSide = Channel::Unknown);
200 :
201 : bool
202 : Open(
203 : AsyncChannel* aChannel,
204 : MessageLoop* aMessageLoop,
205 : AsyncChannel::Side aSide = Channel::Unknown);
206 :
207 : void
208 : Close();
209 :
210 : void
211 : SetReplyTimeoutMs(int32 aTimeoutMs);
212 :
213 : void
214 : ManagedPPluginInstanceChild(InfallibleTArray<PPluginInstanceChild*>& aArr) const;
215 : const InfallibleTArray<PPluginInstanceChild*>&
216 : ManagedPPluginInstanceChild() const;
217 :
218 : void
219 : ManagedPPluginIdentifierChild(InfallibleTArray<PPluginIdentifierChild*>& aArr) const;
220 : const InfallibleTArray<PPluginIdentifierChild*>&
221 : ManagedPPluginIdentifierChild() const;
222 :
223 : void
224 : ManagedPCrashReporterChild(InfallibleTArray<PCrashReporterChild*>& aArr) const;
225 : const InfallibleTArray<PCrashReporterChild*>&
226 : ManagedPCrashReporterChild() const;
227 :
228 : PPluginModule::State
229 : state();
230 :
231 : PPluginIdentifierChild*
232 : SendPPluginIdentifierConstructor(
233 : const nsCString& aString,
234 : const int32_t& aInt,
235 : const bool& temporary);
236 :
237 : PPluginIdentifierChild*
238 : SendPPluginIdentifierConstructor(
239 : PPluginIdentifierChild* actor,
240 : const nsCString& aString,
241 : const int32_t& aInt,
242 : const bool& temporary);
243 :
244 : bool
245 : SendProcessNativeEventsInRPCCall();
246 :
247 : bool
248 : SendBackUpXResources(const FileDescriptor& aXSocketFd);
249 :
250 : bool
251 : CallNPN_UserAgent(nsCString* userAgent);
252 :
253 : bool
254 : CallNPN_GetValue_WithBoolReturn(
255 : const NPNVariable& aVariable,
256 : NPError* aError,
257 : bool* aBoolVal);
258 :
259 : bool
260 : CallProcessSomeEvents();
261 :
262 : bool
263 : SendPluginShowWindow(
264 : const uint32_t& aWindowId,
265 : const bool& aModal,
266 : const int32_t& aX,
267 : const int32_t& aY,
268 : const size_t& aWidth,
269 : const size_t& aHeight);
270 :
271 : bool
272 : SendPluginHideWindow(const uint32_t& aWindowId);
273 :
274 : bool
275 : SendSetCursor(const NSCursorInfo& cursorInfo);
276 :
277 : bool
278 : SendShowCursor(const bool& show);
279 :
280 : bool
281 : SendPushCursor(const NSCursorInfo& cursorInfo);
282 :
283 : bool
284 : SendPopCursor();
285 :
286 : bool
287 : SendGetNativeCursorsSupported(bool* supported);
288 :
289 : bool
290 : SendNPN_SetException(
291 : PPluginScriptableObjectChild* actor,
292 : const nsCString& message);
293 :
294 : virtual int32
295 : Register(ChannelListener* aRouted);
296 : virtual int32
297 : RegisterID(
298 : ChannelListener* aRouted,
299 : int32 aId);
300 : virtual ChannelListener*
301 : Lookup(int32 aId);
302 : virtual void
303 : Unregister(int32 aId);
304 : virtual void
305 : RemoveManagee(
306 : int32 aProtocolId,
307 : ChannelListener* aListener);
308 : virtual Shmem::SharedMemory*
309 : CreateSharedMemory(
310 : size_t aSize,
311 : Shmem::SharedMemory::SharedMemoryType type,
312 : bool unsafe,
313 : Shmem::id_t* aId);
314 : virtual bool
315 : AdoptSharedMemory(
316 : Shmem::SharedMemory* segment,
317 : Shmem::id_t* aId);
318 : virtual Shmem::SharedMemory*
319 : LookupSharedMemory(Shmem::id_t aId);
320 : virtual bool
321 : IsTrackingSharedMemory(Shmem::SharedMemory* segment);
322 : virtual bool
323 : DestroySharedMemory(Shmem& aShmem);
324 : virtual ProcessHandle
325 : OtherProcess() const;
326 : virtual AsyncChannel*
327 : GetIPCChannel();
328 :
329 : virtual Result
330 : OnMessageReceived(const Message& __msg);
331 :
332 : virtual Result
333 : OnMessageReceived(
334 : const Message& __msg,
335 : Message*& __reply);
336 :
337 : virtual Result
338 : OnCallReceived(
339 : const Message& __msg,
340 : Message*& __reply);
341 :
342 : void
343 : OnProcessingError(Result code);
344 :
345 : bool
346 : OnReplyTimeout();
347 :
348 : void
349 : OnEnteredCxxStack();
350 : void
351 : OnExitedCxxStack();
352 : void
353 : OnEnteredCall();
354 : void
355 : OnExitedCall();
356 : bool
357 : IsOnCxxStack() const;
358 : void
359 : FlushPendingRPCQueue();
360 :
361 : void
362 : OnChannelClose();
363 :
364 : void
365 : OnChannelError();
366 :
367 : void
368 : OnChannelConnected(int32 pid);
369 :
370 : // Methods for managing shmem
371 : bool
372 : AllocShmem(
373 : size_t aSize,
374 : Shmem::SharedMemory::SharedMemoryType aType,
375 : Shmem* aMem);
376 :
377 : bool
378 : AllocUnsafeShmem(
379 : size_t aSize,
380 : Shmem::SharedMemory::SharedMemoryType aType,
381 : Shmem* aMem);
382 :
383 : bool
384 : AdoptShmem(
385 : Shmem& aMem,
386 : Shmem* aOutMem);
387 :
388 : bool
389 : DeallocShmem(Shmem& aMem);
390 :
391 : void
392 : ProcessNativeEventsInRPCCall();
393 :
394 : private:
395 : virtual void
396 : FatalError(const char* const msg) const;
397 :
398 : void
399 : DestroySubtree(ActorDestroyReason why);
400 :
401 : void
402 : DeallocSubtree();
403 :
404 : void
405 : DeallocShmems();
406 :
407 : template<typename T>
408 : void
409 0 : Write(
410 : const T& __v,
411 : Message* __msg)
412 : {
413 0 : IPC::WriteParam(__msg, __v);
414 0 : }
415 :
416 : template<typename T>
417 : bool
418 0 : Read(
419 : T* __v,
420 : const Message* __msg,
421 : void** __iter)
422 : {
423 0 : return IPC::ReadParam(__msg, __iter, __v);
424 : }
425 :
426 : void
427 : Write(
428 : PPluginScriptableObjectChild* __v,
429 : Message* __msg,
430 : bool __nullable);
431 :
432 : bool
433 : Read(
434 : PPluginScriptableObjectChild** __v,
435 : const Message* __msg,
436 : void** __iter,
437 : bool __nullable) NS_WARN_UNUSED_RESULT;
438 :
439 : void
440 : Write(
441 : PPluginInstanceChild* __v,
442 : Message* __msg,
443 : bool __nullable);
444 :
445 : bool
446 : Read(
447 : PPluginInstanceChild** __v,
448 : const Message* __msg,
449 : void** __iter,
450 : bool __nullable) NS_WARN_UNUSED_RESULT;
451 :
452 : void
453 : Write(
454 : PCrashReporterChild* __v,
455 : Message* __msg,
456 : bool __nullable);
457 :
458 : bool
459 : Read(
460 : PCrashReporterChild** __v,
461 : const Message* __msg,
462 : void** __iter,
463 : bool __nullable) NS_WARN_UNUSED_RESULT;
464 :
465 : void
466 : Write(
467 : PPluginIdentifierChild* __v,
468 : Message* __msg,
469 : bool __nullable);
470 :
471 : bool
472 : Read(
473 : PPluginIdentifierChild** __v,
474 : const Message* __msg,
475 : void** __iter,
476 : bool __nullable) NS_WARN_UNUSED_RESULT;
477 :
478 : Channel mChannel;
479 : IDMap<ChannelListener> mActorMap;
480 : int32 mLastRouteId;
481 : ProcessHandle mOtherProcess;
482 : IDMap<Shmem::SharedMemory> mShmemMap;
483 : Shmem::id_t mLastShmemId;
484 : State mState;
485 : // Sorted by pointer value
486 : InfallibleTArray<PPluginInstanceChild*> mManagedPPluginInstanceChild;
487 : // Sorted by pointer value
488 : InfallibleTArray<PPluginIdentifierChild*> mManagedPPluginIdentifierChild;
489 : // Sorted by pointer value
490 : InfallibleTArray<PCrashReporterChild*> mManagedPCrashReporterChild;
491 : };
492 :
493 :
494 : } // namespace plugins
495 : } // namespace mozilla
496 :
497 : #if 0
498 :
499 : //-----------------------------------------------------------------------------
500 : // Skeleton implementation of abstract actor class
501 :
502 : // Header file contents
503 : namespace mozilla {
504 : namespace plugins {
505 : class PluginModuleChild :
506 : public PPluginModuleChild
507 : {
508 : virtual bool
509 : RecvProcessNativeEventsInRPCCall();
510 :
511 : virtual bool
512 : AnswerNP_GetEntryPoints(NPError* rv);
513 :
514 : virtual bool
515 : AnswerNP_Initialize(
516 : const uint32_t& aFlags,
517 : NPError* rv);
518 :
519 : virtual bool
520 : AnswerNP_Shutdown(NPError* rv);
521 :
522 : virtual bool
523 : AnswerOptionalFunctionsSupported(
524 : bool* aURLRedirectNotify,
525 : bool* aClearSiteData,
526 : bool* aGetSitesWithData);
527 :
528 : virtual bool
529 : AnswerNPP_ClearSiteData(
530 : const nsCString& site,
531 : const uint64_t& flags,
532 : const uint64_t& maxAge,
533 : NPError* rv);
534 :
535 : virtual bool
536 : AnswerNPP_GetSitesWithData(InfallibleTArray<nsCString>* sites);
537 :
538 : virtual bool
539 : RecvSetAudioSessionData(
540 : const nsID& aID,
541 : const nsString& aDisplayName,
542 : const nsString& aIconPath);
543 :
544 : virtual bool
545 : RecvSetParentHangTimeout(const uint32_t& seconds);
546 :
547 : virtual PPluginIdentifierChild*
548 : AllocPPluginIdentifier(
549 : const nsCString& aString,
550 : const int32_t& aInt,
551 : const bool& temporary);
552 :
553 : virtual bool
554 : DeallocPPluginIdentifier(PPluginIdentifierChild* actor);
555 :
556 : virtual PPluginInstanceChild*
557 : AllocPPluginInstance(
558 : const nsCString& aMimeType,
559 : const uint16_t& aMode,
560 : const InfallibleTArray<nsCString>& aNames,
561 : const InfallibleTArray<nsCString>& aValues,
562 : NPError* rv);
563 :
564 : virtual bool
565 : DeallocPPluginInstance(PPluginInstanceChild* actor);
566 :
567 : virtual PCrashReporterChild*
568 : AllocPCrashReporter(
569 : NativeThreadId* tid,
570 : PRUint32* processType);
571 :
572 : virtual bool
573 : DeallocPCrashReporter(PCrashReporterChild* actor);
574 :
575 : PluginModuleChild();
576 : virtual ~PluginModuleChild();
577 : };
578 : } // namespace plugins
579 : } // namespace mozilla
580 :
581 :
582 : // C++ file contents
583 : namespace mozilla {
584 : namespace plugins {
585 : bool
586 : PluginModuleChild::RecvProcessNativeEventsInRPCCall()
587 : {
588 : return false;
589 : }
590 :
591 : bool
592 : PluginModuleChild::AnswerNP_GetEntryPoints(NPError* rv)
593 : {
594 : return false;
595 : }
596 :
597 : bool
598 : PluginModuleChild::AnswerNP_Initialize(
599 : const uint32_t& aFlags,
600 : NPError* rv)
601 : {
602 : return false;
603 : }
604 :
605 : bool
606 : PluginModuleChild::AnswerNP_Shutdown(NPError* rv)
607 : {
608 : return false;
609 : }
610 :
611 : bool
612 : PluginModuleChild::AnswerOptionalFunctionsSupported(
613 : bool* aURLRedirectNotify,
614 : bool* aClearSiteData,
615 : bool* aGetSitesWithData)
616 : {
617 : return false;
618 : }
619 :
620 : bool
621 : PluginModuleChild::AnswerNPP_ClearSiteData(
622 : const nsCString& site,
623 : const uint64_t& flags,
624 : const uint64_t& maxAge,
625 : NPError* rv)
626 : {
627 : return false;
628 : }
629 :
630 : bool
631 : PluginModuleChild::AnswerNPP_GetSitesWithData(InfallibleTArray<nsCString>* sites)
632 : {
633 : return false;
634 : }
635 :
636 : bool
637 : PluginModuleChild::RecvSetAudioSessionData(
638 : const nsID& aID,
639 : const nsString& aDisplayName,
640 : const nsString& aIconPath)
641 : {
642 : return false;
643 : }
644 :
645 : bool
646 : PluginModuleChild::RecvSetParentHangTimeout(const uint32_t& seconds)
647 : {
648 : return false;
649 : }
650 :
651 : PPluginIdentifierChild*
652 : PluginModuleChild::AllocPPluginIdentifier(
653 : const nsCString& aString,
654 : const int32_t& aInt,
655 : const bool& temporary)
656 : {
657 : return 0;
658 : }
659 :
660 : bool
661 : PluginModuleChild::DeallocPPluginIdentifier(PPluginIdentifierChild* actor)
662 : {
663 : return false;
664 : }
665 :
666 : PPluginInstanceChild*
667 : PluginModuleChild::AllocPPluginInstance(
668 : const nsCString& aMimeType,
669 : const uint16_t& aMode,
670 : const InfallibleTArray<nsCString>& aNames,
671 : const InfallibleTArray<nsCString>& aValues,
672 : NPError* rv)
673 : {
674 : return 0;
675 : }
676 :
677 : bool
678 : PluginModuleChild::DeallocPPluginInstance(PPluginInstanceChild* actor)
679 : {
680 : return false;
681 : }
682 :
683 : PCrashReporterChild*
684 : PluginModuleChild::AllocPCrashReporter(
685 : NativeThreadId* tid,
686 : PRUint32* processType)
687 : {
688 : return 0;
689 : }
690 :
691 : bool
692 : PluginModuleChild::DeallocPCrashReporter(PCrashReporterChild* actor)
693 : {
694 : return false;
695 : }
696 :
697 : PluginModuleChild::PluginModuleChild()
698 : {
699 : MOZ_COUNT_CTOR(PluginModuleChild);
700 : }
701 :
702 : PluginModuleChild::~PluginModuleChild()
703 : {
704 : MOZ_COUNT_DTOR(PluginModuleChild);
705 : }
706 :
707 : } // namespace plugins
708 : } // namespace mozilla
709 : #endif // if 0
710 :
711 : #endif // ifndef PPluginModuleChild_h
|