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

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

Issue 10919185: Implement RemovableDeviceNotifications for Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix device id 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_MAC_H_
6 #define CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_MAC_H_
7
8 #include <DiskArbitration/DiskArbitration.h>
9 #include <map>
10
11 #include "base/mac/scoped_cftyperef.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/system_monitor/disk_info_mac.h"
14
15 namespace chrome {
16
17 // This class posts notifications to base::SystemMonitor when a new disk
18 // is attached, removed, or changed.
19 class RemovableDeviceNotificationsMac :
20 public base::SupportsWeakPtr<RemovableDeviceNotificationsMac> {
21 public:
22 enum UpdateAction {
23 UPDATE_SHOULD_REMOVE,
24 UPDATE_SHOULD_NOT_REMOVE,
25 };
26
27 RemovableDeviceNotificationsMac();
28 virtual ~RemovableDeviceNotificationsMac();
29
30 void UpdateDisk(const DiskInfoMac& info, UpdateAction update_action);
31
32 private:
33 static void DiskAppearedCallback(DADiskRef disk, void* context);
34 static void DiskDisappearedCallback(DADiskRef disk, void* context);
35 static void DiskDescriptionChangedCallback(DADiskRef disk,
36 CFArrayRef keys,
37 void *context);
38
39 bool ShouldPostNotificationForDisk(const DiskInfoMac& info) const;
40
41 base::mac::ScopedCFTypeRef<DASessionRef> session_;
42 // Maps disk bsd names to disk info objects. This map tracks all mountable
43 // devices on the system though only notifications for removable devices are
44 // posted.
45 std::map<std::string, DiskInfoMac> disk_info_map_;
46
47 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsMac);
48 };
49
50 } // namespace chrome
51
52 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698