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 21 matching lines...) Expand all Loading... |
32 namespace fileapi { | 32 namespace fileapi { |
33 class IsolatedContext; | 33 class IsolatedContext; |
34 } | 34 } |
35 | 35 |
36 namespace chrome { | 36 namespace chrome { |
37 | 37 |
38 class MediaFileSystemRegistry | 38 class MediaFileSystemRegistry |
39 : public base::SystemMonitor::DevicesChangedObserver, | 39 : public base::SystemMonitor::DevicesChangedObserver, |
40 public content::NotificationObserver { | 40 public content::NotificationObserver { |
41 public: | 41 public: |
42 // (Filesystem ID, path) | 42 struct MediaFSInfo { |
43 typedef std::pair<std::string, FilePath> MediaFSIDAndPath; | 43 std::string name; |
| 44 std::string fsid; |
| 45 FilePath path; |
| 46 }; |
44 | 47 |
45 // The instance is lazily created per browser process. | 48 // The instance is lazily created per browser process. |
46 static MediaFileSystemRegistry* GetInstance(); | 49 static MediaFileSystemRegistry* GetInstance(); |
47 | 50 |
48 // 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. |
49 // Called on the UI thread. | 52 // Called on the UI thread. |
50 std::vector<MediaFSIDAndPath> GetMediaFileSystems( | 53 std::vector<MediaFSInfo> GetMediaFileSystemsForExtension( |
51 const content::RenderProcessHost* rph, | 54 const content::RenderProcessHost* rph, |
52 const extensions::Extension& extension); | 55 const extensions::Extension& extension); |
53 | 56 |
54 // base::SystemMonitor::DevicesChangedObserver implementation. | 57 // base::SystemMonitor::DevicesChangedObserver implementation. |
55 virtual void OnMediaDeviceDetached(const std::string& id) OVERRIDE; | 58 virtual void OnMediaDeviceDetached(const std::string& id) OVERRIDE; |
56 | 59 |
57 // content::NotificationObserver implementation. | 60 // content::NotificationObserver implementation. |
58 virtual void Observe(int type, | 61 virtual void Observe(int type, |
59 const content::NotificationSource& source, | 62 const content::NotificationSource& source, |
60 const content::NotificationDetails& details) OVERRIDE; | 63 const content::NotificationDetails& details) OVERRIDE; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 98 |
96 // Is only used on the UI thread. | 99 // Is only used on the UI thread. |
97 content::NotificationRegistrar registrar_; | 100 content::NotificationRegistrar registrar_; |
98 | 101 |
99 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); | 102 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); |
100 }; | 103 }; |
101 | 104 |
102 } // namespace chrome | 105 } // namespace chrome |
103 | 106 |
104 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ | 107 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ |
OLD | NEW |