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

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

Issue 11573048: [Media Galleries] Move RemovableStorageInfo notifications to chrome namespace (part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Working on windows Created 7 years, 10 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::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 listeners 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"
23 #include "chrome/browser/system_monitor/removable_storage_notifications.h" 22 #include "chrome/browser/system_monitor/removable_storage_notifications.h"
24 #include "chromeos/disks/disk_mount_manager.h" 23 #include "chromeos/disks/disk_mount_manager.h"
25 24
26 namespace chromeos { 25 namespace chromeos {
27 26
28 class RemovableDeviceNotificationsCros 27 class RemovableDeviceNotificationsCros
29 : public chrome::RemovableStorageNotifications, 28 : public chrome::RemovableStorageNotifications,
30 public base::RefCountedThreadSafe<RemovableDeviceNotificationsCros>, 29 public base::RefCountedThreadSafe<RemovableDeviceNotificationsCros>,
31 public disks::DiskMountManager::Observer { 30 public disks::DiskMountManager::Observer {
32 public: 31 public:
33 // Should only be called by browser start up code. Use GetInstance() instead. 32 // Should only be called by browser start up code. Use GetInstance() instead.
34 RemovableDeviceNotificationsCros(); 33 RemovableDeviceNotificationsCros();
35 34
36 virtual void OnDiskEvent(disks::DiskMountManager::DiskEvent event, 35 virtual void OnDiskEvent(disks::DiskMountManager::DiskEvent event,
37 const disks::DiskMountManager::Disk* disk) OVERRIDE; 36 const disks::DiskMountManager::Disk* disk) OVERRIDE;
38 virtual void OnDeviceEvent(disks::DiskMountManager::DeviceEvent event, 37 virtual void OnDeviceEvent(disks::DiskMountManager::DeviceEvent event,
39 const std::string& device_path) OVERRIDE; 38 const std::string& device_path) OVERRIDE;
40 virtual void OnMountEvent( 39 virtual void OnMountEvent(
41 disks::DiskMountManager::MountEvent event, 40 disks::DiskMountManager::MountEvent event,
42 MountError error_code, 41 MountError error_code,
43 const disks::DiskMountManager::MountPointInfo& mount_info) OVERRIDE; 42 const disks::DiskMountManager::MountPointInfo& mount_info) OVERRIDE;
44 virtual void OnFormatEvent(disks::DiskMountManager::FormatEvent event, 43 virtual void OnFormatEvent(disks::DiskMountManager::FormatEvent event,
45 FormatError error_code, 44 FormatError error_code,
46 const std::string& device_path) OVERRIDE; 45 const std::string& device_path) OVERRIDE;
47 46
48 // Finds the device that contains |path| and populates |device_info|. 47 // Finds the device that contains |path| and populates |device_info|.
49 // Returns false if unable to find the device. 48 // Returns false if unable to find the device.
50 virtual bool GetDeviceInfoForPath( 49 virtual bool GetDeviceInfoForPath(
51 const FilePath& path, 50 const FilePath& path,
52 base::SystemMonitor::RemovableStorageInfo* device_info) const OVERRIDE; 51 StorageInfo* device_info) const OVERRIDE;
53 52
54 // Returns the storage size of the device present at |location|. If the 53 // Returns the storage size of the device present at |location|. If the
55 // device information is unavailable, returns zero. 54 // device information is unavailable, returns zero.
56 virtual uint64 GetStorageSize(const std::string& location) const OVERRIDE; 55 virtual uint64 GetStorageSize(const std::string& location) const OVERRIDE;
57 56
58 private: 57 private:
59 struct StorageObjectInfo { 58 struct StorageObjectInfo {
60 // Basic details {storage device name, location and identifier}. 59 // Basic details {storage device name, location and identifier}.
61 base::SystemMonitor::RemovableStorageInfo storage_info; 60 StorageInfo storage_info;
62 61
63 // Device storage size. 62 // Device storage size.
64 uint64 storage_size_in_bytes; 63 uint64 storage_size_in_bytes;
65 }; 64 };
66 65
67 friend class base::RefCountedThreadSafe<RemovableDeviceNotificationsCros>; 66 friend class base::RefCountedThreadSafe<RemovableDeviceNotificationsCros>;
68 67
69 // Mapping of mount path to removable mass storage info. 68 // Mapping of mount path to removable mass storage info.
70 typedef std::map<std::string, StorageObjectInfo> MountMap; 69 typedef std::map<std::string, StorageObjectInfo> MountMap;
71 70
(...skipping 19 matching lines...) Expand all
91 // Mapping of relevant mount points and their corresponding mount devices. 90 // Mapping of relevant mount points and their corresponding mount devices.
92 // Only accessed on the UI thread. 91 // Only accessed on the UI thread.
93 MountMap mount_map_; 92 MountMap mount_map_;
94 93
95 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsCros); 94 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsCros);
96 }; 95 };
97 96
98 } // namespace chromeos 97 } // namespace chromeos
99 98
100 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS _H_ 99 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698