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

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

Issue 12334096: Regularize ownerships and lifecycle for storage monitor platform classes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix comment name Created 7 years, 9 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::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 7
8 #ifndef CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_ 8 #ifndef CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_
9 #define CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_ 9 #define CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_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 "chrome/browser/storage_monitor/storage_monitor.h" 21 #include "chrome/browser/storage_monitor/storage_monitor.h"
22 #include "chromeos/disks/disk_mount_manager.h" 22 #include "chromeos/disks/disk_mount_manager.h"
23 23
24 namespace chrome {
25 class MediaTransferProtocolDeviceObserverLinux;
26 }
27
24 namespace chromeos { 28 namespace chromeos {
25 29
26 class StorageMonitorCros 30 class StorageMonitorCros
27 : public chrome::StorageMonitor, 31 : public chrome::StorageMonitor,
28 public base::RefCountedThreadSafe<StorageMonitorCros>, 32 public base::RefCountedThreadSafe<StorageMonitorCros>,
29 public disks::DiskMountManager::Observer { 33 public disks::DiskMountManager::Observer {
30 public: 34 public:
31 // Should only be called by browser start up code. Use GetInstance() instead. 35 // Should only be called by browser start up code. Use GetInstance() instead.
32 StorageMonitorCros(); 36 StorageMonitorCros();
33 37
38 // Sets up disk listeners and issues notifications for any discovered
39 // mount points. Sets up MTP manager and listeners.
40 void Init();
41
34 virtual void OnDiskEvent(disks::DiskMountManager::DiskEvent event, 42 virtual void OnDiskEvent(disks::DiskMountManager::DiskEvent event,
35 const disks::DiskMountManager::Disk* disk) OVERRIDE; 43 const disks::DiskMountManager::Disk* disk) OVERRIDE;
36 virtual void OnDeviceEvent(disks::DiskMountManager::DeviceEvent event, 44 virtual void OnDeviceEvent(disks::DiskMountManager::DeviceEvent event,
37 const std::string& device_path) OVERRIDE; 45 const std::string& device_path) OVERRIDE;
38 virtual void OnMountEvent( 46 virtual void OnMountEvent(
39 disks::DiskMountManager::MountEvent event, 47 disks::DiskMountManager::MountEvent event,
40 MountError error_code, 48 MountError error_code,
41 const disks::DiskMountManager::MountPointInfo& mount_info) OVERRIDE; 49 const disks::DiskMountManager::MountPointInfo& mount_info) OVERRIDE;
42 virtual void OnFormatEvent(disks::DiskMountManager::FormatEvent event, 50 virtual void OnFormatEvent(disks::DiskMountManager::FormatEvent event,
43 FormatError error_code, 51 FormatError error_code,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // device attach notification. |has_dcim| is true if the attached device has 83 // device attach notification. |has_dcim| is true if the attached device has
76 // a DCIM folder. 84 // a DCIM folder.
77 void AddMountedPathOnUIThread( 85 void AddMountedPathOnUIThread(
78 const disks::DiskMountManager::MountPointInfo& mount_info, 86 const disks::DiskMountManager::MountPointInfo& mount_info,
79 bool has_dcim); 87 bool has_dcim);
80 88
81 // Mapping of relevant mount points and their corresponding mount devices. 89 // Mapping of relevant mount points and their corresponding mount devices.
82 // Only accessed on the UI thread. 90 // Only accessed on the UI thread.
83 MountMap mount_map_; 91 MountMap mount_map_;
84 92
93 scoped_ptr<chrome::MediaTransferProtocolDeviceObserverLinux>
94 media_transfer_protocol_device_observer_;
95
85 DISALLOW_COPY_AND_ASSIGN(StorageMonitorCros); 96 DISALLOW_COPY_AND_ASSIGN(StorageMonitorCros);
86 }; 97 };
87 98
88 } // namespace chromeos 99 } // namespace chromeos
89 100
90 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_ 101 #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