Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(509)

Side by Side Diff: chrome/browser/media_gallery/media_file_system_registry.h

Issue 10822002: Media Galleries API: hookup the AllGalleries permission and add tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 #include <map> 11 #include <map>
12 #include <string> 12 #include <string>
13 #include <utility> 13 #include <utility>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/basictypes.h" 16 #include "base/basictypes.h"
17 #include "base/lazy_instance.h" 17 #include "base/lazy_instance.h"
18 #include "base/system_monitor/system_monitor.h" 18 #include "base/system_monitor/system_monitor.h"
19 #include "content/public/browser/notification_observer.h" 19 #include "content/public/browser/notification_observer.h"
20 #include "content/public/browser/notification_registrar.h" 20 #include "content/public/browser/notification_registrar.h"
21 21
22 class FilePath; 22 class FilePath;
23 23
24 namespace content { 24 namespace content {
25 class RenderProcessHost; 25 class RenderProcessHost;
26 } 26 }
27 27
28 namespace extensions {
29 class Extension;
30 }
31
28 namespace fileapi { 32 namespace fileapi {
29 class IsolatedContext; 33 class IsolatedContext;
30 } 34 }
31 35
32 namespace chrome { 36 namespace chrome {
33 37
34 class MediaFileSystemRegistry 38 class MediaFileSystemRegistry
35 : public base::SystemMonitor::DevicesChangedObserver, 39 : public base::SystemMonitor::DevicesChangedObserver,
36 public content::NotificationObserver { 40 public content::NotificationObserver {
37 public: 41 public:
38 // (Filesystem ID, path) 42 // (Filesystem ID, path)
39 typedef std::pair<std::string, FilePath> MediaFSIDAndPath; 43 typedef std::pair<std::string, FilePath> MediaFSIDAndPath;
40 44
41 // The instance is lazily created per browser process. 45 // The instance is lazily created per browser process.
42 static MediaFileSystemRegistry* GetInstance(); 46 static MediaFileSystemRegistry* GetInstance();
43 47
44 // Returns the list of media filesystem IDs and paths for a given RPH. 48 // Returns the list of media filesystem IDs and paths for a given RPH.
45 // Called on the UI thread. 49 // Called on the UI thread.
46 std::vector<MediaFSIDAndPath> GetMediaFileSystems( 50 std::vector<MediaFSIDAndPath> GetMediaFileSystems(
47 const content::RenderProcessHost* rph); 51 const content::RenderProcessHost* rph,
52 const extensions::Extension& extension);
48 53
49 // base::SystemMonitor::DevicesChangedObserver implementation. 54 // base::SystemMonitor::DevicesChangedObserver implementation.
50 virtual void OnMediaDeviceDetached(const std::string& id) OVERRIDE; 55 virtual void OnMediaDeviceDetached(const std::string& id) OVERRIDE;
51 56
52 // content::NotificationObserver implementation. 57 // content::NotificationObserver implementation.
53 virtual void Observe(int type, 58 virtual void Observe(int type,
54 const content::NotificationSource& source, 59 const content::NotificationSource& source,
55 const content::NotificationDetails& details) OVERRIDE; 60 const content::NotificationDetails& details) OVERRIDE;
56 61
57 private: 62 private:
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 95
91 // Is only used on the UI thread. 96 // Is only used on the UI thread.
92 content::NotificationRegistrar registrar_; 97 content::NotificationRegistrar registrar_;
93 98
94 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); 99 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry);
95 }; 100 };
96 101
97 } // namespace chrome 102 } // namespace chrome
98 103
99 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ 104 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698