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

Unified Diff: chrome/browser/extensions/api/media_galleries_private/media_galleries_private_event_router.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: Make singleton pointer live in base class. Created 7 years, 11 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/extensions/api/media_galleries_private/media_galleries_private_event_router.cc
diff --git a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_event_router.cc b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_event_router.cc
index 479f4e08c173a5f65ec6909a6bde8902f335a36e..07637690242bef77467a2009da46ed8d1f4972d9 100644
--- a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_event_router.cc
+++ b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_event_router.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/media_gallery/media_file_system_registry.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/system_monitor/removable_storage_notifications.h"
#include "chrome/common/extensions/api/media_galleries_private.h"
#include "content/public/browser/browser_thread.h"
@@ -41,16 +42,18 @@ MediaGalleriesPrivateEventRouter::MediaGalleriesPrivateEventRouter(
: profile_(profile) {
DCHECK(profile_);
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- base::SystemMonitor* system_monitor = base::SystemMonitor::Get();
- if (system_monitor)
- system_monitor->AddDevicesChangedObserver(this);
+ chrome::RemovableStorageNotifications* notifications =
+ chrome::RemovableStorageNotifications::GetInstance();
+ if (notifications)
+ notifications->AddObserver(this);
}
MediaGalleriesPrivateEventRouter::~MediaGalleriesPrivateEventRouter() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- base::SystemMonitor* system_monitor = base::SystemMonitor::Get();
- if (system_monitor)
- system_monitor->RemoveDevicesChangedObserver(this);
+ chrome::RemovableStorageNotifications* notifications =
+ chrome::RemovableStorageNotifications::GetInstance();
+ if (notifications)
+ notifications->RemoveObserver(this);
}
void MediaGalleriesPrivateEventRouter::OnGalleryChanged(
@@ -83,9 +86,7 @@ void MediaGalleriesPrivateEventRouter::OnGalleryChanged(
}
void MediaGalleriesPrivateEventRouter::OnRemovableStorageAttached(
- const std::string& id,
- const string16& name,
- const FilePath::StringType& location) {
+ const chrome::RemovableStorageNotifications::StorageInfo& info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
EventRouter* router =
extensions::ExtensionSystem::Get(profile_)->event_router();
@@ -93,8 +94,8 @@ void MediaGalleriesPrivateEventRouter::OnRemovableStorageAttached(
return;
DeviceAttachmentDetails details;
- details.device_name = UTF16ToUTF8(name);
- details.device_id = GetTransientIdForDeviceId(id);
+ details.device_name = UTF16ToUTF8(info.name);
+ details.device_id = GetTransientIdForDeviceId(info.device_id);
scoped_ptr<base::ListValue> args(new base::ListValue());
args->Append(details.ToValue().release());
@@ -102,7 +103,7 @@ void MediaGalleriesPrivateEventRouter::OnRemovableStorageAttached(
}
void MediaGalleriesPrivateEventRouter::OnRemovableStorageDetached(
- const std::string& id) {
+ const chrome::RemovableStorageNotifications::StorageInfo& info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
EventRouter* router =
extensions::ExtensionSystem::Get(profile_)->event_router();
@@ -110,7 +111,7 @@ void MediaGalleriesPrivateEventRouter::OnRemovableStorageDetached(
return;
DeviceDetachmentDetails details;
- details.device_id = GetTransientIdForDeviceId(id);
+ details.device_id = GetTransientIdForDeviceId(info.device_id);
scoped_ptr<base::ListValue> args(new ListValue());
args->Append(details.ToValue().release());

Powered by Google App Engine
This is Rietveld 408576698