Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | include protocol PPluginInstance; |
michael@0 | 7 | include protocol PPluginIdentifier; |
michael@0 | 8 | |
michael@0 | 9 | using struct mozilla::void_t from "ipc/IPCMessageUtils.h"; |
michael@0 | 10 | using struct mozilla::null_t from "ipc/IPCMessageUtils.h"; |
michael@0 | 11 | |
michael@0 | 12 | namespace mozilla { |
michael@0 | 13 | namespace plugins { |
michael@0 | 14 | |
michael@0 | 15 | union Variant { |
michael@0 | 16 | void_t; |
michael@0 | 17 | null_t; |
michael@0 | 18 | bool; |
michael@0 | 19 | int; |
michael@0 | 20 | double; |
michael@0 | 21 | nsCString; |
michael@0 | 22 | nullable PPluginScriptableObject; |
michael@0 | 23 | }; |
michael@0 | 24 | |
michael@0 | 25 | intr protocol PPluginScriptableObject |
michael@0 | 26 | { |
michael@0 | 27 | manager PPluginInstance; |
michael@0 | 28 | |
michael@0 | 29 | both: |
michael@0 | 30 | async __delete__(); |
michael@0 | 31 | |
michael@0 | 32 | parent: |
michael@0 | 33 | intr NPN_Evaluate(nsCString aScript) |
michael@0 | 34 | returns (Variant aResult, |
michael@0 | 35 | bool aSuccess); |
michael@0 | 36 | |
michael@0 | 37 | child: |
michael@0 | 38 | intr Invalidate(); |
michael@0 | 39 | |
michael@0 | 40 | both: |
michael@0 | 41 | // NPClass methods |
michael@0 | 42 | intr HasMethod(PPluginIdentifier aId) |
michael@0 | 43 | returns (bool aHasMethod); |
michael@0 | 44 | |
michael@0 | 45 | intr Invoke(PPluginIdentifier aId, |
michael@0 | 46 | Variant[] aArgs) |
michael@0 | 47 | returns (Variant aResult, |
michael@0 | 48 | bool aSuccess); |
michael@0 | 49 | |
michael@0 | 50 | intr InvokeDefault(Variant[] aArgs) |
michael@0 | 51 | returns (Variant aResult, |
michael@0 | 52 | bool aSuccess); |
michael@0 | 53 | |
michael@0 | 54 | intr HasProperty(PPluginIdentifier aId) |
michael@0 | 55 | returns (bool aHasProperty); |
michael@0 | 56 | |
michael@0 | 57 | intr SetProperty(PPluginIdentifier aId, |
michael@0 | 58 | Variant aValue) |
michael@0 | 59 | returns (bool aSuccess); |
michael@0 | 60 | |
michael@0 | 61 | intr RemoveProperty(PPluginIdentifier aId) |
michael@0 | 62 | returns (bool aSuccess); |
michael@0 | 63 | |
michael@0 | 64 | intr Enumerate() |
michael@0 | 65 | returns (PPluginIdentifier[] aProperties, |
michael@0 | 66 | bool aSuccess); |
michael@0 | 67 | |
michael@0 | 68 | intr Construct(Variant[] aArgs) |
michael@0 | 69 | returns (Variant aResult, |
michael@0 | 70 | bool aSuccess); |
michael@0 | 71 | |
michael@0 | 72 | // Objects are initially unprotected, and the Protect and Unprotect functions |
michael@0 | 73 | // only affect protocol objects that represent NPObjects created in the same |
michael@0 | 74 | // process (rather than protocol objects that are a proxy for an NPObject |
michael@0 | 75 | // created in another process). Protocol objects representing local NPObjects |
michael@0 | 76 | // are protected after an NPObject has been associated with the protocol |
michael@0 | 77 | // object. Sending the protocol object as an argument to the other process |
michael@0 | 78 | // temporarily protects the protocol object again for the duration of the call. |
michael@0 | 79 | async Protect(); |
michael@0 | 80 | async Unprotect(); |
michael@0 | 81 | |
michael@0 | 82 | /** |
michael@0 | 83 | * GetProperty is slightly wonky due to the way we support NPObjects that have |
michael@0 | 84 | * methods and properties with the same name. When child calls parent we |
michael@0 | 85 | * simply return a property. When parent calls child, however, we need to do |
michael@0 | 86 | * several checks at once and return all the results simultaneously. |
michael@0 | 87 | */ |
michael@0 | 88 | parent: |
michael@0 | 89 | intr GetParentProperty(PPluginIdentifier aId) |
michael@0 | 90 | returns (Variant aResult, |
michael@0 | 91 | bool aSuccess); |
michael@0 | 92 | |
michael@0 | 93 | child: |
michael@0 | 94 | intr GetChildProperty(PPluginIdentifier aId) |
michael@0 | 95 | returns (bool aHasProperty, |
michael@0 | 96 | bool aHasMethod, |
michael@0 | 97 | Variant aResult, |
michael@0 | 98 | bool aSuccess); |
michael@0 | 99 | }; |
michael@0 | 100 | |
michael@0 | 101 | } // namespace plugins |
michael@0 | 102 | } // namespace mozilla |