LCOV - code coverage report
Current view: top level - toolkit/mozapps/extensions - AddonPathService.h (source / functions) Hit Total Coverage
Test: output.info Lines: 4 4 100.0 %
Date: 2017-07-14 16:53:18 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* -*- Mode: C++; tab-width: 8; 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 AddonPathService_h
       7             : #define AddonPathService_h
       8             : 
       9             : #include "amIAddonPathService.h"
      10             : #include "nsString.h"
      11             : #include "nsTArray.h"
      12             : 
      13             : class nsIURI;
      14             : class JSAddonId;
      15             : 
      16             : namespace mozilla {
      17             : 
      18             : JSAddonId*
      19             : MapURIToAddonID(nsIURI* aURI);
      20             : 
      21             : class AddonPathService final : public amIAddonPathService
      22             : {
      23             : public:
      24             :   AddonPathService();
      25             : 
      26             :   static AddonPathService* GetInstance();
      27             : 
      28             :   JSAddonId* Find(const nsAString& path);
      29             :   static JSAddonId* FindAddonId(const nsAString& path);
      30             : 
      31             :   NS_DECL_ISUPPORTS
      32             :   NS_DECL_AMIADDONPATHSERVICE
      33             : 
      34         181 :   struct PathEntry
      35             :   {
      36             :     nsString mPath;
      37             :     JSAddonId* mAddonId;
      38             : 
      39         164 :     PathEntry(const nsAString& aPath, JSAddonId* aAddonId)
      40         164 :      : mPath(aPath), mAddonId(aAddonId)
      41         164 :     {}
      42             :   };
      43             : 
      44             : private:
      45             :   virtual ~AddonPathService();
      46             : 
      47             :   // Paths are stored sorted in order of their mPath.
      48             :   nsTArray<PathEntry> mPaths;
      49             : 
      50             :   static AddonPathService* sInstance;
      51             : };
      52             : 
      53             : } // namespace mozilla
      54             : 
      55             : #endif

Generated by: LCOV version 1.13