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

Side by Side Diff: chrome/browser/storage_monitor/storage_monitor_chromeos.h

Issue 14016002: Storage Monitor: Make StorageMonitorLinux own the MediaTransferProtocolManager. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix browser_tests Created 7 years, 8 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 // chromeos::StorageMonitorCros listens for mount point changes and notifies 5 // chromeos::StorageMonitorCros listens for mount point changes and notifies
6 // listeners about the addition and deletion of media devices. 6 // listeners about the addition and deletion of media devices.
7 // This class lives on the UI thread. 7 // This class lives on the UI thread.
8 8
9 #ifndef CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_ 9 #ifndef CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_
10 #define CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_ 10 #define CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_
(...skipping 24 matching lines...) Expand all
35 // Should only be called by browser start up code. 35 // Should only be called by browser start up code.
36 // Use StorageMonitor::GetInstance() instead. 36 // Use StorageMonitor::GetInstance() instead.
37 StorageMonitorCros(); 37 StorageMonitorCros();
38 virtual ~StorageMonitorCros(); 38 virtual ~StorageMonitorCros();
39 39
40 // Sets up disk listeners and issues notifications for any discovered 40 // Sets up disk listeners and issues notifications for any discovered
41 // mount points. Sets up MTP manager and listeners. 41 // mount points. Sets up MTP manager and listeners.
42 void Init(); 42 void Init();
43 43
44 protected: 44 protected:
45 void SetMediaTransferProtocolManagerForTest(
46 device::MediaTransferProtocolManager* test_manager);
47
45 // disks::DiskMountManager::Observer implementation. 48 // disks::DiskMountManager::Observer implementation.
46 virtual void OnDiskEvent(disks::DiskMountManager::DiskEvent event, 49 virtual void OnDiskEvent(disks::DiskMountManager::DiskEvent event,
47 const disks::DiskMountManager::Disk* disk) OVERRIDE; 50 const disks::DiskMountManager::Disk* disk) OVERRIDE;
48 virtual void OnDeviceEvent(disks::DiskMountManager::DeviceEvent event, 51 virtual void OnDeviceEvent(disks::DiskMountManager::DeviceEvent event,
49 const std::string& device_path) OVERRIDE; 52 const std::string& device_path) OVERRIDE;
50 virtual void OnMountEvent( 53 virtual void OnMountEvent(
51 disks::DiskMountManager::MountEvent event, 54 disks::DiskMountManager::MountEvent event,
52 MountError error_code, 55 MountError error_code,
53 const disks::DiskMountManager::MountPointInfo& mount_info) OVERRIDE; 56 const disks::DiskMountManager::MountPointInfo& mount_info) OVERRIDE;
54 virtual void OnFormatEvent(disks::DiskMountManager::FormatEvent event, 57 virtual void OnFormatEvent(disks::DiskMountManager::FormatEvent event,
55 FormatError error_code, 58 FormatError error_code,
56 const std::string& device_path) OVERRIDE; 59 const std::string& device_path) OVERRIDE;
57 60
58 // StorageMonitor implementation. 61 // StorageMonitor implementation.
59 virtual bool GetStorageInfoForPath( 62 virtual bool GetStorageInfoForPath(
60 const base::FilePath& path, 63 const base::FilePath& path,
61 chrome::StorageInfo* device_info) const OVERRIDE; 64 chrome::StorageInfo* device_info) const OVERRIDE;
62 virtual void EjectDevice( 65 virtual void EjectDevice(
63 const std::string& device_id, 66 const std::string& device_id,
64 base::Callback<void(EjectStatus)> callback) OVERRIDE; 67 base::Callback<void(EjectStatus)> callback) OVERRIDE;
68 virtual device::MediaTransferProtocolManager*
69 media_transfer_protocol_manager() OVERRIDE;
65 70
66 private: 71 private:
67 // Mapping of mount path to removable mass storage info. 72 // Mapping of mount path to removable mass storage info.
68 typedef std::map<std::string, chrome::StorageInfo> MountMap; 73 typedef std::map<std::string, chrome::StorageInfo> MountMap;
69 74
70 // Helper method that checks existing mount points to see if they are media 75 // Helper method that checks existing mount points to see if they are media
71 // devices. Eventually calls AddMountedPath for all mount points. 76 // devices. Eventually calls AddMountedPath for all mount points.
72 void CheckExistingMountPoints(); 77 void CheckExistingMountPoints();
73 78
74 // Adds the mount point in |mount_info| to |mount_map_| and send a media 79 // Adds the mount point in |mount_info| to |mount_map_| and send a media
75 // device attach notification. |has_dcim| is true if the attached device has 80 // device attach notification. |has_dcim| is true if the attached device has
76 // a DCIM folder. 81 // a DCIM folder.
77 void AddMountedPath(const disks::DiskMountManager::MountPointInfo& mount_info, 82 void AddMountedPath(const disks::DiskMountManager::MountPointInfo& mount_info,
78 bool has_dcim); 83 bool has_dcim);
79 84
80 // Mapping of relevant mount points and their corresponding mount devices. 85 // Mapping of relevant mount points and their corresponding mount devices.
81 MountMap mount_map_; 86 MountMap mount_map_;
82 87
88 scoped_ptr<device::MediaTransferProtocolManager>
89 media_transfer_protocol_manager_;
83 scoped_ptr<chrome::MediaTransferProtocolDeviceObserverLinux> 90 scoped_ptr<chrome::MediaTransferProtocolDeviceObserverLinux>
84 media_transfer_protocol_device_observer_; 91 media_transfer_protocol_device_observer_;
85 92
86 base::WeakPtrFactory<StorageMonitorCros> weak_ptr_factory_; 93 base::WeakPtrFactory<StorageMonitorCros> weak_ptr_factory_;
87 94
88 DISALLOW_COPY_AND_ASSIGN(StorageMonitorCros); 95 DISALLOW_COPY_AND_ASSIGN(StorageMonitorCros);
89 }; 96 };
90 97
91 } // namespace chromeos 98 } // namespace chromeos
92 99
93 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_ 100 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_
OLDNEW
« no previous file with comments | « chrome/browser/storage_monitor/storage_monitor.h ('k') | chrome/browser/storage_monitor/storage_monitor_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698