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_SYSTEM_MONITOR_REMOVABLE_STORAGE_NOTIFICATIONS_H_ | 5 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_STORAGE_NOTIFICATIONS_H_ |
6 #define CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_STORAGE_NOTIFICATIONS_H_ | 6 #define CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_STORAGE_NOTIFICATIONS_H_ |
7 | 7 |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/observer_list_threadsafe.h" | 9 #include "base/observer_list_threadsafe.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
12 | 12 |
13 class ChromeBrowserMainPartsLinux; | 13 class ChromeBrowserMainPartsLinux; |
14 class ChromeBrowserMainPartsMac; | 14 class ChromeBrowserMainPartsMac; |
15 class MediaGalleriesPrivateApiTest; | 15 class MediaGalleriesPrivateApiTest; |
16 | 16 |
17 namespace chrome { | 17 namespace chrome { |
18 | 18 |
19 class MediaFileSystemRegistryTest; | 19 class MediaFileSystemRegistryTest; |
20 class RemovableStorageObserver; | 20 class RemovableStorageObserver; |
21 class TransientDeviceIds; | |
21 | 22 |
22 // Base class for platform-specific instances watching for removable storage | 23 // Base class for platform-specific instances watching for removable storage |
23 // attachments/detachments. | 24 // attachments/detachments. |
24 class RemovableStorageNotifications { | 25 class RemovableStorageNotifications { |
25 public: | 26 public: |
26 struct StorageInfo { | 27 struct StorageInfo { |
27 StorageInfo(); | 28 StorageInfo(); |
28 StorageInfo(const std::string& id, | 29 StorageInfo(const std::string& id, |
29 const string16& device_name, | 30 const string16& device_name, |
30 const base::FilePath::StringType& device_location); | 31 const base::FilePath::StringType& device_location); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 string16* device_location, | 77 string16* device_location, |
77 string16* storage_object_id) const = 0; | 78 string16* storage_object_id) const = 0; |
78 #endif | 79 #endif |
79 | 80 |
80 // Returns information for attached removable storage. | 81 // Returns information for attached removable storage. |
81 std::vector<StorageInfo> GetAttachedStorage() const; | 82 std::vector<StorageInfo> GetAttachedStorage() const; |
82 | 83 |
83 void AddObserver(RemovableStorageObserver* obs); | 84 void AddObserver(RemovableStorageObserver* obs); |
84 void RemoveObserver(RemovableStorageObserver* obs); | 85 void RemoveObserver(RemovableStorageObserver* obs); |
85 | 86 |
87 uint64 GetTransientIdForDeviceId(const std::string& device_id); | |
88 | |
86 protected: | 89 protected: |
87 RemovableStorageNotifications(); | 90 RemovableStorageNotifications(); |
88 virtual ~RemovableStorageNotifications(); | 91 virtual ~RemovableStorageNotifications(); |
89 | 92 |
90 // TODO(gbillock): Clean up ownerships and get rid of these friends. | 93 // TODO(gbillock): Clean up ownerships and get rid of these friends. |
91 friend class ::ChromeBrowserMainPartsLinux; | 94 friend class ::ChromeBrowserMainPartsLinux; |
92 friend class ::ChromeBrowserMainPartsMac; | 95 friend class ::ChromeBrowserMainPartsMac; |
93 friend class ::MediaGalleriesPrivateApiTest; | 96 friend class ::MediaGalleriesPrivateApiTest; |
94 friend class MediaFileSystemRegistryTest; | 97 friend class MediaFileSystemRegistryTest; |
95 | 98 |
(...skipping 11 matching lines...) Expand all Loading... | |
107 scoped_ptr<Receiver> receiver_; | 110 scoped_ptr<Receiver> receiver_; |
108 | 111 |
109 scoped_refptr<ObserverListThreadSafe<RemovableStorageObserver> > | 112 scoped_refptr<ObserverListThreadSafe<RemovableStorageObserver> > |
110 observer_list_; | 113 observer_list_; |
111 | 114 |
112 // For manipulating removable_storage_map_ structure. | 115 // For manipulating removable_storage_map_ structure. |
113 mutable base::Lock storage_lock_; | 116 mutable base::Lock storage_lock_; |
114 | 117 |
115 // Map of all the attached removable storage devices. | 118 // Map of all the attached removable storage devices. |
116 RemovableStorageMap storage_map_; | 119 RemovableStorageMap storage_map_; |
120 | |
121 scoped_ptr<TransientDeviceIds> transient_device_ids_; | |
Lei Zhang
2013/02/12 16:48:01
Does this need to be a scoped_ptr?
vandebo (ex-Chrome)
2013/02/12 21:40:57
No, it's just a scoped_ptr to reduce the number of
| |
117 }; | 122 }; |
118 | 123 |
119 } // namespace chrome | 124 } // namespace chrome |
120 | 125 |
121 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_STORAGE_NOTIFICATIONS_H_ | 126 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_STORAGE_NOTIFICATIONS_H_ |
OLD | NEW |