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

Side by Side Diff: chrome/browser/system_monitor/removable_device_notifications_chromeos.h

Issue 10917166: Extend the capability of SystemMonitor to support watching storage free space change (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Update and add unit test Created 8 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
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::RemovableDeviceNotificationsCros listens for mount point changes 5 // chromeos::RemovableDeviceNotificationsCros listens for mount point changes
6 // and notifies the SystemMonitor about the addition and deletion of media 6 // and notifies the SystemMonitor about the addition and deletion of media
7 // devices. 7 // devices.
8 8
9 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS_H_ 9 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS_H_
10 #define CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS_H_ 10 #define CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_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/ref_counted.h" 21 #include "base/memory/ref_counted.h"
22 #include "base/system_monitor/system_monitor.h" 22 #include "base/system_monitor/system_monitor.h"
23 #include "chromeos/disks/disk_mount_manager.h" 23 #include "chromeos/disks/disk_mount_manager.h"
24 24
25 namespace chromeos { 25 namespace chromeos {
26 26
27 class RemovableDeviceNotificationsCros 27 class RemovableDeviceNotificationsCros
28 : public base::RefCountedThreadSafe<RemovableDeviceNotificationsCros>, 28 : public base::RefCountedThreadSafe<RemovableDeviceNotificationsCros>,
29 public disks::DiskMountManager::Observer { 29 public disks::DiskMountManager::Observer {
30 public base::SystemMonitor::StorageFreeSpaceDelegate {
30 public: 31 public:
31 RemovableDeviceNotificationsCros(); 32 RemovableDeviceNotificationsCros();
32 33
33 virtual void DiskChanged(disks::DiskMountManagerEventType event, 34 virtual void DiskChanged(disks::DiskMountManagerEventType event,
34 const disks::DiskMountManager::Disk* disk) OVERRIDE; 35 const disks::DiskMountManager::Disk* disk) OVERRIDE;
35 virtual void DeviceChanged(disks::DiskMountManagerEventType event, 36 virtual void DeviceChanged(disks::DiskMountManagerEventType event,
36 const std::string& device_path) OVERRIDE; 37 const std::string& device_path) OVERRIDE;
37 virtual void MountCompleted( 38 virtual void MountCompleted(
38 disks::DiskMountManager::MountEvent event_type, 39 disks::DiskMountManager::MountEvent event_type,
39 MountError error_code, 40 MountError error_code,
(...skipping 17 matching lines...) Expand all
57 void CheckMountedPathOnFileThread( 58 void CheckMountedPathOnFileThread(
58 const disks::DiskMountManager::MountPointInfo& mount_info); 59 const disks::DiskMountManager::MountPointInfo& mount_info);
59 60
60 // Adds the mount point in |mount_info| to |mount_map_| and send a media 61 // Adds the mount point in |mount_info| to |mount_map_| and send a media
61 // device attach notification. |has_dcim| is true if the attached device has 62 // device attach notification. |has_dcim| is true if the attached device has
62 // a DCIM folder. 63 // a DCIM folder.
63 void AddMountedPathOnUIThread( 64 void AddMountedPathOnUIThread(
64 const disks::DiskMountManager::MountPointInfo& mount_info, 65 const disks::DiskMountManager::MountPointInfo& mount_info,
65 bool has_dcim); 66 bool has_dcim);
66 67
68 // Overriden from SystemMonitor::StorageFreeSpaceDelegate.
69 virtual void StartWatchingStorage(const FilePath& path) OVERRIDE;
70 virtual void StopWatchingStorage(const FilePath& path) OVERRIDE;
71
67 // Mapping of relevant mount points and their corresponding mount devices. 72 // Mapping of relevant mount points and their corresponding mount devices.
68 // Only accessed on the UI thread. 73 // Only accessed on the UI thread.
69 MountMap mount_map_; 74 MountMap mount_map_;
70 75
71 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsCros); 76 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsCros);
72 }; 77 };
73 78
74 } // namespace chromeos 79 } // namespace chromeos
75 80
76 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS _H_ 81 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698