| 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_STORAGE_MONITOR_STORAGE_MONITOR_H_ | 5 #ifndef CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_ |
| 6 #define CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_ | 6 #define CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/observer_list_threadsafe.h" | 14 #include "base/observer_list_threadsafe.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 17 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
| 18 #include "chrome/browser/storage_monitor/storage_info.h" | 18 #include "chrome/browser/storage_monitor/storage_info.h" |
| 19 | 19 |
| 20 class ChromeBrowserMainPartsLinux; | 20 class MediaFileSystemRegistryTest; |
| 21 class ChromeBrowserMainPartsMac; | |
| 22 class MediaGalleriesPlatformAppBrowserTest; | 21 class MediaGalleriesPlatformAppBrowserTest; |
| 23 class MediaGalleriesPrivateApiTest; | 22 class MediaGalleriesPrivateApiTest; |
| 23 class RemovableStorageObserver; |
| 24 class SystemStorageApiTest; | 24 class SystemStorageApiTest; |
| 25 class SystemStorageEjectApiTest; | 25 class SystemStorageEjectApiTest; |
| 26 class TransientDeviceIds; |
| 26 | 27 |
| 27 namespace device { | 28 namespace device { |
| 28 class MediaTransferProtocolManager; | 29 class MediaTransferProtocolManager; |
| 29 } | 30 } |
| 30 | 31 |
| 31 namespace chrome { | |
| 32 | |
| 33 class MediaFileSystemRegistryTest; | |
| 34 class RemovableStorageObserver; | |
| 35 class TransientDeviceIds; | |
| 36 | |
| 37 // Base class for platform-specific instances watching for removable storage | 32 // Base class for platform-specific instances watching for removable storage |
| 38 // attachments/detachments. | 33 // attachments/detachments. |
| 39 // Lifecycle contracts: This class is created in the browser process | 34 // Lifecycle contracts: This class is created in the browser process |
| 40 // before the profile is initialized, so listeners can be | 35 // before the profile is initialized, so listeners can be |
| 41 // created during profile construction. The platform-specific initialization, | 36 // created during profile construction. The platform-specific initialization, |
| 42 // which can lead to calling registered listeners with notifications of | 37 // which can lead to calling registered listeners with notifications of |
| 43 // attached volumes, are done lazily at first use through the async | 38 // attached volumes, are done lazily at first use through the async |
| 44 // |Initialize()| method. That must be done before any of the registered | 39 // |Initialize()| method. That must be done before any of the registered |
| 45 // listeners will receive updates or calls to other API methods return | 40 // listeners will receive updates or calls to other API methods return |
| 46 // meaningful results. | 41 // meaningful results. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 void RemoveObserver(RemovableStorageObserver* obs); | 122 void RemoveObserver(RemovableStorageObserver* obs); |
| 128 | 123 |
| 129 std::string GetTransientIdForDeviceId(const std::string& device_id); | 124 std::string GetTransientIdForDeviceId(const std::string& device_id); |
| 130 std::string GetDeviceIdForTransientId(const std::string& transient_id) const; | 125 std::string GetDeviceIdForTransientId(const std::string& transient_id) const; |
| 131 | 126 |
| 132 virtual void EjectDevice( | 127 virtual void EjectDevice( |
| 133 const std::string& device_id, | 128 const std::string& device_id, |
| 134 base::Callback<void(EjectStatus)> callback); | 129 base::Callback<void(EjectStatus)> callback); |
| 135 | 130 |
| 136 protected: | 131 protected: |
| 132 friend class ::MediaFileSystemRegistryTest; |
| 137 friend class ::MediaGalleriesPlatformAppBrowserTest; | 133 friend class ::MediaGalleriesPlatformAppBrowserTest; |
| 138 friend class ::MediaGalleriesPrivateApiTest; | 134 friend class ::MediaGalleriesPrivateApiTest; |
| 139 friend class MediaFileSystemRegistryTest; | |
| 140 friend class ::SystemStorageApiTest; | 135 friend class ::SystemStorageApiTest; |
| 141 friend class ::SystemStorageEjectApiTest; | 136 friend class ::SystemStorageEjectApiTest; |
| 142 | 137 |
| 143 StorageMonitor(); | 138 StorageMonitor(); |
| 144 | 139 |
| 145 virtual Receiver* receiver() const; | 140 virtual Receiver* receiver() const; |
| 146 | 141 |
| 147 // Called to initialize the storage monitor. | 142 // Called to initialize the storage monitor. |
| 148 virtual void Init() = 0; | 143 virtual void Init() = 0; |
| 149 | 144 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 175 | 170 |
| 176 // For manipulating storage_map_ structure. | 171 // For manipulating storage_map_ structure. |
| 177 mutable base::Lock storage_lock_; | 172 mutable base::Lock storage_lock_; |
| 178 | 173 |
| 179 // Map of all known storage devices,including fixed and removable storages. | 174 // Map of all known storage devices,including fixed and removable storages. |
| 180 StorageMap storage_map_; | 175 StorageMap storage_map_; |
| 181 | 176 |
| 182 scoped_ptr<TransientDeviceIds> transient_device_ids_; | 177 scoped_ptr<TransientDeviceIds> transient_device_ids_; |
| 183 }; | 178 }; |
| 184 | 179 |
| 185 } // namespace chrome | |
| 186 | |
| 187 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_ | 180 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_ |
| OLD | NEW |