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

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

Issue 23727009: Cleanup: Remove chrome namespace for storage monitor and media galleries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nit Created 7 years, 3 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_
11 11
12 #if !defined(OS_CHROMEOS) 12 #if !defined(OS_CHROMEOS)
13 #error "Should only be used on ChromeOS." 13 #error "Should only be used on ChromeOS."
14 #endif 14 #endif
15 15
16 #include <map> 16 #include <map>
17 #include <string> 17 #include <string>
18 18
19 #include "base/basictypes.h" 19 #include "base/basictypes.h"
20 #include "base/compiler_specific.h" 20 #include "base/compiler_specific.h"
21 #include "base/memory/scoped_ptr.h" 21 #include "base/memory/scoped_ptr.h"
22 #include "base/memory/weak_ptr.h" 22 #include "base/memory/weak_ptr.h"
23 #include "chrome/browser/storage_monitor/storage_monitor.h" 23 #include "chrome/browser/storage_monitor/storage_monitor.h"
24 #include "chromeos/disks/disk_mount_manager.h" 24 #include "chromeos/disks/disk_mount_manager.h"
25 25
26 namespace chrome {
27 class MediaTransferProtocolDeviceObserverLinux; 26 class MediaTransferProtocolDeviceObserverLinux;
28 }
29 27
30 namespace chromeos { 28 namespace chromeos {
31 29
32 class StorageMonitorCros : public chrome::StorageMonitor, 30 class StorageMonitorCros : public StorageMonitor,
33 public disks::DiskMountManager::Observer { 31 public disks::DiskMountManager::Observer {
34 public: 32 public:
35 // Should only be called by browser start up code. 33 // Should only be called by browser start up code.
36 // Use StorageMonitor::GetInstance() instead. 34 // Use StorageMonitor::GetInstance() instead.
37 StorageMonitorCros(); 35 StorageMonitorCros();
38 virtual ~StorageMonitorCros(); 36 virtual ~StorageMonitorCros();
39 37
40 // Sets up disk listeners and issues notifications for any discovered 38 // Sets up disk listeners and issues notifications for any discovered
41 // mount points. Sets up MTP manager and listeners. 39 // mount points. Sets up MTP manager and listeners.
42 virtual void Init() OVERRIDE; 40 virtual void Init() OVERRIDE;
43 41
44 protected: 42 protected:
45 void SetMediaTransferProtocolManagerForTest( 43 void SetMediaTransferProtocolManagerForTest(
46 device::MediaTransferProtocolManager* test_manager); 44 device::MediaTransferProtocolManager* test_manager);
47 45
48 // disks::DiskMountManager::Observer implementation. 46 // disks::DiskMountManager::Observer implementation.
49 virtual void OnDiskEvent(disks::DiskMountManager::DiskEvent event, 47 virtual void OnDiskEvent(disks::DiskMountManager::DiskEvent event,
50 const disks::DiskMountManager::Disk* disk) OVERRIDE; 48 const disks::DiskMountManager::Disk* disk) OVERRIDE;
51 virtual void OnDeviceEvent(disks::DiskMountManager::DeviceEvent event, 49 virtual void OnDeviceEvent(disks::DiskMountManager::DeviceEvent event,
52 const std::string& device_path) OVERRIDE; 50 const std::string& device_path) OVERRIDE;
53 virtual void OnMountEvent( 51 virtual void OnMountEvent(
54 disks::DiskMountManager::MountEvent event, 52 disks::DiskMountManager::MountEvent event,
55 MountError error_code, 53 MountError error_code,
56 const disks::DiskMountManager::MountPointInfo& mount_info) OVERRIDE; 54 const disks::DiskMountManager::MountPointInfo& mount_info) OVERRIDE;
57 virtual void OnFormatEvent(disks::DiskMountManager::FormatEvent event, 55 virtual void OnFormatEvent(disks::DiskMountManager::FormatEvent event,
58 FormatError error_code, 56 FormatError error_code,
59 const std::string& device_path) OVERRIDE; 57 const std::string& device_path) OVERRIDE;
60 58
61 // StorageMonitor implementation. 59 // StorageMonitor implementation.
62 virtual bool GetStorageInfoForPath( 60 virtual bool GetStorageInfoForPath(const base::FilePath& path,
63 const base::FilePath& path, 61 StorageInfo* device_info) const OVERRIDE;
64 chrome::StorageInfo* device_info) const OVERRIDE;
65 virtual void EjectDevice( 62 virtual void EjectDevice(
66 const std::string& device_id, 63 const std::string& device_id,
67 base::Callback<void(EjectStatus)> callback) OVERRIDE; 64 base::Callback<void(EjectStatus)> callback) OVERRIDE;
68 virtual device::MediaTransferProtocolManager* 65 virtual device::MediaTransferProtocolManager*
69 media_transfer_protocol_manager() OVERRIDE; 66 media_transfer_protocol_manager() OVERRIDE;
70 67
71 private: 68 private:
72 // Mapping of mount path to removable mass storage info. 69 // Mapping of mount path to removable mass storage info.
73 typedef std::map<std::string, chrome::StorageInfo> MountMap; 70 typedef std::map<std::string, StorageInfo> MountMap;
74 71
75 // Helper method that checks existing mount points to see if they are media 72 // Helper method that checks existing mount points to see if they are media
76 // devices. Eventually calls AddMountedPath for all mount points. 73 // devices. Eventually calls AddMountedPath for all mount points.
77 void CheckExistingMountPoints(); 74 void CheckExistingMountPoints();
78 75
79 // Adds the mount point in |mount_info| to |mount_map_| and send a media 76 // Adds the mount point in |mount_info| to |mount_map_| and send a media
80 // device attach notification. |has_dcim| is true if the attached device has 77 // device attach notification. |has_dcim| is true if the attached device has
81 // a DCIM folder. 78 // a DCIM folder.
82 void AddMountedPath(const disks::DiskMountManager::MountPointInfo& mount_info, 79 void AddMountedPath(const disks::DiskMountManager::MountPointInfo& mount_info,
83 bool has_dcim); 80 bool has_dcim);
84 81
85 // Mapping of relevant mount points and their corresponding mount devices. 82 // Mapping of relevant mount points and their corresponding mount devices.
86 MountMap mount_map_; 83 MountMap mount_map_;
87 84
88 scoped_ptr<device::MediaTransferProtocolManager> 85 scoped_ptr<device::MediaTransferProtocolManager>
89 media_transfer_protocol_manager_; 86 media_transfer_protocol_manager_;
90 scoped_ptr<chrome::MediaTransferProtocolDeviceObserverLinux> 87 scoped_ptr<MediaTransferProtocolDeviceObserverLinux>
91 media_transfer_protocol_device_observer_; 88 media_transfer_protocol_device_observer_;
92 89
93 base::WeakPtrFactory<StorageMonitorCros> weak_ptr_factory_; 90 base::WeakPtrFactory<StorageMonitorCros> weak_ptr_factory_;
94 91
95 DISALLOW_COPY_AND_ASSIGN(StorageMonitorCros); 92 DISALLOW_COPY_AND_ASSIGN(StorageMonitorCros);
96 }; 93 };
97 94
98 } // namespace chromeos 95 } // namespace chromeos
99 96
100 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_ 97 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_
OLDNEW
« no previous file with comments | « chrome/browser/storage_monitor/storage_monitor.cc ('k') | chrome/browser/storage_monitor/storage_monitor_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698