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

Side by Side Diff: webkit/fileapi/media_device_map_service.h

Issue 10781014: Isolated FS for media devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' 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
(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 #ifndef WEBKIT_FILEAPI_MEDIA_DEVICE_MAP_SERVICE_H_
6 #define WEBKIT_FILEAPI_MEDIA_DEVICE_MAP_SERVICE_H_
7
8 #include <map>
9
10 #include "base/file_path.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/singleton.h"
13 #include "base/synchronization/lock.h"
14
15 namespace fileapi {
16
17 #if defined(OS_WIN)
18 class MtpDeviceInterfaceWin;
19 typedef class MtpDeviceInterfaceWin MediaDeviceInterfaceImpl;
20 #elif defined(OS_POSIX) && !defined(OS_MACOSX)
21 class MtpDeviceInterfaceLinux;
22 typedef class MtpDeviceInterfaceLinux MediaDeviceInterfaceImpl;
23 #endif
24
25 // Helper class to manage MTP device interfaces.
26 class MediaDeviceMapService {
27 public:
28 static MediaDeviceMapService* GetInstance();
29
30 void AddMediaDevice(const FilePath::StringType& device_id);
31 void RemoveMediaDevice(const FilePath::StringType& device_id);
32 bool GetMediaDevice(const FilePath::StringType& device_id,
33 scoped_refptr<MediaDeviceInterfaceImpl>* device);
34
35 private:
36 MediaDeviceMapService();
37 ~MediaDeviceMapService();
38
39 friend struct DefaultSingletonTraits<MediaDeviceMapService>;
40
41 typedef scoped_refptr<MediaDeviceInterfaceImpl> MediaDeviceRefPtr;
42 typedef std::map<FilePath::StringType, MediaDeviceRefPtr> MediaDeviceMap;
43
44 base::Lock media_device_map_lock_;
45
46 // Store a map of attached mtp devices.
47 // Key: Device id.
48 // Value: MtpDeviceInterface.
49 MediaDeviceMap media_device_map_;
50
51 DISALLOW_COPY_AND_ASSIGN(MediaDeviceMapService);
52 };
53
54 } // namespace fileapi
55
56 #endif // WEBKIT_FILEAPI_MEDIA_DEVICE_MAP_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698