mail/components/shell/DirectoryProvider.h
author Arlo Breault <arlolra@gmail.com>
Wed, 27 Aug 2014 23:28:11 -0700
changeset 25848 e2c85d70fda266eb3db5e2dc2e2fc95b7f12fcd1
parent 24786 21e13ac2fe1f124fd027a0b1b111c6b04154f443
child 30209 67786d8520cd56bfae279e76415f94e8ca05cb57
child 30218 5a70632e8177b708e70e67ed3895d7971d53d8e7
child 66867 c76c04e0090fa0269f0ccc9397b3720622208930
child 66873 eccec3229ef51e5faea05b506c07210bcbba4e56
permissions -rw-r--r--
Bug 983347 - Need different paths for displaying to the screen and sending over the wire. Correct version. r=florian,clokep a=jcranmer

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef DirectoryProvider_h__
#define DirectoryProvider_h__

#include "nsIDirectoryService.h"
#include "nsComponentManagerUtils.h"
#include "nsISimpleEnumerator.h"
#include "nsIFile.h"

#define NS_MAILDIRECTORYPROVIDER_CONTRACTID \
  "@mozilla.org/mail/directory-provider;1"

#define NS_MAILDIRECTORYPROVIDER_CID \
  { 0xa7e8e047, 0xd36e, 0x4605, { 0xa5, 0xab, 0x1a, 0x62, 0x29, 0x03, 0x85, 0x99 }}

namespace mozilla {
namespace mail {

/**
 * Ideally this would be a javascript class, however, when we do so, this somehow breaks
 * our xpcshell-tests due to various errors probably because of the xpconnect process.
 * For now, we'll work around it with c++ until we can fix those issues. See bug 733802
 * for more details.
 */
class DirectoryProvider : public nsIDirectoryServiceProvider2
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSIDIRECTORYSERVICEPROVIDER
  NS_DECL_NSIDIRECTORYSERVICEPROVIDER2

  DirectoryProvider() {}

private:
  virtual ~DirectoryProvider() {}
  class AppendingEnumerator : public nsISimpleEnumerator
  {
  public:
    NS_DECL_ISUPPORTS
    NS_DECL_NSISIMPLEENUMERATOR

    AppendingEnumerator(nsISimpleEnumerator* aBase,
                        char const *const *aAppendList);

  private:
    virtual ~AppendingEnumerator() {}
    nsCOMPtr<nsISimpleEnumerator> mBase;
    char const *const *const      mAppendList;
    nsCOMPtr<nsIFile>             mNext;
  };
};

} // namespace mail
} // namespace mozilla

#endif // DirectoryProvider_h__