Home | History | Annotate | Download | only in nacl_io
      1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef LIBRARIES_NACL_IO_TYPED_MOUNT_FACTORY_H_
      6 #define LIBRARIES_NACL_IO_TYPED_MOUNT_FACTORY_H_
      7 
      8 #include "nacl_io/mount.h"
      9 #include "nacl_io/mount_factory.h"
     10 
     11 namespace nacl_io {
     12 
     13 template <typename T>
     14 class TypedMountFactory : public MountFactory {
     15  public:
     16   virtual Error CreateMount(int dev,
     17                             StringMap_t& args,
     18                             PepperInterface* ppapi,
     19                             ScopedMount* out_mount) {
     20     sdk_util::ScopedRef<T> mnt(new T());
     21     Error error = mnt->Init(dev, args, ppapi);
     22     if (error)
     23       return error;
     24 
     25     *out_mount = mnt;
     26     return 0;
     27   }
     28 };
     29 
     30 }  // namespace nacl_io
     31 
     32 #endif  // LIBRARIES_NACL_IO_TYPED_MOUNT_FACTORY_H_
     33