Home | History | Annotate | Download | only in login
      1 // Copyright (c) 2012 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 CHROME_BROWSER_CHROMEOS_LOGIN_MOUNT_MANAGER_H_
      6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MOUNT_MANAGER_H_
      7 
      8 #include <map>
      9 #include <string>
     10 
     11 #include "base/files/file_path.h"
     12 #include "base/memory/scoped_ptr.h"
     13 
     14 class PrefRegistrySimple;
     15 
     16 namespace chromeos {
     17 
     18 // Keeps track of mount points for different users.
     19 class MountManager {
     20  public:
     21   // Returns a shared instance of a MountManager. Not thread-safe,
     22   // should only be called from the main UI thread.
     23   static MountManager* Get();
     24 
     25   static base::FilePath GetHomeDir(std::string& user_hash);
     26 
     27   virtual ~MountManager();
     28 
     29   virtual bool IsMounted(const std::string& user_id);
     30   virtual base::FilePath GetPath(const std::string& user_id);
     31 
     32   virtual void SetPath(const std::string& user_id,
     33                        const base::FilePath& path);
     34   virtual void DeletePath(const std::string& user_id);
     35 
     36  private:
     37   MountManager();
     38 
     39   typedef std::map<std::string, base::FilePath> UserToPathMap;
     40 
     41   UserToPathMap additional_mounts_;
     42 
     43   static MountManager* instance_;
     44 
     45   DISALLOW_COPY_AND_ASSIGN(MountManager);
     46 };
     47 
     48 }  // namespace chromeos
     49 
     50 #endif  // CHROME_BROWSER_CHROMEOS_LOGIN_MOUNT_MANAGER_H_
     51