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

Unified Diff: chrome/browser/system_monitor/removable_device_notifications_mac.mm

Issue 10909259: Share MediaStorageUtil common code among platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win tests 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/system_monitor/removable_device_notifications_mac.mm
diff --git a/chrome/browser/system_monitor/removable_device_notifications_mac.mm b/chrome/browser/system_monitor/removable_device_notifications_mac.mm
index 85455e6a9ee9605c431db01c8093148700b868b0..185ae18ef727170cd51982aa4fd093ed6baea745 100644
--- a/chrome/browser/system_monitor/removable_device_notifications_mac.mm
+++ b/chrome/browser/system_monitor/removable_device_notifications_mac.mm
@@ -10,6 +10,9 @@ namespace chrome {
namespace {
+static RemovableDeviceNotificationsMac*
+ g_removable_device_notifications_mac = NULL;
+
void GetDiskInfoAndUpdateOnFileThread(
const base::WeakPtr<RemovableDeviceNotificationsMac>& notifications,
base::mac::ScopedCFTypeRef<CFDictionaryRef> dict,
@@ -45,6 +48,9 @@ void GetDiskInfoAndUpdate(
RemovableDeviceNotificationsMac::RemovableDeviceNotificationsMac() {
session_.reset(DASessionCreate(NULL));
+ DCHECK(!g_removable_device_notifications_mac);
+ g_removable_device_notifications_mac = this;
+
DASessionScheduleWithRunLoop(
session_, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);
@@ -69,10 +75,20 @@ RemovableDeviceNotificationsMac::RemovableDeviceNotificationsMac() {
}
RemovableDeviceNotificationsMac::~RemovableDeviceNotificationsMac() {
+ DCHECK_EQ(this, g_removable_device_notifications_mac);
+ g_removable_device_notifications_mac = NULL;
+
DASessionUnscheduleFromRunLoop(
session_, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);
}
+// static
+RemovableDeviceNotificationsMac*
+RemovableDeviceNotificationsMac::GetInstance() {
+ DCHECK(g_removable_device_notifications_mac != NULL);
+ return g_removable_device_notifications_mac;
+}
+
void RemovableDeviceNotificationsMac::UpdateDisk(
const DiskInfoMac& info,
UpdateType update_type) {

Powered by Google App Engine
This is Rietveld 408576698