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

Side by Side Diff: chrome/browser/system_monitor/media_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: 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::MediaDeviceNotifications listens for mount point changes and 5 // chromeos::MediaDeviceNotifications listens for mount point changes and
6 // notifies the SystemMonitor about the addition and deletion of media devices. 6 // notifies the SystemMonitor about the addition and deletion of media devices.
7 7
8 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_MEDIA_DEVICE_NOTIFICATIONS_CHROMEOS_H_ 8 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_MEDIA_DEVICE_NOTIFICATIONS_CHROMEOS_H_
9 #define CHROME_BROWSER_SYSTEM_MONITOR_MEDIA_DEVICE_NOTIFICATIONS_CHROMEOS_H_ 9 #define CHROME_BROWSER_SYSTEM_MONITOR_MEDIA_DEVICE_NOTIFICATIONS_CHROMEOS_H_
10 10
11 #if !defined(OS_CHROMEOS) 11 #if !defined(OS_CHROMEOS)
12 #error "Should only be used on ChromeOS." 12 #error "Should only be used on ChromeOS."
13 #endif 13 #endif
14 14
15 #include <map> 15 #include <map>
16 #include <string> 16 #include <string>
17 17
18 #include "base/basictypes.h" 18 #include "base/basictypes.h"
19 #include "base/compiler_specific.h" 19 #include "base/compiler_specific.h"
20 #include "base/memory/ref_counted.h" 20 #include "base/memory/ref_counted.h"
21 #include "base/system_monitor/system_monitor.h" 21 #include "base/system_monitor/system_monitor.h"
22 #include "chromeos/disks/disk_mount_manager.h" 22 #include "chromeos/disks/disk_mount_manager.h"
23 23
24 namespace chromeos { 24 namespace chromeos {
25 25
26 class MediaDeviceNotifications 26 class MediaDeviceNotifications
27 : public base::RefCountedThreadSafe<MediaDeviceNotifications>, 27 : public base::RefCountedThreadSafe<MediaDeviceNotifications>,
28 public disks::DiskMountManager::Observer { 28 public disks::DiskMountManager::Observer,
29 public base::SystemMonitor::StorageFreeSpaceDelegate {
29 public: 30 public:
30 MediaDeviceNotifications(); 31 MediaDeviceNotifications();
31 32
32 virtual void DiskChanged(disks::DiskMountManagerEventType event, 33 virtual void DiskChanged(disks::DiskMountManagerEventType event,
33 const disks::DiskMountManager::Disk* disk) OVERRIDE; 34 const disks::DiskMountManager::Disk* disk) OVERRIDE;
34 virtual void DeviceChanged(disks::DiskMountManagerEventType event, 35 virtual void DeviceChanged(disks::DiskMountManagerEventType event,
35 const std::string& device_path) OVERRIDE; 36 const std::string& device_path) OVERRIDE;
36 virtual void MountCompleted( 37 virtual void MountCompleted(
37 disks::DiskMountManager::MountEvent event_type, 38 disks::DiskMountManager::MountEvent event_type,
38 MountError error_code, 39 MountError error_code,
(...skipping 15 matching lines...) Expand all
54 // Checks if the mount point in |mount_info| is a media device. If it is, 55 // Checks if the mount point in |mount_info| is a media device. If it is,
55 // then continue with AddMountedPathOnUIThread() below. 56 // then continue with AddMountedPathOnUIThread() below.
56 void CheckMountedPathOnFileThread( 57 void CheckMountedPathOnFileThread(
57 const disks::DiskMountManager::MountPointInfo& mount_info); 58 const disks::DiskMountManager::MountPointInfo& mount_info);
58 59
59 // Adds the mount point in |mount_info| to |mount_map_| and send a media 60 // Adds the mount point in |mount_info| to |mount_map_| and send a media
60 // device attach notification. 61 // device attach notification.
61 void AddMountedPathOnUIThread( 62 void AddMountedPathOnUIThread(
62 const disks::DiskMountManager::MountPointInfo& mount_info); 63 const disks::DiskMountManager::MountPointInfo& mount_info);
63 64
65 // Overriden from SystemMonitor::StorageFreeSpaceDelegate.
66 virtual bool StartWatchingStorage(const FilePath::StringType& path) OVERRIDE;
67 virtual bool StopWatchingStorage(const FilePath::StringType& path) OVERRIDE;
68
64 // Mapping of relevant mount points and their corresponding mount devices. 69 // Mapping of relevant mount points and their corresponding mount devices.
65 // Only accessed on the UI thread. 70 // Only accessed on the UI thread.
66 MountMap mount_map_; 71 MountMap mount_map_;
67 72
68 DISALLOW_COPY_AND_ASSIGN(MediaDeviceNotifications); 73 DISALLOW_COPY_AND_ASSIGN(MediaDeviceNotifications);
69 }; 74 };
70 75
71 } // namespace chromeos 76 } // namespace chromeos
72 77
73 #endif // CHROME_BROWSER_SYSTEM_MONITOR_MEDIA_DEVICE_NOTIFICATIONS_CHROMEOS_H_ 78 #endif // CHROME_BROWSER_SYSTEM_MONITOR_MEDIA_DEVICE_NOTIFICATIONS_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698