Chromium Code Reviews| 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 DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ | 5 #ifndef DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ |
| 6 #define DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ | 6 #define DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/ref_counted.h" | |
| 12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 13 | 14 |
| 14 #if !defined(OS_LINUX) | 15 #if !defined(OS_LINUX) |
| 15 #error "Only used on Linux and ChromeOS" | 16 #error "Only used on Linux and ChromeOS" |
| 16 #endif | 17 #endif |
| 17 | 18 |
| 18 class MtpFileEntry; | 19 class MtpFileEntry; |
| 19 class MtpStorageInfo; | 20 class MtpStorageInfo; |
| 20 | 21 |
| 22 namespace base { | |
| 23 class MessageLoopProxy; | |
| 24 } | |
| 25 | |
| 21 namespace device { | 26 namespace device { |
| 22 | 27 |
| 23 // This class handles the interaction with mtpd. | 28 // This class handles the interaction with mtpd. |
| 24 // Other classes can add themselves as observers. | 29 // Other classes can add themselves as observers. |
| 25 class MediaTransferProtocolManager { | 30 class MediaTransferProtocolManager { |
| 26 public: | 31 public: |
| 27 // A callback to handle the result of OpenStorage. | 32 // A callback to handle the result of OpenStorage. |
| 28 // The first argument is the returned handle. | 33 // The first argument is the returned handle. |
| 29 // The second argument is true if there was an error. | 34 // The second argument is true if there was an error. |
| 30 typedef base::Callback<void(const std::string& handle, | 35 typedef base::Callback<void(const std::string& handle, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 const std::string& path, | 126 const std::string& path, |
| 122 const GetFileInfoCallback& callback) = 0; | 127 const GetFileInfoCallback& callback) = 0; |
| 123 | 128 |
| 124 // Gets the file metadata for |file_id| on |storage_handle| and runs | 129 // Gets the file metadata for |file_id| on |storage_handle| and runs |
| 125 // |callback|. | 130 // |callback|. |
| 126 virtual void GetFileInfoById(const std::string& storage_handle, | 131 virtual void GetFileInfoById(const std::string& storage_handle, |
| 127 uint32 file_id, | 132 uint32 file_id, |
| 128 const GetFileInfoCallback& callback) = 0; | 133 const GetFileInfoCallback& callback) = 0; |
| 129 | 134 |
| 130 // Creates the global MediaTransferProtocolManager instance. | 135 // Creates the global MediaTransferProtocolManager instance. |
| 131 static void Initialize(); | 136 static void Initialize(scoped_refptr<base::MessageLoopProxy> loop_proxy); |
|
Lei Zhang
2013/01/31 04:01:31
Document |loop_proxy|.
kmadhusu
2013/01/31 18:12:38
Done.
| |
| 132 | 137 |
| 133 // Destroys the global MediaTransferProtocolManager instance if it exists. | 138 // Destroys the global MediaTransferProtocolManager instance if it exists. |
| 134 static void Shutdown(); | 139 static void Shutdown(); |
| 135 | 140 |
| 136 // Returns a pointer to the global MediaTransferProtocolManager instance. | 141 // Returns a pointer to the global MediaTransferProtocolManager instance. |
| 137 // Initialize() should already have been called. | 142 // Initialize() should already have been called. |
| 138 static MediaTransferProtocolManager* GetInstance(); | 143 static MediaTransferProtocolManager* GetInstance(); |
| 139 }; | 144 }; |
| 140 | 145 |
| 141 } // namespace device | 146 } // namespace device |
| 142 | 147 |
| 143 #endif // DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ | 148 #endif // DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ |
| OLD | NEW |