ChromeMessageSender.h (1650B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_ChromeMessageSender_h 8 #define mozilla_dom_ChromeMessageSender_h 9 10 #include "mozilla/dom/MessageSender.h" 11 12 namespace mozilla::dom { 13 14 class MessageBroadcaster; 15 16 class ChromeMessageSender final : public MessageSender { 17 public: 18 explicit ChromeMessageSender(MessageBroadcaster* aParentManager) 19 : MessageSender(nullptr, aParentManager, MessageManagerFlags::MM_CHROME) { 20 // This is a bit hackish, we wait until the child process is running before 21 // attaching to the parent manager (see MessageSender::InitWithCallback). 22 } 23 24 virtual JSObject* WrapObject(JSContext* aCx, 25 JS::Handle<JSObject*> aGivenProto) override; 26 27 // FrameScriptLoader 28 void LoadFrameScript(const nsAString& aUrl, bool aAllowDelayedLoad, 29 bool aRunInGlobalScope, mozilla::ErrorResult& aError) { 30 LoadScript(aUrl, aAllowDelayedLoad, aRunInGlobalScope, aError); 31 } 32 void RemoveDelayedFrameScript(const nsAString& aURL) { 33 RemoveDelayedScript(aURL); 34 } 35 void GetDelayedFrameScripts(JSContext* aCx, 36 nsTArray<nsTArray<JS::Value>>& aScripts, 37 mozilla::ErrorResult& aError) { 38 GetDelayedScripts(aCx, aScripts, aError); 39 } 40 }; 41 42 } // namespace mozilla::dom 43 44 #endif // mozilla_dom_ChromeMessageSender_h