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

Side by Side Diff: chrome/browser/intents/device_attached_intent_source.h

Issue 11573048: [Media Galleries] Move RemovableStorageInfo notifications to chrome namespace (part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to head Created 7 years, 11 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 #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 <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/system_monitor/system_monitor.h" 12 #include "chrome/browser/system_monitor/removable_storage_notifications.h"
13 13
14 class Browser; 14 class Browser;
15 15
16 namespace content { 16 namespace content {
17 class WebContentsDelegate; 17 class WebContentsDelegate;
18 } 18 }
19 19
20 // Listens for media devices attached to the system. When such are detected, 20 // Listens for media devices attached to the system. When such are detected,
21 // translates the notification into a Web Intents dispatch. 21 // translates the notification into a Web Intents dispatch.
22 // The intent payload is: 22 // The intent payload is:
23 // action = "chrome-extension://attach" 23 // action = "chrome-extension://attach"
24 // type = "chrome-extension://filesystem" 24 // type = "chrome-extension://filesystem"
25 // root_path = the File Path at which the device is accessible 25 // root_path = the File Path at which the device is accessible
26 // filesystem_id = registered isolated file system identifier 26 // filesystem_id = registered isolated file system identifier
27 class DeviceAttachedIntentSource 27 class DeviceAttachedIntentSource
28 : public base::SystemMonitor::DevicesChangedObserver, 28 : public chrome::RemovableStorageNotifications::RemovableStorageObserver,
29 public base::SupportsWeakPtr<DeviceAttachedIntentSource> { 29 public base::SupportsWeakPtr<DeviceAttachedIntentSource> {
30 public: 30 public:
31 DeviceAttachedIntentSource(Browser* browser, 31 DeviceAttachedIntentSource(Browser* browser,
32 content::WebContentsDelegate* delegate); 32 content::WebContentsDelegate* delegate);
33 virtual ~DeviceAttachedIntentSource(); 33 virtual ~DeviceAttachedIntentSource();
34 34
35 // base::SystemMonitor::DevicesChangedObserver implementation. 35 // RemovableStorageObserver implementation.
36 virtual void OnRemovableStorageAttached( 36 virtual void OnRemovableStorageAttached(
37 const std::string& id, 37 const std::string& id,
38 const string16& name, 38 const string16& name,
39 const FilePath::StringType& location) OVERRIDE; 39 const FilePath::StringType& location) OVERRIDE;
40 virtual void OnRemovableStorageDetached(const std::string& id) OVERRIDE; 40 virtual void OnRemovableStorageDetached(const std::string& id) OVERRIDE;
41 41
42 // Dispatches web intents for the attached media device specified by 42 // Dispatches web intents for the attached media device specified by
43 // |device_info|. 43 // |device_info|.
44 void DispatchIntentsForService( 44 void DispatchIntentsForService(
45 const base::SystemMonitor::RemovableStorageInfo& device_info); 45 const chrome::RemovableStorageNotifications::RemovableStorageInfo&
46 device_info);
46 47
47 private: 48 private:
48 typedef std::map<std::string, base::SystemMonitor::RemovableStorageInfo> 49 typedef std::map<std::string,
50 chrome::RemovableStorageNotifications::RemovableStorageInfo>
49 DeviceIdToInfoMap; 51 DeviceIdToInfoMap;
50 52
51 // Weak pointer to browser to which intents will be dispatched. 53 // Weak pointer to browser to which intents will be dispatched.
52 Browser* browser_; 54 Browser* browser_;
53 content::WebContentsDelegate* delegate_; 55 content::WebContentsDelegate* delegate_;
54 DeviceIdToInfoMap device_id_map_; 56 DeviceIdToInfoMap device_id_map_;
55 57
56 DISALLOW_COPY_AND_ASSIGN(DeviceAttachedIntentSource); 58 DISALLOW_COPY_AND_ASSIGN(DeviceAttachedIntentSource);
57 }; 59 };
58 60
59 #endif // CHROME_BROWSER_INTENTS_DEVICE_ATTACHED_INTENT_SOURCE_H_ 61 #endif // CHROME_BROWSER_INTENTS_DEVICE_ATTACHED_INTENT_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698