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

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 threading 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 RemovableDeviceNotificationsMac();
23 virtual ~RemovableDeviceNotificationsMac();
24
vandebo (ex-Chrome) 2012/09/10 18:45:03 It's not part of the System Monitor interface, but
vandebo (ex-Chrome) 2012/09/11 00:45:50 Would it be hard to do this?
sail 2012/09/11 03:02:00 Done. Oops, sorry I missed this earlier. I added t
25 void UpdateDisk(const DiskInfoMac& info, bool should_remove);
Nico 2012/09/10 07:02:34 nit: enums are more readable than bools
sail 2012/09/10 21:58:43 Done.
26
27 private:
28 static void DiskAppearedCallback(DADiskRef disk, void* context);
29 static void DiskDisappearedCallback(DADiskRef disk, void* context);
30 static void DiskDescriptionChangedCallback(DADiskRef disk,
31 CFArrayRef keys,
32 void *context);
33
34 bool ShouldPostNotificationForDisk(const DiskInfoMac& info) const;
35
36 base::mac::ScopedCFTypeRef<DASessionRef> session_;
37 std::map<std::string, DiskInfoMac> disk_info_map_;
vandebo (ex-Chrome) 2012/09/10 18:45:03 nit: document what's in the map, i.e. what is the
vandebo (ex-Chrome) 2012/09/10 18:45:03 Does this track all devices on the system, or just
sail 2012/09/10 21:58:43 Done.
sail 2012/09/10 21:58:43 It tracks all mountable devices. Added a comment a
38
39 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsMac);
40 };
41
42 } // namespace chrome
43
44 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698