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

Unified Diff: chrome/browser/media_gallery/media_galleries_dialog_controller.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/media_gallery/media_galleries_dialog_controller.cc
diff --git a/chrome/browser/media_gallery/media_galleries_dialog_controller.cc b/chrome/browser/media_gallery/media_galleries_dialog_controller.cc
index a5aabbbce25a7a96992e94257fcb7aa12dc8e251..546e3b5be22dfd8a31036f47a6d0a66931778fdc 100644
--- a/chrome/browser/media_gallery/media_galleries_dialog_controller.cc
+++ b/chrome/browser/media_gallery/media_galleries_dialog_controller.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/media_gallery/media_file_system_registry.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/system_monitor/media_storage_util.h"
+#include "chrome/browser/system_monitor/removable_storage_notifications.h"
#include "chrome/browser/ui/chrome_select_file_policy.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/extension.h"
@@ -28,8 +29,9 @@ bool IsAttachedDevice(const std::string& device_id) {
if (!MediaStorageUtil::IsRemovableDevice(device_id))
return false;
- std::vector<base::SystemMonitor::RemovableStorageInfo> removable_storages =
- base::SystemMonitor::Get()->GetAttachedRemovableStorage();
+ std::vector<chrome::RemovableStorageNotifications::StorageInfo>
vandebo (ex-Chrome) 2013/01/18 18:42:58 Would a using clause make this wrap nicer?
Greg Billock 2013/01/22 20:00:39 I think that's C++11 though.
vandebo (ex-Chrome) 2013/01/22 23:37:24 Nope, there's plenty of using directives in the co
Greg Billock 2013/01/23 00:28:01 Right. I meant 'using' for inner classes. I could
+ removable_storages = chrome::RemovableStorageNotifications::GetInstance()->
+ GetAttachedStorage();
for (size_t i = 0; i < removable_storages.size(); ++i) {
if (removable_storages[i].device_id == device_id)
return true;
@@ -54,9 +56,10 @@ MediaGalleriesDialogController::MediaGalleriesDialogController(
dialog_.reset(MediaGalleriesDialog::Create(this));
- base::SystemMonitor* monitor = base::SystemMonitor::Get();
- if (monitor)
- monitor->AddDevicesChangedObserver(this);
+ RemovableStorageNotifications* notifications =
+ RemovableStorageNotifications::GetInstance();
+ if (notifications)
+ notifications->AddObserver(this);
}
MediaGalleriesDialogController::MediaGalleriesDialogController()
@@ -65,9 +68,10 @@ MediaGalleriesDialogController::MediaGalleriesDialogController()
preferences_(NULL) {}
MediaGalleriesDialogController::~MediaGalleriesDialogController() {
- base::SystemMonitor* monitor = base::SystemMonitor::Get();
- if (monitor)
- monitor->RemoveDevicesChangedObserver(this);
+ RemovableStorageNotifications* notifications =
+ RemovableStorageNotifications::GetInstance();
+ if (notifications)
+ notifications->RemoveObserver(this);
if (select_folder_dialog_.get())
select_folder_dialog_->ListenerDestroyed();
@@ -204,15 +208,13 @@ void MediaGalleriesDialogController::FileSelected(const FilePath& path,
}
void MediaGalleriesDialogController::OnRemovableStorageAttached(
- const std::string& id,
- const string16& /*name*/,
- const FilePath::StringType& /*location*/) {
- UpdateGalleryOnDeviceEvent(id, true /* attached */);
+ const RemovableStorageNotifications::StorageInfo& info) {
+ UpdateGalleryOnDeviceEvent(info.device_id, true /* attached */);
}
void MediaGalleriesDialogController::OnRemovableStorageDetached(
- const std::string& id) {
- UpdateGalleryOnDeviceEvent(id, false /* detached */);
+ const RemovableStorageNotifications::StorageInfo& info) {
+ UpdateGalleryOnDeviceEvent(info.device_id, false /* detached */);
}
void MediaGalleriesDialogController::InitializePermissions() {

Powered by Google App Engine
This is Rietveld 408576698