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

Unified Diff: chrome/browser/media_gallery/media_file_system_registry.cc

Issue 11573048: [Media Galleries] Move RemovableStorageInfo notifications to chrome namespace (part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to head Created 7 years, 12 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/media_gallery/media_file_system_registry.cc
diff --git a/chrome/browser/media_gallery/media_file_system_registry.cc b/chrome/browser/media_gallery/media_file_system_registry.cc
index b7b6c8674317ad232e878723521fd4a07c63648b..4bc2d0867d96aa6afd2676a0f2f0ae11c0999e1d 100644
--- a/chrome/browser/media_gallery/media_file_system_registry.cc
+++ b/chrome/browser/media_gallery/media_file_system_registry.cc
@@ -16,7 +16,6 @@
#include "base/path_service.h"
#include "base/stl_util.h"
#include "base/string_util.h"
-#include "base/system_monitor/system_monitor.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -46,7 +45,6 @@
#include "webkit/fileapi/file_system_types.h"
#include "webkit/fileapi/isolated_context.h"
-using base::SystemMonitor;
using content::BrowserThread;
using content::NavigationController;
using content::RenderProcessHost;
@@ -474,12 +472,13 @@ MediaGalleriesPreferences* MediaFileSystemRegistry::GetPreferences(
if (ContainsKey(extension_hosts_map_, profile))
return preferences;
- // SystemMonitor may be NULL in unit tests.
- SystemMonitor* system_monitor = SystemMonitor::Get();
- if (!system_monitor)
+ // RemovableStorageNotifications may be NULL in unit tests.
+ RemovableStorageNotifications* notifications =
+ RemovableStorageNotifications::GetInstance();
+ if (!notifications)
return preferences;
- std::vector<SystemMonitor::RemovableStorageInfo> existing_devices =
- system_monitor->GetAttachedRemovableStorage();
+ std::vector<RemovableStorageNotifications::RemovableStorageInfo>
+ existing_devices = notifications->GetAttachedRemovableStorage();
for (size_t i = 0; i < existing_devices.size(); i++) {
if (!MediaStorageUtil::IsMediaDevice(existing_devices[i].device_id))
continue;
@@ -630,25 +629,27 @@ class MediaFileSystemRegistry::MediaFileSystemContextImpl
MediaFileSystemRegistry::MediaFileSystemRegistry()
: file_system_context_(new MediaFileSystemContextImpl(this)) {
- // SystemMonitor may be NULL in unit tests.
- SystemMonitor* system_monitor = SystemMonitor::Get();
- if (system_monitor) {
- system_monitor->AddDevicesChangedObserver(this);
+ // RemovableStorageNotifications may be NULL in unit tests.
+ RemovableStorageNotifications* notifications =
+ RemovableStorageNotifications::GetInstance();
+ if (notifications) {
+ notifications->AddRemovableStorageObserver(this);
// Add the devices that were already present before MediaFileSystemRegistry
// creation.
- std::vector<base::SystemMonitor::RemovableStorageInfo> storage_info =
- system_monitor->GetAttachedRemovableStorage();
+ std::vector<RemovableStorageNotifications::RemovableStorageInfo>
+ storage_info = notifications->GetAttachedRemovableStorage();
for (size_t i = 0; i < storage_info.size(); ++i)
transient_device_ids_.DeviceAttached(storage_info[i].device_id);
}
}
MediaFileSystemRegistry::~MediaFileSystemRegistry() {
- // SystemMonitor may be NULL in unit tests.
- SystemMonitor* system_monitor = SystemMonitor::Get();
- if (system_monitor)
- system_monitor->RemoveDevicesChangedObserver(this);
+ // RemovableStorageNotifications may be NULL in unit tests.
+ RemovableStorageNotifications* notifications =
+ RemovableStorageNotifications::GetInstance();
+ if (notifications)
+ notifications->RemoveRemovableStorageObserver(this);
#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
DCHECK(mtp_device_delegate_map_.empty());
#endif

Powered by Google App Engine
This is Rietveld 408576698