| OLD | NEW |
| (Empty) | |
| 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 // MediaFileSystemRegistry registers pictures directories as File API |
| 6 // filesystems and keeps track of the path to filesystem ID mappings. |
| 7 // In the near future, MediaFileSystemRegistry will also support media devices. |
| 8 |
| 9 #ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ |
| 10 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ |
| 11 #pragma once |
| 12 |
| 13 #include <map> |
| 14 #include <string> |
| 15 #include <utility> |
| 16 #include <vector> |
| 17 |
| 18 #include "base/basictypes.h" |
| 19 #include "base/lazy_instance.h" |
| 20 |
| 21 class FilePath; |
| 22 |
| 23 namespace fileapi { |
| 24 class IsolatedContext; |
| 25 } |
| 26 |
| 27 namespace chrome { |
| 28 |
| 29 class MediaFileSystemRegistry { |
| 30 public: |
| 31 // (Filesystem ID, path) |
| 32 typedef std::pair<std::string, FilePath> MediaFSIDAndPath; |
| 33 |
| 34 // The instance is lazily created per browser process. |
| 35 static MediaFileSystemRegistry* GetInstance(); |
| 36 |
| 37 // Returns the list of media filesystem IDs and paths. |
| 38 // Called on the UI thread. |
| 39 std::vector<MediaFSIDAndPath> GetMediaFileSystems() const; |
| 40 |
| 41 private: |
| 42 friend struct base::DefaultLazyInstanceTraits<MediaFileSystemRegistry>; |
| 43 |
| 44 // Mapping of media directories to filesystem IDs. |
| 45 typedef std::map<FilePath, std::string> MediaPathToFSIDMap; |
| 46 |
| 47 // Obtain an instance of this class via GetInstance(). |
| 48 MediaFileSystemRegistry(); |
| 49 virtual ~MediaFileSystemRegistry(); |
| 50 |
| 51 // Registers a path as a media file system. |
| 52 void RegisterPathAsFileSystem(const FilePath& path); |
| 53 |
| 54 MediaPathToFSIDMap media_fs_map_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); |
| 57 }; |
| 58 |
| 59 } // namespace chrome |
| 60 |
| 61 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ |
| OLD | NEW |