OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // MediaFileSystemRegistry registers pictures directories and media devices as | 5 // MediaFileSystemRegistry registers pictures directories and media devices as |
6 // File API filesystems and keeps track of the path to filesystem ID mappings. | 6 // File API filesystems and keeps track of the path to filesystem ID mappings. |
7 | 7 |
8 #ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ | 8 #ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ |
9 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ | 9 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // The instance is lazily created per browser process. | 48 // The instance is lazily created per browser process. |
49 static MediaFileSystemRegistry* GetInstance(); | 49 static MediaFileSystemRegistry* GetInstance(); |
50 | 50 |
51 // Returns the list of media filesystem IDs and paths for a given RPH. | 51 // Returns the list of media filesystem IDs and paths for a given RPH. |
52 // Called on the UI thread. | 52 // Called on the UI thread. |
53 std::vector<MediaFSInfo> GetMediaFileSystemsForExtension( | 53 std::vector<MediaFSInfo> GetMediaFileSystemsForExtension( |
54 const content::RenderProcessHost* rph, | 54 const content::RenderProcessHost* rph, |
55 const extensions::Extension& extension); | 55 const extensions::Extension& extension); |
56 | 56 |
57 // base::SystemMonitor::DevicesChangedObserver implementation. | 57 // base::SystemMonitor::DevicesChangedObserver implementation. |
58 virtual void OnMediaDeviceDetached(const std::string& id) OVERRIDE; | 58 virtual void OnRemovableStorageDetached(const std::string& id) OVERRIDE; |
59 | 59 |
60 // content::NotificationObserver implementation. | 60 // content::NotificationObserver implementation. |
61 virtual void Observe(int type, | 61 virtual void Observe(int type, |
62 const content::NotificationSource& source, | 62 const content::NotificationSource& source, |
63 const content::NotificationDetails& details) OVERRIDE; | 63 const content::NotificationDetails& details) OVERRIDE; |
64 | 64 |
65 std::string GetDeviceIdFromPath(const FilePath& path) const; | 65 std::string GetDeviceIdFromPath(const FilePath& path) const; |
66 | 66 |
67 private: | 67 private: |
68 friend struct base::DefaultLazyInstanceTraits<MediaFileSystemRegistry>; | 68 friend struct base::DefaultLazyInstanceTraits<MediaFileSystemRegistry>; |
69 | 69 |
70 // Mapping of media directories to filesystem IDs. | 70 // Mapping of media directories to filesystem IDs. |
71 typedef std::map<FilePath, std::string> MediaPathToFSIDMap; | 71 typedef std::map<FilePath, std::string> MediaPathToFSIDMap; |
72 | 72 |
73 // Mapping of RPH to MediaPathToFSIDMaps. | 73 // Mapping of RPH to MediaPathToFSIDMaps. |
74 typedef std::map<const content::RenderProcessHost*, | 74 typedef std::map<const content::RenderProcessHost*, |
75 MediaPathToFSIDMap> ChildIdToMediaFSMap; | 75 MediaPathToFSIDMap> ChildIdToMediaFSMap; |
76 | 76 |
77 // Mapping of device id to media device info. | 77 // Mapping of device id to media device info. |
78 typedef std::map<std::string, base::SystemMonitor::MediaDeviceInfo> | 78 typedef std::map<std::string, base::SystemMonitor::RemovableStorageInfo> |
79 DeviceIdToInfoMap; | 79 DeviceIdToInfoMap; |
80 | 80 |
81 // Obtain an instance of this class via GetInstance(). | 81 // Obtain an instance of this class via GetInstance(). |
82 MediaFileSystemRegistry(); | 82 MediaFileSystemRegistry(); |
83 virtual ~MediaFileSystemRegistry(); | 83 virtual ~MediaFileSystemRegistry(); |
84 | 84 |
85 // Helper functions to register / unregister listening for renderer process | 85 // Helper functions to register / unregister listening for renderer process |
86 // closed / terminiated notifications. | 86 // closed / terminiated notifications. |
87 void RegisterForRPHGoneNotifications(const content::RenderProcessHost* rph); | 87 void RegisterForRPHGoneNotifications(const content::RenderProcessHost* rph); |
88 void UnregisterForRPHGoneNotifications(const content::RenderProcessHost* rph); | 88 void UnregisterForRPHGoneNotifications(const content::RenderProcessHost* rph); |
(...skipping 12 matching lines...) Expand all Loading... |
101 | 101 |
102 // Is only used on the UI thread. | 102 // Is only used on the UI thread. |
103 content::NotificationRegistrar registrar_; | 103 content::NotificationRegistrar registrar_; |
104 | 104 |
105 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); | 105 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); |
106 }; | 106 }; |
107 | 107 |
108 } // namespace chrome | 108 } // namespace chrome |
109 | 109 |
110 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ | 110 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ |
OLD | NEW |