1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 #ifndef mozilla_a11y_HTMLWin32ObjectAccessible_h_
7 #define mozilla_a11y_HTMLWin32ObjectAccessible_h_
8 
9 #include "BaseAccessibles.h"
10 
11 #if defined(MOZ_CONTENT_SANDBOX)
12 #include "mozilla/mscom/Ptr.h"
13 #endif
14 
15 struct IAccessible;
16 
17 namespace mozilla {
18 namespace a11y {
19 
20 class HTMLWin32ObjectOwnerAccessible : public AccessibleWrap
21 {
22 public:
23   // This will own the HTMLWin32ObjectAccessible. We create this where the
24   // <object> or <embed> exists in the tree, so that get_accNextSibling() etc.
25   // will still point to Gecko accessible sibling content. This is necessary
26   // because the native plugin accessible doesn't know where it exists in the
27   // Mozilla tree, and returns null for previous and next sibling. This would
28   // have the effect of cutting off all content after the plugin.
29   HTMLWin32ObjectOwnerAccessible(nsIContent* aContent,
30                                  DocAccessible* aDoc, void* aHwnd);
~HTMLWin32ObjectOwnerAccessible()31   virtual ~HTMLWin32ObjectOwnerAccessible() {}
32 
33   // Accessible
34   virtual void Shutdown();
35   virtual mozilla::a11y::role NativeRole();
36   virtual bool NativelyUnavailable() const;
37 
38 protected:
39   void* mHwnd;
40   RefPtr<Accessible> mNativeAccessible;
41 };
42 
43 /**
44   * This class is used only internally, we never! send out an IAccessible linked
45   *   back to this object. This class is used to represent a plugin object when
46   *   referenced as a child or sibling of another Accessible node. We need only
47   *   a limited portion of the Accessible interface implemented here. The
48   *   in depth accessible information will be returned by the actual IAccessible
49   *   object returned by us in Accessible::NewAccessible() that gets the IAccessible
50   *   from the windows system from the window handle.
51   */
52 class HTMLWin32ObjectAccessible : public DummyAccessible
53 {
54 public:
55   HTMLWin32ObjectAccessible(void* aHwnd, DocAccessible* aDoc);
~HTMLWin32ObjectAccessible()56   virtual ~HTMLWin32ObjectAccessible() {}
57 
58   virtual void GetNativeInterface(void** aNativeAccessible) override;
59 
60 protected:
61   void* mHwnd;
62 #if defined(MOZ_CONTENT_SANDBOX)
63   mscom::ProxyUniquePtr<IAccessible> mCOMProxy;
64 #endif
65 };
66 
67 } // namespace a11y
68 } // namespace mozilla
69 
70 #endif
71