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 // MediaDeviceNotificationsLinux listens for mount point changes and notifies | 5 // MediaDeviceNotificationsLinux listens for mount point changes and notifies |
6 // the SystemMonitor about the addition and deletion of media devices. | 6 // the SystemMonitor about the addition and deletion of media devices. |
7 | 7 |
8 #ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATIONS_LINUX_H_ | 8 #ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATIONS_LINUX_H_ |
9 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATIONS_LINUX_H_ | 9 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATIONS_LINUX_H_ |
10 | 10 |
11 #if defined(OS_CHROMEOS) | 11 #if defined(OS_CHROMEOS) |
12 #error "Use the ChromeOS-specific implementation instead." | 12 #error "Use the ChromeOS-specific implementation instead." |
13 #endif | 13 #endif |
14 | 14 |
15 #include <map> | 15 #include <map> |
16 #include <set> | 16 #include <set> |
17 #include <string> | 17 #include <string> |
18 #include <utility> | 18 #include <utility> |
19 | 19 |
20 #include "base/basictypes.h" | 20 #include "base/basictypes.h" |
21 #include "base/compiler_specific.h" | 21 #include "base/compiler_specific.h" |
22 #include "base/files/file_path_watcher.h" | 22 #include "base/files/file_path_watcher.h" |
23 #include "base/memory/ref_counted.h" | 23 #include "base/memory/ref_counted.h" |
24 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
25 | 25 |
26 class FilePath; | 26 class FilePath; |
27 | 27 |
28 // Gets the media device information given a |device_path|. On success, | 28 // Gets the media device information given a |device_path|. On success, |
29 // returns true and fills in |device_name| and |device_id|. | 29 // returns true and fills in |name| and |id|. |
30 typedef bool (*GetDeviceInfoFunc)(const std::string& device_path, | 30 typedef bool (*GetDeviceInfoFunc)(const std::string& device_path, |
31 std::string* device_name, | 31 std::string* id, |
32 string16* device_id); | 32 string16* name); |
33 | 33 |
34 namespace chrome { | 34 namespace chrome { |
35 | 35 |
36 class MediaDeviceNotificationsLinux | 36 class MediaDeviceNotificationsLinux |
37 : public base::RefCountedThreadSafe<MediaDeviceNotificationsLinux, | 37 : public base::RefCountedThreadSafe<MediaDeviceNotificationsLinux, |
38 content::BrowserThread::DeleteOnFileThread> { | 38 content::BrowserThread::DeleteOnFileThread> { |
39 public: | 39 public: |
40 explicit MediaDeviceNotificationsLinux(const FilePath& path); | 40 explicit MediaDeviceNotificationsLinux(const FilePath& path); |
41 | 41 |
42 // Must be called for MediaDeviceNotificationsLinux to work. | 42 // Must be called for MediaDeviceNotificationsLinux to work. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // Function handler to get device information. This is useful to set a mock | 110 // Function handler to get device information. This is useful to set a mock |
111 // handler for unit testing. | 111 // handler for unit testing. |
112 GetDeviceInfoFunc get_device_info_func_; | 112 GetDeviceInfoFunc get_device_info_func_; |
113 | 113 |
114 DISALLOW_COPY_AND_ASSIGN(MediaDeviceNotificationsLinux); | 114 DISALLOW_COPY_AND_ASSIGN(MediaDeviceNotificationsLinux); |
115 }; | 115 }; |
116 | 116 |
117 } // namespace chrome | 117 } // namespace chrome |
118 | 118 |
119 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATIONS_LINUX_H_ | 119 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATIONS_LINUX_H_ |
OLD | NEW |