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

Side by Side Diff: components/storage_monitor/media_transfer_protocol_device_observer_chromeos.h

Issue 2358493002: Remove MTP support on Linux. (Closed)
Patch Set: move files Created 4 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_STORAGE_MONITOR_MEDIA_TRANSFER_PROTOCOL_DEVICE_OBSERVER_LINUX _H_ 5 #ifndef COMPONENTS_STORAGE_MONITOR_MEDIA_TRANSFER_PROTOCOL_DEVICE_OBSERVER_CHROM EOS_H_
6 #define COMPONENTS_STORAGE_MONITOR_MEDIA_TRANSFER_PROTOCOL_DEVICE_OBSERVER_LINUX _H_ 6 #define COMPONENTS_STORAGE_MONITOR_MEDIA_TRANSFER_PROTOCOL_DEVICE_OBSERVER_CHROM EOS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "components/storage_monitor/storage_monitor.h" 13 #include "components/storage_monitor/storage_monitor.h"
14 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" 14 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h"
15 15
16 namespace base { 16 namespace base {
17 class FilePath; 17 class FilePath;
18 } 18 }
19 19
20 namespace storage_monitor { 20 namespace storage_monitor {
21 21
22 // Gets the mtp device information given a |storage_name|. On success, 22 // Gets the mtp device information given a |storage_name|. On success,
23 // fills in |id|, |name|, |location|, |vendor_name|, and |product_name|. 23 // fills in |id|, |name|, |location|, |vendor_name|, and |product_name|.
24 typedef void (*GetStorageInfoFunc)( 24 typedef void (*GetStorageInfoFunc)(
25 const std::string& storage_name, 25 const std::string& storage_name,
26 device::MediaTransferProtocolManager* mtp_manager, 26 device::MediaTransferProtocolManager* mtp_manager,
27 std::string* id, 27 std::string* id,
28 base::string16* name, 28 base::string16* name,
29 std::string* location, 29 std::string* location,
30 base::string16* vendor_name, 30 base::string16* vendor_name,
31 base::string16* product_name); 31 base::string16* product_name);
32 32
33 // Helper class to send MTP storage attachment and detachment events to 33 // Helper class to send MTP storage attachment and detachment events to
34 // StorageMonitor. 34 // StorageMonitor.
35 class MediaTransferProtocolDeviceObserverLinux 35 class MediaTransferProtocolDeviceObserverChromeOS
36 : public device::MediaTransferProtocolManager::Observer { 36 : public device::MediaTransferProtocolManager::Observer {
37 public: 37 public:
38 MediaTransferProtocolDeviceObserverLinux( 38 MediaTransferProtocolDeviceObserverChromeOS(
39 StorageMonitor::Receiver* receiver, 39 StorageMonitor::Receiver* receiver,
40 device::MediaTransferProtocolManager* mtp_manager); 40 device::MediaTransferProtocolManager* mtp_manager);
41 ~MediaTransferProtocolDeviceObserverLinux() override; 41 ~MediaTransferProtocolDeviceObserverChromeOS() override;
42 42
43 // Finds the storage that contains |path| and populates |storage_info|. 43 // Finds the storage that contains |path| and populates |storage_info|.
44 // Returns false if unable to find the storage. 44 // Returns false if unable to find the storage.
45 bool GetStorageInfoForPath(const base::FilePath& path, 45 bool GetStorageInfoForPath(const base::FilePath& path,
46 StorageInfo* storage_info) const; 46 StorageInfo* storage_info) const;
47 47
48 void EjectDevice(const std::string& device_id, 48 void EjectDevice(const std::string& device_id,
49 base::Callback<void(StorageMonitor::EjectStatus)> callback); 49 base::Callback<void(StorageMonitor::EjectStatus)> callback);
50 50
51 protected: 51 protected:
52 // Only used in unit tests. 52 // Only used in unit tests.
53 MediaTransferProtocolDeviceObserverLinux( 53 MediaTransferProtocolDeviceObserverChromeOS(
54 StorageMonitor::Receiver* receiver, 54 StorageMonitor::Receiver* receiver,
55 device::MediaTransferProtocolManager* mtp_manager, 55 device::MediaTransferProtocolManager* mtp_manager,
56 GetStorageInfoFunc get_storage_info_func); 56 GetStorageInfoFunc get_storage_info_func);
57 57
58 // device::MediaTransferProtocolManager::Observer implementation. 58 // device::MediaTransferProtocolManager::Observer implementation.
59 // Exposed for unit tests. 59 // Exposed for unit tests.
60 void StorageChanged(bool is_attached, 60 void StorageChanged(bool is_attached,
61 const std::string& storage_name) override; 61 const std::string& storage_name) override;
62 62
63 private: 63 private:
(...skipping 16 matching lines...) Expand all
80 StorageLocationToInfoMap storage_map_; 80 StorageLocationToInfoMap storage_map_;
81 81
82 // Function handler to get storage information. This is useful to set a mock 82 // Function handler to get storage information. This is useful to set a mock
83 // handler for unit testing. 83 // handler for unit testing.
84 GetStorageInfoFunc get_storage_info_func_; 84 GetStorageInfoFunc get_storage_info_func_;
85 85
86 // The notifications object to use to signal newly attached devices. 86 // The notifications object to use to signal newly attached devices.
87 // Guaranteed to outlive this class. 87 // Guaranteed to outlive this class.
88 StorageMonitor::Receiver* const notifications_; 88 StorageMonitor::Receiver* const notifications_;
89 89
90 DISALLOW_COPY_AND_ASSIGN(MediaTransferProtocolDeviceObserverLinux); 90 DISALLOW_COPY_AND_ASSIGN(MediaTransferProtocolDeviceObserverChromeOS);
91 }; 91 };
92 92
93 } // namespace storage_monitor 93 } // namespace storage_monitor
94 94
95 #endif // COMPONENTS_STORAGE_MONITOR_MEDIA_TRANSFER_PROTOCOL_DEVICE_OBSERVER_LI NUX_H_ 95 #endif // COMPONENTS_STORAGE_MONITOR_MEDIA_TRANSFER_PROTOCOL_DEVICE_OBSERVER_CH ROMEOS_H_
OLDNEW
« no previous file with comments | « components/storage_monitor/BUILD.gn ('k') | components/storage_monitor/media_transfer_protocol_device_observer_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698