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 #ifndef CHROME_BROWSER_INTENTS_DEVICE_ATTACHED_INTENT_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_INTENTS_DEVICE_ATTACHED_INTENT_SOURCE_H_ |
6 #define CHROME_BROWSER_INTENTS_DEVICE_ATTACHED_INTENT_SOURCE_H_ | 6 #define CHROME_BROWSER_INTENTS_DEVICE_ATTACHED_INTENT_SOURCE_H_ |
7 | 7 |
8 #include "base/system_monitor/system_monitor.h" | 8 #include "base/system_monitor/system_monitor.h" |
9 | 9 |
10 class FilePath; | |
11 class Browser; | 10 class Browser; |
12 | 11 |
13 namespace content { | 12 namespace content { |
14 class WebContentsDelegate; | 13 class WebContentsDelegate; |
15 } | 14 } |
16 | 15 |
17 // Listens for media devices attached to the system. When such are detected, | 16 // Listens for media devices attached to the system. When such are detected, |
18 // translates the notification into a Web Intents dispatch. | 17 // translates the notification into a Web Intents dispatch. |
19 // The intent payload is: | 18 // The intent payload is: |
20 // action = "chrome-extension://attach" | 19 // action = "chrome-extension://attach" |
21 // type = "chrome-extension://filesystem" | 20 // type = "chrome-extension://filesystem" |
22 // root_path = the File Path at which the device is accessible | 21 // root_path = the File Path at which the device is accessible |
23 // filesystem_id = registered isolated file system identifier | 22 // filesystem_id = registered isolated file system identifier |
24 class DeviceAttachedIntentSource | 23 class DeviceAttachedIntentSource |
25 : public base::SystemMonitor::DevicesChangedObserver { | 24 : public base::SystemMonitor::DevicesChangedObserver { |
26 public: | 25 public: |
27 explicit DeviceAttachedIntentSource(Browser* browser, | 26 DeviceAttachedIntentSource(Browser* browser, |
28 content::WebContentsDelegate* delegate); | 27 content::WebContentsDelegate* delegate); |
29 virtual ~DeviceAttachedIntentSource(); | 28 virtual ~DeviceAttachedIntentSource(); |
30 | 29 |
31 // DevicesChangedObserver | 30 // base::SystemMonitor::DevicesChangedObserver implementation. |
32 virtual void OnMediaDeviceAttached( | 31 virtual void OnMediaDeviceAttached( |
33 const base::SystemMonitor::DeviceIdType& id, | 32 const std::string& id, |
34 const std::string& name, | 33 const string16& name, |
35 const FilePath& path) OVERRIDE; | 34 base::SystemMonitor::MediaDeviceType type, |
| 35 const FilePath::StringType& location) OVERRIDE; |
36 | 36 |
37 private: | 37 private: |
38 // Weak pointer to browser to which intents will be dispatched. | 38 // Weak pointer to browser to which intents will be dispatched. |
39 Browser* browser_; | 39 Browser* browser_; |
40 content::WebContentsDelegate* delegate_; | 40 content::WebContentsDelegate* delegate_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(DeviceAttachedIntentSource); |
41 }; | 43 }; |
42 | 44 |
43 #endif // CHROME_BROWSER_INTENTS_DEVICE_ATTACHED_INTENT_SOURCE_H_ | 45 #endif // CHROME_BROWSER_INTENTS_DEVICE_ATTACHED_INTENT_SOURCE_H_ |
OLD | NEW |