LCOV - code coverage report
Current view: top level - accessible/generic - ApplicationAccessible.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 27 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim:expandtab:shiftwidth=2:tabstop=2:
       3             :  */
       4             : /* This Source Code Form is subject to the terms of the Mozilla Public
       5             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       6             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       7             : 
       8             : #ifndef mozilla_a11y_ApplicationAccessible_h__
       9             : #define mozilla_a11y_ApplicationAccessible_h__
      10             : 
      11             : #include "AccessibleWrap.h"
      12             : 
      13             : #include "nsIMutableArray.h"
      14             : #include "nsIXULAppInfo.h"
      15             : 
      16             : namespace mozilla {
      17             : namespace a11y {
      18             : 
      19             : /**
      20             :  * ApplicationAccessible is for the whole application of Mozilla.
      21             :  * Only one instance of ApplicationAccessible exists for one Mozilla instance.
      22             :  * And this one should be created when Mozilla Startup (if accessibility
      23             :  * feature has been enabled) and destroyed when Mozilla Shutdown.
      24             :  *
      25             :  * All the accessibility objects for toplevel windows are direct children of
      26             :  * the ApplicationAccessible instance.
      27             :  */
      28             : 
      29             : class ApplicationAccessible : public AccessibleWrap
      30             : {
      31             : public:
      32             : 
      33             :   ApplicationAccessible();
      34             : 
      35             :   NS_DECL_ISUPPORTS_INHERITED
      36             : 
      37             :   // Accessible
      38             :   virtual void Shutdown() override;
      39             :   virtual nsIntRect Bounds() const override;
      40             :   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
      41             :   virtual GroupPos GroupPosition() override;
      42             :   virtual ENameValueFlag Name(nsString& aName) override;
      43             :   virtual void ApplyARIAState(uint64_t* aState) const override;
      44             :   virtual void Description(nsString& aDescription) override;
      45             :   virtual void Value(nsString& aValue) override;
      46             :   virtual mozilla::a11y::role NativeRole() override;
      47             :   virtual uint64_t State() override;
      48             :   virtual uint64_t NativeState() override;
      49             :   virtual Relation RelationByType(RelationType aType) override;
      50             : 
      51             :   virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
      52             :                                    EWhichChildAtPoint aWhichChild) override;
      53             :   virtual Accessible* FocusedChild() override;
      54             : 
      55             :   // ActionAccessible
      56             :   virtual KeyBinding AccessKey() const override;
      57             : 
      58             :   // ApplicationAccessible
      59             :   void Init();
      60             : 
      61           0 :   void AppName(nsAString& aName) const
      62             :   {
      63           0 :     MOZ_ASSERT(mAppInfo, "no application info");
      64             : 
      65           0 :     if (mAppInfo) {
      66           0 :       nsAutoCString cname;
      67           0 :       mAppInfo->GetName(cname);
      68           0 :       AppendUTF8toUTF16(cname, aName);
      69             :     }
      70           0 :   }
      71             : 
      72           0 :   void AppVersion(nsAString& aVersion) const
      73             :   {
      74           0 :     MOZ_ASSERT(mAppInfo, "no application info");
      75             : 
      76           0 :     if (mAppInfo) {
      77           0 :       nsAutoCString cversion;
      78           0 :       mAppInfo->GetVersion(cversion);
      79           0 :       AppendUTF8toUTF16(cversion, aVersion);
      80             :     }
      81           0 :   }
      82             : 
      83           0 :   void PlatformName(nsAString& aName) const
      84             :   {
      85           0 :     aName.AssignLiteral("Gecko");
      86           0 :   }
      87             : 
      88           0 :   void PlatformVersion(nsAString& aVersion) const
      89             :   {
      90           0 :     MOZ_ASSERT(mAppInfo, "no application info");
      91             : 
      92           0 :     if (mAppInfo) {
      93           0 :       nsAutoCString cversion;
      94           0 :       mAppInfo->GetPlatformVersion(cversion);
      95           0 :       AppendUTF8toUTF16(cversion, aVersion);
      96             :     }
      97           0 :   }
      98             : 
      99             : protected:
     100           0 :   virtual ~ApplicationAccessible() {}
     101             : 
     102             :   // Accessible
     103             :   virtual Accessible* GetSiblingAtOffset(int32_t aOffset,
     104             :                                          nsresult *aError = nullptr) const override;
     105             : 
     106             : private:
     107             :   nsCOMPtr<nsIXULAppInfo> mAppInfo;
     108             : };
     109             : 
     110             : inline ApplicationAccessible*
     111           0 : Accessible::AsApplication()
     112             : {
     113           0 :   return IsApplication() ? static_cast<ApplicationAccessible*>(this) : nullptr;
     114             : }
     115             : 
     116             : } // namespace a11y
     117             : } // namespace mozilla
     118             : 
     119             : #endif
     120             : 

Generated by: LCOV version 1.13