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 29 matching lines...) Expand all Loading... |
40 | 40 |
41 // The instance is lazily created per browser process. | 41 // The instance is lazily created per browser process. |
42 static MediaFileSystemRegistry* GetInstance(); | 42 static MediaFileSystemRegistry* GetInstance(); |
43 | 43 |
44 // Returns the list of media filesystem IDs and paths for a given RPH. | 44 // Returns the list of media filesystem IDs and paths for a given RPH. |
45 // Called on the UI thread. | 45 // Called on the UI thread. |
46 std::vector<MediaFSIDAndPath> GetMediaFileSystems( | 46 std::vector<MediaFSIDAndPath> GetMediaFileSystems( |
47 const content::RenderProcessHost* rph); | 47 const content::RenderProcessHost* rph); |
48 | 48 |
49 // base::SystemMonitor::DevicesChangedObserver implementation. | 49 // base::SystemMonitor::DevicesChangedObserver implementation. |
50 virtual void OnMediaDeviceDetached( | 50 virtual void OnMediaDeviceDetached(const std::string& id) OVERRIDE; |
51 const base::SystemMonitor::DeviceIdType& id) OVERRIDE; | |
52 | 51 |
53 // content::NotificationObserver implementation. | 52 // content::NotificationObserver implementation. |
54 virtual void Observe(int type, | 53 virtual void Observe(int type, |
55 const content::NotificationSource& source, | 54 const content::NotificationSource& source, |
56 const content::NotificationDetails& details) OVERRIDE; | 55 const content::NotificationDetails& details) OVERRIDE; |
57 | 56 |
58 private: | 57 private: |
59 friend struct base::DefaultLazyInstanceTraits<MediaFileSystemRegistry>; | 58 friend struct base::DefaultLazyInstanceTraits<MediaFileSystemRegistry>; |
60 | 59 |
61 // Mapping of media directories to filesystem IDs. | 60 // Mapping of media directories to filesystem IDs. |
62 typedef std::map<FilePath, std::string> MediaPathToFSIDMap; | 61 typedef std::map<FilePath, std::string> MediaPathToFSIDMap; |
63 | 62 |
64 // Mapping of RPH to MediaPathToFSIDMaps. | 63 // Mapping of RPH to MediaPathToFSIDMaps. |
65 typedef std::map<const content::RenderProcessHost*, | 64 typedef std::map<const content::RenderProcessHost*, |
66 MediaPathToFSIDMap> ChildIdToMediaFSMap; | 65 MediaPathToFSIDMap> ChildIdToMediaFSMap; |
67 | 66 |
68 // Mapping of device id to mount path. | 67 // Mapping of device id to mount path. |
69 typedef std::map<base::SystemMonitor::DeviceIdType, FilePath> | 68 typedef std::map<std::string, FilePath> DeviceIdToMediaPathMap; |
70 DeviceIdToMediaPathMap; | |
71 | 69 |
72 // Obtain an instance of this class via GetInstance(). | 70 // Obtain an instance of this class via GetInstance(). |
73 MediaFileSystemRegistry(); | 71 MediaFileSystemRegistry(); |
74 virtual ~MediaFileSystemRegistry(); | 72 virtual ~MediaFileSystemRegistry(); |
75 | 73 |
76 // Helper functions to register / unregister listening for renderer process | 74 // Helper functions to register / unregister listening for renderer process |
77 // closed / terminiated notifications. | 75 // closed / terminiated notifications. |
78 void RegisterForRPHGoneNotifications(const content::RenderProcessHost* rph); | 76 void RegisterForRPHGoneNotifications(const content::RenderProcessHost* rph); |
79 void UnregisterForRPHGoneNotifications(const content::RenderProcessHost* rph); | 77 void UnregisterForRPHGoneNotifications(const content::RenderProcessHost* rph); |
80 | 78 |
(...skipping 11 matching lines...) Expand all Loading... |
92 | 90 |
93 // Is only used on the UI thread. | 91 // Is only used on the UI thread. |
94 content::NotificationRegistrar registrar_; | 92 content::NotificationRegistrar registrar_; |
95 | 93 |
96 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); | 94 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); |
97 }; | 95 }; |
98 | 96 |
99 } // namespace chrome | 97 } // namespace chrome |
100 | 98 |
101 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ | 99 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ |
OLD | NEW |