summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_process_impl.cc4
-rw-r--r--chrome/browser/chromeos/camera_detector.cc2
-rw-r--r--chrome/browser/extensions/api/media_galleries/media_galleries_api.cc2
-rw-r--r--chrome/browser/extensions/api/media_galleries/media_galleries_api.h5
-rw-r--r--chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc2
-rw-r--r--chrome/browser/extensions/api/media_galleries_private/media_galleries_private_apitest.cc4
-rw-r--r--chrome/browser/extensions/api/media_galleries_private/media_galleries_private_event_router.cc6
-rw-r--r--chrome/browser/extensions/api/media_galleries_private/media_galleries_private_event_router.h8
-rw-r--r--chrome/browser/extensions/api/system_info/system_info_api.cc13
-rw-r--r--chrome/browser/extensions/api/system_storage/storage_api_test_util.cc4
-rw-r--r--chrome/browser/extensions/api/system_storage/storage_api_test_util.h2
-rw-r--r--chrome/browser/extensions/api/system_storage/storage_info_provider.cc4
-rw-r--r--chrome/browser/extensions/api/system_storage/storage_info_provider.h7
-rw-r--r--chrome/browser/extensions/api/system_storage/system_storage_api.cc2
-rw-r--r--chrome/browser/extensions/api/system_storage/system_storage_api.h2
-rw-r--r--chrome/browser/extensions/api/system_storage/system_storage_apitest.cc3
-rw-r--r--chrome/browser/extensions/api/system_storage/system_storage_eject_apitest.cc2
-rw-r--r--chrome/browser/media_galleries/fileapi/iapps_finder_impl.cc7
-rw-r--r--chrome/browser/media_galleries/fileapi/iapps_finder_impl.h3
-rw-r--r--chrome/browser/media_galleries/fileapi/iapps_finder_impl_mac.mm4
-rw-r--r--chrome/browser/media_galleries/fileapi/iapps_finder_impl_win.cc2
-rw-r--r--chrome/browser/media_galleries/fileapi/picasa_finder.cc4
-rw-r--r--chrome/browser/media_galleries/linux/mtp_device_task_helper.cc2
-rw-r--r--chrome/browser/media_galleries/linux/mtp_read_file_worker.cc1
-rw-r--r--chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.mm12
-rw-r--r--chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm7
-rw-r--r--chrome/browser/media_galleries/media_file_system_registry.cc3
-rw-r--r--chrome/browser/media_galleries/media_file_system_registry.h5
-rw-r--r--chrome/browser/media_galleries/media_file_system_registry_unittest.cc6
-rw-r--r--chrome/browser/media_galleries/media_folder_finder.cc3
-rw-r--r--chrome/browser/media_galleries/media_galleries_dialog_controller.cc2
-rw-r--r--chrome/browser/media_galleries/media_galleries_dialog_controller.h8
-rw-r--r--chrome/browser/media_galleries/media_galleries_dialog_controller_unittest.cc3
-rw-r--r--chrome/browser/media_galleries/media_galleries_permissions_unittest.cc4
-rw-r--r--chrome/browser/media_galleries/media_galleries_preferences.cc3
-rw-r--r--chrome/browser/media_galleries/media_galleries_preferences.h45
-rw-r--r--chrome/browser/media_galleries/media_galleries_preferences_unittest.cc3
-rw-r--r--chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.cc3
-rw-r--r--chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.h8
-rw-r--r--chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller_unittest.cc6
-rw-r--r--chrome/browser/media_galleries/media_scan_manager_unittest.cc6
-rw-r--r--chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc3
-rw-r--r--chrome/browser/media_galleries/win/mtp_device_delegate_impl_win_unittest.cc8
-rw-r--r--chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_unittest.mm6
-rw-r--r--chrome/browser/ui/cocoa/extensions/media_galleries_scan_result_dialog_cocoa_unittest.mm4
-rw-r--r--chrome/browser/ui/gtk/extensions/media_galleries_dialog_gtk_unittest.cc5
-rw-r--r--chrome/browser/ui/views/extensions/media_galleries_dialog_views_unittest.cc5
-rw-r--r--chrome/browser/ui/webui/options/media_galleries_handler.cc4
-rw-r--r--chrome/test/base/in_process_browser_test.cc2
-rw-r--r--components/storage_monitor/image_capture_device.h9
-rw-r--r--components/storage_monitor/image_capture_device.mm23
-rw-r--r--components/storage_monitor/image_capture_device_manager.h4
-rw-r--r--components/storage_monitor/image_capture_device_manager.mm25
-rw-r--r--components/storage_monitor/image_capture_device_manager_unittest.mm4
-rw-r--r--components/storage_monitor/media_storage_util.cc4
-rw-r--r--components/storage_monitor/media_storage_util.h4
-rw-r--r--components/storage_monitor/media_storage_util_unittest.cc4
-rw-r--r--components/storage_monitor/media_transfer_protocol_device_observer_linux.cc4
-rw-r--r--components/storage_monitor/media_transfer_protocol_device_observer_linux.h4
-rw-r--r--components/storage_monitor/media_transfer_protocol_device_observer_linux_unittest.cc4
-rw-r--r--components/storage_monitor/mock_removable_storage_observer.cc4
-rw-r--r--components/storage_monitor/mock_removable_storage_observer.h4
-rw-r--r--components/storage_monitor/mtab_watcher_linux.cc4
-rw-r--r--components/storage_monitor/mtab_watcher_linux.h4
-rw-r--r--components/storage_monitor/portable_device_watcher_win.cc4
-rw-r--r--components/storage_monitor/portable_device_watcher_win.h4
-rw-r--r--components/storage_monitor/removable_device_constants.cc4
-rw-r--r--components/storage_monitor/removable_device_constants.h4
-rw-r--r--components/storage_monitor/removable_storage_observer.h4
-rw-r--r--components/storage_monitor/storage_info.cc4
-rw-r--r--components/storage_monitor/storage_info.h4
-rw-r--r--components/storage_monitor/storage_info_unittest.cc4
-rw-r--r--components/storage_monitor/storage_monitor.cc4
-rw-r--r--components/storage_monitor/storage_monitor.h9
-rw-r--r--components/storage_monitor/storage_monitor_chromeos.cc81
-rw-r--r--components/storage_monitor/storage_monitor_chromeos.h45
-rw-r--r--components/storage_monitor/storage_monitor_chromeos_unittest.cc253
-rw-r--r--components/storage_monitor/storage_monitor_linux.cc5
-rw-r--r--components/storage_monitor/storage_monitor_linux.h4
-rw-r--r--components/storage_monitor/storage_monitor_linux_unittest.cc4
-rw-r--r--components/storage_monitor/storage_monitor_mac.h4
-rw-r--r--components/storage_monitor/storage_monitor_mac.mm4
-rw-r--r--components/storage_monitor/storage_monitor_mac_unittest.mm4
-rw-r--r--components/storage_monitor/storage_monitor_unittest.cc4
-rw-r--r--components/storage_monitor/storage_monitor_win.cc4
-rw-r--r--components/storage_monitor/storage_monitor_win.h4
-rw-r--r--components/storage_monitor/storage_monitor_win_unittest.cc4
-rw-r--r--components/storage_monitor/test_media_transfer_protocol_manager_linux.cc4
-rw-r--r--components/storage_monitor/test_media_transfer_protocol_manager_linux.h4
-rw-r--r--components/storage_monitor/test_portable_device_watcher_win.cc4
-rw-r--r--components/storage_monitor/test_portable_device_watcher_win.h4
-rw-r--r--components/storage_monitor/test_storage_monitor.cc4
-rw-r--r--components/storage_monitor/test_storage_monitor.h4
-rw-r--r--components/storage_monitor/test_storage_monitor_win.cc4
-rw-r--r--components/storage_monitor/test_storage_monitor_win.h4
-rw-r--r--components/storage_monitor/test_volume_mount_watcher_win.cc4
-rw-r--r--components/storage_monitor/test_volume_mount_watcher_win.h4
-rw-r--r--components/storage_monitor/transient_device_ids.cc4
-rw-r--r--components/storage_monitor/transient_device_ids.h4
-rw-r--r--components/storage_monitor/udev_util_linux.cc4
-rw-r--r--components/storage_monitor/udev_util_linux.h4
-rw-r--r--components/storage_monitor/volume_mount_watcher_win.cc4
-rw-r--r--components/storage_monitor/volume_mount_watcher_win.h4
103 files changed, 628 insertions, 265 deletions
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 39be6e1..9ecbacfb 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -262,7 +262,7 @@ void BrowserProcessImpl::StartTearDown() {
// FILE thread would be gone when we try to release it in the dtor and
// Valgrind would report a leak on almost every single browser_test.
// TODO(gbillock): Make this unnecessary.
- StorageMonitor::Destroy();
+ storage_monitor::StorageMonitor::Destroy();
#endif
message_center::MessageCenter::Shutdown();
@@ -944,7 +944,7 @@ void BrowserProcessImpl::PreMainMessageLoopRun() {
#endif
#if !defined(OS_ANDROID) && !defined(OS_IOS)
- StorageMonitor::Create();
+ storage_monitor::StorageMonitor::Create();
#endif
platform_part_->PreMainMessageLoopRun();
diff --git a/chrome/browser/chromeos/camera_detector.cc b/chrome/browser/chromeos/camera_detector.cc
index fadc7ac..6cce585 100644
--- a/chrome/browser/chromeos/camera_detector.cc
+++ b/chrome/browser/chromeos/camera_detector.cc
@@ -73,7 +73,7 @@ bool CameraDetector::CheckPresence() {
for (base::FilePath path = file_enum.Next(); !path.empty();
path = file_enum.Next()) {
std::string v4l_capabilities;
- if (GetUdevDevicePropertyValueByPath(
+ if (storage_monitor::GetUdevDevicePropertyValueByPath(
path, kV4LCapabilities, &v4l_capabilities)) {
std::vector<std::string> caps;
base::SplitString(v4l_capabilities, kV4LCapabilitiesDelim, &caps);
diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
index 3cb0d93..e9b719e 100644
--- a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
+++ b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
@@ -55,6 +55,8 @@
#include "ui/base/l10n/l10n_util.h"
using content::WebContents;
+using storage_monitor::MediaStorageUtil;
+using storage_monitor::StorageInfo;
using web_modal::WebContentsModalDialogManager;
namespace extensions {
diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_api.h b/chrome/browser/extensions/api/media_galleries/media_galleries_api.h
index 50f611b..6ce77af 100644
--- a/chrome/browser/extensions/api/media_galleries/media_galleries_api.h
+++ b/chrome/browser/extensions/api/media_galleries/media_galleries_api.h
@@ -141,8 +141,9 @@ class MediaGalleriesGetAllMediaFileSystemMetadataFunction
// Callback to run upon getting the list of available devices.
// Sends the list of media filesystem metadata back to the extension.
- void OnGetGalleries(const MediaGalleryPrefIdSet& permitted_gallery_ids,
- const MediaStorageUtil::DeviceIdSet* available_devices);
+ void OnGetGalleries(
+ const MediaGalleryPrefIdSet& permitted_gallery_ids,
+ const storage_monitor::MediaStorageUtil::DeviceIdSet* available_devices);
};
class MediaGalleriesAddUserSelectedFolderFunction
diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc b/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc
index b36cce98..9cbd5f4 100644
--- a/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc
+++ b/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc
@@ -44,6 +44,8 @@
#endif // OS_MACOSX
using extensions::PlatformAppBrowserTest;
+using storage_monitor::StorageInfo;
+using storage_monitor::StorageMonitor;
namespace {
diff --git a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_apitest.cc b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_apitest.cc
index bfb1ed3..a2511b1 100644
--- a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_apitest.cc
+++ b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_apitest.cc
@@ -21,6 +21,10 @@
#include "extensions/common/extension.h"
#include "url/gurl.h"
+using storage_monitor::StorageInfo;
+using storage_monitor::StorageMonitor;
+using storage_monitor::TestStorageMonitor;
+
namespace {
// Id of test extension from
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 8b22d46..7a86a39 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
@@ -18,6 +18,8 @@
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_system.h"
+using storage_monitor::StorageMonitor;
+
namespace media_galleries_private = extensions::api::media_galleries_private;
namespace extensions {
@@ -82,7 +84,7 @@ void MediaGalleriesPrivateEventRouter::OnGalleryChanged(
}
void MediaGalleriesPrivateEventRouter::OnRemovableStorageAttached(
- const StorageInfo& info) {
+ const storage_monitor::StorageInfo& info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
EventRouter* router =
extensions::ExtensionSystem::Get(profile_)->event_router();
@@ -111,7 +113,7 @@ void MediaGalleriesPrivateEventRouter::OnRemovableStorageAttached(
}
void MediaGalleriesPrivateEventRouter::OnRemovableStorageDetached(
- const StorageInfo& info) {
+ const storage_monitor::StorageInfo& info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
EventRouter* router =
extensions::ExtensionSystem::Get(profile_)->event_router();
diff --git a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_event_router.h b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_event_router.h
index ac8b403..948139e 100644
--- a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_event_router.h
+++ b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_event_router.h
@@ -28,7 +28,7 @@ class ListValue;
namespace extensions {
class MediaGalleriesPrivateEventRouter
- : public RemovableStorageObserver,
+ : public storage_monitor::RemovableStorageObserver,
public base::SupportsWeakPtr<MediaGalleriesPrivateEventRouter> {
public:
explicit MediaGalleriesPrivateEventRouter(Profile* profile);
@@ -40,8 +40,10 @@ class MediaGalleriesPrivateEventRouter
private:
// RemovableStorageObserver implementation.
- virtual void OnRemovableStorageAttached(const StorageInfo& info) OVERRIDE;
- virtual void OnRemovableStorageDetached(const StorageInfo& info) OVERRIDE;
+ virtual void OnRemovableStorageAttached(
+ const storage_monitor::StorageInfo& info) OVERRIDE;
+ virtual void OnRemovableStorageDetached(
+ const storage_monitor::StorageInfo& info) OVERRIDE;
void DispatchEvent(const std::string& event_name,
scoped_ptr<base::ListValue> event_args);
diff --git a/chrome/browser/extensions/api/system_info/system_info_api.cc b/chrome/browser/extensions/api/system_info/system_info_api.cc
index 90bde75..ca89224 100644
--- a/chrome/browser/extensions/api/system_info/system_info_api.cc
+++ b/chrome/browser/extensions/api/system_info/system_info_api.cc
@@ -33,6 +33,7 @@ namespace extensions {
using api::system_storage::StorageUnitInfo;
using content::BrowserThread;
+using storage_monitor::StorageMonitor;
namespace system_display = api::system_display;
namespace system_storage = api::system_storage;
@@ -53,7 +54,7 @@ bool IsSystemStorageEvent(const std::string& event_name) {
// Event router for systemInfo API. It is a singleton instance shared by
// multiple profiles.
class SystemInfoEventRouter : public gfx::DisplayObserver,
- public RemovableStorageObserver {
+ public storage_monitor::RemovableStorageObserver {
public:
static SystemInfoEventRouter* GetInstance();
@@ -71,8 +72,10 @@ class SystemInfoEventRouter : public gfx::DisplayObserver,
virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE;
// RemovableStorageObserver implementation.
- virtual void OnRemovableStorageAttached(const StorageInfo& info) OVERRIDE;
- virtual void OnRemovableStorageDetached(const StorageInfo& info) OVERRIDE;
+ virtual void OnRemovableStorageAttached(
+ const storage_monitor::StorageInfo& info) OVERRIDE;
+ virtual void OnRemovableStorageDetached(
+ const storage_monitor::StorageInfo& info) OVERRIDE;
// Called from any thread to dispatch the systemInfo event to all extension
// processes cross multiple profiles.
@@ -161,7 +164,7 @@ void SystemInfoEventRouter::RemoveEventListener(const std::string& event_name) {
}
void SystemInfoEventRouter::OnRemovableStorageAttached(
- const StorageInfo& info) {
+ const storage_monitor::StorageInfo& info) {
StorageUnitInfo unit;
systeminfo::BuildStorageUnitInfo(info, &unit);
scoped_ptr<base::ListValue> args(new base::ListValue);
@@ -170,7 +173,7 @@ void SystemInfoEventRouter::OnRemovableStorageAttached(
}
void SystemInfoEventRouter::OnRemovableStorageDetached(
- const StorageInfo& info) {
+ const storage_monitor::StorageInfo& info) {
scoped_ptr<base::ListValue> args(new base::ListValue);
std::string transient_id =
StorageMonitor::GetInstance()->GetTransientIdForDeviceId(
diff --git a/chrome/browser/extensions/api/system_storage/storage_api_test_util.cc b/chrome/browser/extensions/api/system_storage/storage_api_test_util.cc
index 3432768..2f594f5 100644
--- a/chrome/browser/extensions/api/system_storage/storage_api_test_util.cc
+++ b/chrome/browser/extensions/api/system_storage/storage_api_test_util.cc
@@ -13,9 +13,9 @@ const struct TestStorageUnitInfo kRemovableStorageData = {
"dcim:device:001", "/media/usb1", 4098, 1000
};
-StorageInfo BuildStorageInfoFromTestStorageUnitInfo(
+storage_monitor::StorageInfo BuildStorageInfoFromTestStorageUnitInfo(
const TestStorageUnitInfo& unit) {
- return StorageInfo(
+ return storage_monitor::StorageInfo(
unit.device_id,
base::UTF8ToUTF16(unit.name),
base::FilePath::StringType(), /* no location */
diff --git a/chrome/browser/extensions/api/system_storage/storage_api_test_util.h b/chrome/browser/extensions/api/system_storage/storage_api_test_util.h
index dd96616..18c1369 100644
--- a/chrome/browser/extensions/api/system_storage/storage_api_test_util.h
+++ b/chrome/browser/extensions/api/system_storage/storage_api_test_util.h
@@ -24,7 +24,7 @@ struct TestStorageUnitInfo {
extern const struct TestStorageUnitInfo kRemovableStorageData;
-StorageInfo BuildStorageInfoFromTestStorageUnitInfo(
+storage_monitor::StorageInfo BuildStorageInfoFromTestStorageUnitInfo(
const TestStorageUnitInfo& unit);
} // namespace test
diff --git a/chrome/browser/extensions/api/system_storage/storage_info_provider.cc b/chrome/browser/extensions/api/system_storage/storage_info_provider.cc
index 62bcc0a..9057c50 100644
--- a/chrome/browser/extensions/api/system_storage/storage_info_provider.cc
+++ b/chrome/browser/extensions/api/system_storage/storage_info_provider.cc
@@ -8,9 +8,13 @@
#include "base/strings/utf_string_conversions.h"
#include "base/sys_info.h"
#include "base/threading/sequenced_worker_pool.h"
+#include "components/storage_monitor/storage_info.h"
#include "components/storage_monitor/storage_monitor.h"
#include "content/public/browser/browser_thread.h"
+using storage_monitor::StorageInfo;
+using storage_monitor::StorageMonitor;
+
namespace extensions {
using content::BrowserThread;
diff --git a/chrome/browser/extensions/api/system_storage/storage_info_provider.h b/chrome/browser/extensions/api/system_storage/storage_info_provider.h
index 6074d20..b32554d 100644
--- a/chrome/browser/extensions/api/system_storage/storage_info_provider.h
+++ b/chrome/browser/extensions/api/system_storage/storage_info_provider.h
@@ -13,7 +13,10 @@
#include "base/timer/timer.h"
#include "chrome/browser/extensions/api/system_info/system_info_provider.h"
#include "chrome/common/extensions/api/system_storage.h"
-#include "components/storage_monitor/storage_info.h"
+
+namespace storage_monitor {
+class StorageInfo;
+}
namespace extensions {
@@ -21,7 +24,7 @@ namespace systeminfo {
// Build StorageUnitInfo struct from StorageInfo instance. The |unit|
// parameter is the output value.
-void BuildStorageUnitInfo(const StorageInfo& info,
+void BuildStorageUnitInfo(const storage_monitor::StorageInfo& info,
api::system_storage::StorageUnitInfo* unit);
} // namespace systeminfo
diff --git a/chrome/browser/extensions/api/system_storage/system_storage_api.cc b/chrome/browser/extensions/api/system_storage/system_storage_api.cc
index e374f63..c69c463 100644
--- a/chrome/browser/extensions/api/system_storage/system_storage_api.cc
+++ b/chrome/browser/extensions/api/system_storage/system_storage_api.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/extensions/api/system_storage/system_storage_api.h"
+using storage_monitor::StorageMonitor;
+
namespace extensions {
using api::system_storage::StorageUnitInfo;
diff --git a/chrome/browser/extensions/api/system_storage/system_storage_api.h b/chrome/browser/extensions/api/system_storage/system_storage_api.h
index cd6462e..b619809 100644
--- a/chrome/browser/extensions/api/system_storage/system_storage_api.h
+++ b/chrome/browser/extensions/api/system_storage/system_storage_api.h
@@ -41,7 +41,7 @@ class SystemStorageEjectDeviceFunction
void OnStorageMonitorInit(const std::string& transient_device_id);
// Eject device request handler.
- void HandleResponse(StorageMonitor::EjectStatus status);
+ void HandleResponse(storage_monitor::StorageMonitor::EjectStatus status);
};
class SystemStorageGetAvailableCapacityFunction
diff --git a/chrome/browser/extensions/api/system_storage/system_storage_apitest.cc b/chrome/browser/extensions/api/system_storage/system_storage_apitest.cc
index c9ca13f..ee08e99 100644
--- a/chrome/browser/extensions/api/system_storage/system_storage_apitest.cc
+++ b/chrome/browser/extensions/api/system_storage/system_storage_apitest.cc
@@ -10,7 +10,6 @@
#include "chrome/browser/extensions/api/system_storage/storage_info_provider.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
-#include "components/storage_monitor/storage_info.h"
#include "components/storage_monitor/storage_monitor.h"
#include "components/storage_monitor/test_storage_monitor.h"
@@ -19,6 +18,8 @@ namespace {
using extensions::StorageUnitInfoList;
using extensions::test::TestStorageUnitInfo;
using extensions::test::kRemovableStorageData;
+using storage_monitor::StorageMonitor;
+using storage_monitor::TestStorageMonitor;
const struct TestStorageUnitInfo kTestingData[] = {
{"dcim:device:001", "0xbeaf", 4098, 1},
diff --git a/chrome/browser/extensions/api/system_storage/system_storage_eject_apitest.cc b/chrome/browser/extensions/api/system_storage/system_storage_eject_apitest.cc
index 1860d7a6..b0a50bb 100644
--- a/chrome/browser/extensions/api/system_storage/system_storage_eject_apitest.cc
+++ b/chrome/browser/extensions/api/system_storage/system_storage_eject_apitest.cc
@@ -24,6 +24,8 @@ namespace {
using extensions::test::TestStorageUnitInfo;
using extensions::test::kRemovableStorageData;
+using storage_monitor::StorageMonitor;
+using storage_monitor::TestStorageMonitor;
} // namespace
diff --git a/chrome/browser/media_galleries/fileapi/iapps_finder_impl.cc b/chrome/browser/media_galleries/fileapi/iapps_finder_impl.cc
index e23a4d4..811398956 100644
--- a/chrome/browser/media_galleries/fileapi/iapps_finder_impl.cc
+++ b/chrome/browser/media_galleries/fileapi/iapps_finder_impl.cc
@@ -12,14 +12,14 @@ namespace iapps {
namespace {
-void PostResultToUIThread(StorageInfo::Type type,
+void PostResultToUIThread(storage_monitor::StorageInfo::Type type,
const IAppsFinderCallback& callback,
const std::string& unique_id) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
std::string device_id;
if (!unique_id.empty())
- device_id = StorageInfo::MakeDeviceId(type, unique_id);
+ device_id = storage_monitor::StorageInfo::MakeDeviceId(type, unique_id);
content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
base::Bind(callback, device_id));
@@ -27,7 +27,8 @@ void PostResultToUIThread(StorageInfo::Type type,
} // namespace
-void FindIAppsOnFileThread(StorageInfo::Type type, const IAppsFinderTask& task,
+void FindIAppsOnFileThread(storage_monitor::StorageInfo::Type type,
+ const IAppsFinderTask& task,
const IAppsFinderCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK(!task.is_null());
diff --git a/chrome/browser/media_galleries/fileapi/iapps_finder_impl.h b/chrome/browser/media_galleries/fileapi/iapps_finder_impl.h
index e2bf80d..7e9f955 100644
--- a/chrome/browser/media_galleries/fileapi/iapps_finder_impl.h
+++ b/chrome/browser/media_galleries/fileapi/iapps_finder_impl.h
@@ -48,7 +48,8 @@ typedef base::Callback<void(const IAppsFinderCallback&)> IAppsFinderTask;
// bouncing to the FILE thread to run |task| and then turning the result into a
// device id and posting it to |callback| on the UI thread. If |task| does not
// find the iApps's library, |callback| gets an empty string.
-void FindIAppsOnFileThread(StorageInfo::Type type, const IAppsFinderTask& task,
+void FindIAppsOnFileThread(storage_monitor::StorageInfo::Type type,
+ const IAppsFinderTask& task,
const IAppsFinderCallback& callback);
} // namespace iapps
diff --git a/chrome/browser/media_galleries/fileapi/iapps_finder_impl_mac.mm b/chrome/browser/media_galleries/fileapi/iapps_finder_impl_mac.mm
index 3b2c672..b088286 100644
--- a/chrome/browser/media_galleries/fileapi/iapps_finder_impl_mac.mm
+++ b/chrome/browser/media_galleries/fileapi/iapps_finder_impl_mac.mm
@@ -93,7 +93,7 @@ NSString* const kITunesRecentDatabasePathsKey = @"iTunesRecentDatabasePaths";
void FindIPhotoLibrary(const IAppsFinderCallback& callback) {
FindIAppsOnFileThread(
- StorageInfo::IPHOTO,
+ storage_monitor::StorageInfo::IPHOTO,
base::Bind(&FindMostRecentDatabase,
base::scoped_nsobject<NSString>(kIPhotoRecentDatabasesKey),
base::Bind(&ExtractIPhotoPath)),
@@ -102,7 +102,7 @@ void FindIPhotoLibrary(const IAppsFinderCallback& callback) {
void FindITunesLibrary(const IAppsFinderCallback& callback) {
FindIAppsOnFileThread(
- StorageInfo::ITUNES,
+ storage_monitor::StorageInfo::ITUNES,
base::Bind(&FindMostRecentDatabase,
base::scoped_nsobject<NSString>(kITunesRecentDatabasePathsKey),
base::Bind(&ExtractITunesPath)),
diff --git a/chrome/browser/media_galleries/fileapi/iapps_finder_impl_win.cc b/chrome/browser/media_galleries/fileapi/iapps_finder_impl_win.cc
index 55259c0..506e63b 100644
--- a/chrome/browser/media_galleries/fileapi/iapps_finder_impl_win.cc
+++ b/chrome/browser/media_galleries/fileapi/iapps_finder_impl_win.cc
@@ -90,7 +90,7 @@ void FindITunesLibraryOnFileThread(const iapps::IAppsFinderCallback& callback) {
// ITunesFinderWin will try a default location as well.
void FindITunesLibrary(const IAppsFinderCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- FindIAppsOnFileThread(StorageInfo::ITUNES,
+ FindIAppsOnFileThread(storage_monitor::StorageInfo::ITUNES,
base::Bind(FindITunesLibraryOnFileThread), callback);
}
diff --git a/chrome/browser/media_galleries/fileapi/picasa_finder.cc b/chrome/browser/media_galleries/fileapi/picasa_finder.cc
index 9eed5b5..9e2e83f 100644
--- a/chrome/browser/media_galleries/fileapi/picasa_finder.cc
+++ b/chrome/browser/media_galleries/fileapi/picasa_finder.cc
@@ -86,8 +86,8 @@ void FinishOnOriginalThread(const DeviceIDCallback& callback,
const base::FilePath& database_path) {
std::string device_id;
if (!database_path.empty()) {
- device_id = StorageInfo::MakeDeviceId(StorageInfo::PICASA,
- database_path.AsUTF8Unsafe());
+ device_id = storage_monitor::StorageInfo::MakeDeviceId(
+ storage_monitor::StorageInfo::PICASA, database_path.AsUTF8Unsafe());
}
callback.Run(device_id);
}
diff --git a/chrome/browser/media_galleries/linux/mtp_device_task_helper.cc b/chrome/browser/media_galleries/linux/mtp_device_task_helper.cc
index 2affeee..a1546c7 100644
--- a/chrome/browser/media_galleries/linux/mtp_device_task_helper.cc
+++ b/chrome/browser/media_galleries/linux/mtp_device_task_helper.cc
@@ -19,6 +19,8 @@
#include "webkit/browser/fileapi/async_file_util.h"
#include "webkit/common/fileapi/file_system_util.h"
+using storage_monitor::StorageMonitor;
+
namespace {
// Does nothing.
diff --git a/chrome/browser/media_galleries/linux/mtp_read_file_worker.cc b/chrome/browser/media_galleries/linux/mtp_read_file_worker.cc
index 9aa5c9c..456da92 100644
--- a/chrome/browser/media_galleries/linux/mtp_read_file_worker.cc
+++ b/chrome/browser/media_galleries/linux/mtp_read_file_worker.cc
@@ -15,6 +15,7 @@
#include "third_party/cros_system_api/dbus/service_constants.h"
using content::BrowserThread;
+using storage_monitor::StorageMonitor;
namespace {
diff --git a/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.mm b/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.mm
index 92b2b30..2531d71 100644
--- a/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.mm
+++ b/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.mm
@@ -33,7 +33,7 @@ typedef MTPDeviceAsyncDelegate::ReadDirectorySuccessCallback
// interactions with it are done on the UI thread, but it may be
// created/destroyed on another thread.
class MTPDeviceDelegateImplMac::DeviceListener
- : public ImageCaptureDeviceListener,
+ : public storage_monitor::ImageCaptureDeviceListener,
public base::SupportsWeakPtr<DeviceListener> {
public:
DeviceListener(MTPDeviceDelegateImplMac* delegate)
@@ -69,7 +69,8 @@ class MTPDeviceDelegateImplMac::DeviceListener
void MTPDeviceDelegateImplMac::DeviceListener::OpenCameraSession(
const std::string& device_id) {
camera_device_.reset(
- [ImageCaptureDeviceManager::deviceForUUID(device_id) retain]);
+ [storage_monitor::ImageCaptureDeviceManager::deviceForUUID(device_id)
+ retain]);
[camera_device_ setListener:AsWeakPtr()];
[camera_device_ open];
}
@@ -480,10 +481,11 @@ void CreateMTPDeviceAsyncDelegate(
const CreateMTPDeviceAsyncDelegateCallback& cb) {
std::string device_name = base::FilePath(device_location).BaseName().value();
std::string device_id;
- StorageInfo::Type type;
- bool cracked = StorageInfo::CrackDeviceId(device_name, &type, &device_id);
+ storage_monitor::StorageInfo::Type type;
+ bool cracked = storage_monitor::StorageInfo::CrackDeviceId(
+ device_name, &type, &device_id);
DCHECK(cracked);
- DCHECK_EQ(StorageInfo::MAC_IMAGE_CAPTURE, type);
+ DCHECK_EQ(storage_monitor::StorageInfo::MAC_IMAGE_CAPTURE, type);
cb.Run(new MTPDeviceDelegateImplMac(device_id, device_location));
}
diff --git a/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm b/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm
index 1df9060..922410a 100644
--- a/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm
+++ b/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm
@@ -174,7 +174,8 @@ class MTPDeviceDelegateImplMacTest : public testing::Test {
content::BrowserThread::IO));
ASSERT_TRUE(io_thread_->Start());
- TestStorageMonitor* monitor = TestStorageMonitor::CreateAndInstall();
+ storage_monitor::TestStorageMonitor* monitor =
+ storage_monitor::TestStorageMonitor::CreateAndInstall();
manager_.SetNotifications(monitor->receiver());
camera_ = [MockMTPICCameraDevice alloc];
@@ -190,7 +191,7 @@ class MTPDeviceDelegateImplMacTest : public testing::Test {
delegate_->CancelPendingTasksAndDeleteDelegate();
- TestStorageMonitor::Destroy();
+ storage_monitor::TestStorageMonitor::Destroy();
io_thread_->Stop();
}
@@ -297,7 +298,7 @@ class MTPDeviceDelegateImplMacTest : public testing::Test {
scoped_ptr<content::TestBrowserThread> file_thread_;
scoped_ptr<content::TestBrowserThread> io_thread_;
base::ScopedTempDir temp_dir_;
- ImageCaptureDeviceManager manager_;
+ storage_monitor::ImageCaptureDeviceManager manager_;
MockMTPICCameraDevice* camera_;
// This object needs special deletion inside the above |task_runner_|.
diff --git a/chrome/browser/media_galleries/media_file_system_registry.cc b/chrome/browser/media_galleries/media_file_system_registry.cc
index 983bbaf..1010eb6 100644
--- a/chrome/browser/media_galleries/media_file_system_registry.cc
+++ b/chrome/browser/media_galleries/media_file_system_registry.cc
@@ -44,6 +44,9 @@ using content::NavigationController;
using content::RenderProcessHost;
using content::WebContents;
using fileapi::IsolatedContext;
+using storage_monitor::MediaStorageUtil;
+using storage_monitor::StorageInfo;
+using storage_monitor::StorageMonitor;
namespace {
diff --git a/chrome/browser/media_galleries/media_file_system_registry.h b/chrome/browser/media_galleries/media_file_system_registry.h
index d9aced2..04065ff 100644
--- a/chrome/browser/media_galleries/media_file_system_registry.h
+++ b/chrome/browser/media_galleries/media_file_system_registry.h
@@ -67,7 +67,7 @@ typedef base::Callback<void(const std::vector<MediaFileSystemInfo>&)>
// Tracks usage of filesystems by extensions.
// This object lives on the UI thread.
class MediaFileSystemRegistry
- : public RemovableStorageObserver,
+ : public storage_monitor::RemovableStorageObserver,
public MediaGalleriesPreferences::GalleryChangeObserver {
public:
MediaFileSystemRegistry();
@@ -88,7 +88,8 @@ class MediaFileSystemRegistry
MediaScanManager* media_scan_manager();
// RemovableStorageObserver implementation.
- virtual void OnRemovableStorageDetached(const StorageInfo& info) OVERRIDE;
+ virtual void OnRemovableStorageDetached(
+ const storage_monitor::StorageInfo& info) OVERRIDE;
private:
class MediaFileSystemContextImpl;
diff --git a/chrome/browser/media_galleries/media_file_system_registry_unittest.cc b/chrome/browser/media_galleries/media_file_system_registry_unittest.cc
index c70b318..481a124 100644
--- a/chrome/browser/media_galleries/media_file_system_registry_unittest.cc
+++ b/chrome/browser/media_galleries/media_file_system_registry_unittest.cc
@@ -55,6 +55,9 @@
#endif
using content::BrowserThread;
+using storage_monitor::StorageInfo;
+using storage_monitor::StorageMonitor;
+using storage_monitor::TestStorageMonitor;
// Not anonymous so it can be friends with MediaFileSystemRegistry.
class TestMediaFileSystemContext : public MediaFileSystemContext {
@@ -779,7 +782,8 @@ void MediaFileSystemRegistryTest::SetUp() {
ASSERT_TRUE(base::CreateDirectory(empty_dir_));
dcim_dir_ = galleries_dir_.path().AppendASCII("with_dcim");
ASSERT_TRUE(base::CreateDirectory(dcim_dir_));
- ASSERT_TRUE(base::CreateDirectory(dcim_dir_.Append(kDCIMDirectoryName)));
+ ASSERT_TRUE(base::CreateDirectory(
+ dcim_dir_.Append(storage_monitor::kDCIMDirectoryName)));
}
void MediaFileSystemRegistryTest::TearDown() {
diff --git a/chrome/browser/media_galleries/media_folder_finder.cc b/chrome/browser/media_galleries/media_folder_finder.cc
index f30c373..78dd596 100644
--- a/chrome/browser/media_galleries/media_folder_finder.cc
+++ b/chrome/browser/media_galleries/media_folder_finder.cc
@@ -23,6 +23,9 @@
#include "chromeos/dbus/cros_disks_client.h"
#endif
+using storage_monitor::StorageInfo;
+using storage_monitor::StorageMonitor;
+
typedef base::Callback<void(const std::vector<base::FilePath>& /*roots*/)>
DefaultScanRootsCallback;
using content::BrowserThread;
diff --git a/chrome/browser/media_galleries/media_galleries_dialog_controller.cc b/chrome/browser/media_galleries/media_galleries_dialog_controller.cc
index bcc5dfb..bdac43a 100644
--- a/chrome/browser/media_galleries/media_galleries_dialog_controller.cc
+++ b/chrome/browser/media_galleries/media_galleries_dialog_controller.cc
@@ -30,6 +30,8 @@
using extensions::APIPermission;
using extensions::Extension;
+using storage_monitor::StorageInfo;
+using storage_monitor::StorageMonitor;
namespace {
diff --git a/chrome/browser/media_galleries/media_galleries_dialog_controller.h b/chrome/browser/media_galleries/media_galleries_dialog_controller.h
index 6c67b1b..67f7663 100644
--- a/chrome/browser/media_galleries/media_galleries_dialog_controller.h
+++ b/chrome/browser/media_galleries/media_galleries_dialog_controller.h
@@ -50,7 +50,7 @@ class MediaGalleriesDialog {
// the dialog and owns itself.
class MediaGalleriesDialogController
: public ui::SelectFileDialog::Listener,
- public RemovableStorageObserver,
+ public storage_monitor::RemovableStorageObserver,
public MediaGalleriesPreferences::GalleryChangeObserver {
public:
struct GalleryPermission {
@@ -137,8 +137,10 @@ class MediaGalleriesDialogController
// RemovableStorageObserver implementation.
// Used to keep dialog in sync with removable device status.
- virtual void OnRemovableStorageAttached(const StorageInfo& info) OVERRIDE;
- virtual void OnRemovableStorageDetached(const StorageInfo& info) OVERRIDE;
+ virtual void OnRemovableStorageAttached(
+ const storage_monitor::StorageInfo& info) OVERRIDE;
+ virtual void OnRemovableStorageDetached(
+ const storage_monitor::StorageInfo& info) OVERRIDE;
// MediaGalleriesPreferences::GalleryChangeObserver implementations.
// Used to keep the dialog in sync when the preferences change.
diff --git a/chrome/browser/media_galleries/media_galleries_dialog_controller_unittest.cc b/chrome/browser/media_galleries/media_galleries_dialog_controller_unittest.cc
index c46a9fb..5739a77 100644
--- a/chrome/browser/media_galleries/media_galleries_dialog_controller_unittest.cc
+++ b/chrome/browser/media_galleries/media_galleries_dialog_controller_unittest.cc
@@ -26,6 +26,9 @@
#include "chrome/browser/chromeos/settings/device_settings_service.h"
#endif
+using storage_monitor::StorageInfo;
+using storage_monitor::TestStorageMonitor;
+
namespace {
std::string GalleryName(const MediaGalleryPrefInfo& gallery) {
diff --git a/chrome/browser/media_galleries/media_galleries_permissions_unittest.cc b/chrome/browser/media_galleries/media_galleries_permissions_unittest.cc
index 7e1b571..bdc0c17 100644
--- a/chrome/browser/media_galleries/media_galleries_permissions_unittest.cc
+++ b/chrome/browser/media_galleries/media_galleries_permissions_unittest.cc
@@ -52,7 +52,7 @@ class MediaGalleriesPermissionsTest : public extensions::ExtensionPrefsTest {
prefs_.pref_service()->CommitPendingWrite();
message_loop_.RunUntilIdle();
- TestStorageMonitor::Destroy();
+ storage_monitor::TestStorageMonitor::Destroy();
testing::Test::TearDown();
}
@@ -60,7 +60,7 @@ class MediaGalleriesPermissionsTest : public extensions::ExtensionPrefsTest {
virtual void Initialize() OVERRIDE {
file_thread_.Start();
- ASSERT_TRUE(TestStorageMonitor::CreateAndInstall());
+ ASSERT_TRUE(storage_monitor::TestStorageMonitor::CreateAndInstall());
profile_.reset(new TestingProfile);
gallery_prefs_.reset(new MediaGalleriesPreferences(profile_.get()));
base::RunLoop loop;
diff --git a/chrome/browser/media_galleries/media_galleries_preferences.cc b/chrome/browser/media_galleries/media_galleries_preferences.cc
index 7fe1a34..d6b8ddf 100644
--- a/chrome/browser/media_galleries/media_galleries_preferences.cc
+++ b/chrome/browser/media_galleries/media_galleries_preferences.cc
@@ -43,6 +43,9 @@
using base::DictionaryValue;
using base::ListValue;
using extensions::ExtensionPrefs;
+using storage_monitor::MediaStorageUtil;
+using storage_monitor::StorageInfo;
+using storage_monitor::StorageMonitor;
namespace {
diff --git a/chrome/browser/media_galleries/media_galleries_preferences.h b/chrome/browser/media_galleries/media_galleries_preferences.h
index 96d2bda..15c6fbe 100644
--- a/chrome/browser/media_galleries/media_galleries_preferences.h
+++ b/chrome/browser/media_galleries/media_galleries_preferences.h
@@ -132,31 +132,33 @@ typedef std::set<MediaGalleryPrefId> MediaGalleryPrefIdSet;
// A class to manage the media gallery preferences. There is one instance per
// user profile.
-class MediaGalleriesPreferences : public BrowserContextKeyedService,
- public RemovableStorageObserver {
+class MediaGalleriesPreferences
+ : public BrowserContextKeyedService,
+ public storage_monitor::RemovableStorageObserver {
public:
class GalleryChangeObserver {
- public:
- // |extension_id| specifies the extension affected by this change.
- // |pref_id| refers to the gallery.
- virtual void OnPermissionAdded(MediaGalleriesPreferences* pref,
- const std::string& extension_id,
- MediaGalleryPrefId pref_id) {}
-
- virtual void OnPermissionRemoved(MediaGalleriesPreferences* pref,
- const std::string& extension_id,
- MediaGalleryPrefId pref_id) {}
+ public:
+ // |extension_id| specifies the extension affected by this change.
+ // |pref_id| refers to the gallery.
+ virtual void OnPermissionAdded(MediaGalleriesPreferences* pref,
+ const std::string& extension_id,
+ MediaGalleryPrefId pref_id) {}
- virtual void OnGalleryAdded(MediaGalleriesPreferences* pref,
- MediaGalleryPrefId pref_id) {}
+ virtual void OnPermissionRemoved(MediaGalleriesPreferences* pref,
+ const std::string& extension_id,
+ MediaGalleryPrefId pref_id) {}
- virtual void OnGalleryRemoved(MediaGalleriesPreferences* pref,
- MediaGalleryPrefId pref_id) {}
+ virtual void OnGalleryAdded(MediaGalleriesPreferences* pref,
+ MediaGalleryPrefId pref_id) {}
+
+ virtual void OnGalleryRemoved(MediaGalleriesPreferences* pref,
+ MediaGalleryPrefId pref_id) {}
+
+ virtual void OnGalleryInfoUpdated(MediaGalleriesPreferences* pref,
+ MediaGalleryPrefId pref_id) {}
- virtual void OnGalleryInfoUpdated(MediaGalleriesPreferences* pref,
- MediaGalleryPrefId pref_id) {}
- protected:
- virtual ~GalleryChangeObserver();
+ protected:
+ virtual ~GalleryChangeObserver();
};
explicit MediaGalleriesPreferences(Profile* profile);
@@ -181,7 +183,8 @@ class MediaGalleriesPreferences : public BrowserContextKeyedService,
void RemoveGalleryChangeObserver(GalleryChangeObserver* observer);
// RemovableStorageObserver implementation.
- virtual void OnRemovableStorageAttached(const StorageInfo& info) OVERRIDE;
+ virtual void OnRemovableStorageAttached(
+ const storage_monitor::StorageInfo& info) OVERRIDE;
// Lookup a media gallery and fill in information about it and return true if
// it exists. Return false if it does not, filling in default information.
diff --git a/chrome/browser/media_galleries/media_galleries_preferences_unittest.cc b/chrome/browser/media_galleries/media_galleries_preferences_unittest.cc
index 886f916..26f6cb1 100644
--- a/chrome/browser/media_galleries/media_galleries_preferences_unittest.cc
+++ b/chrome/browser/media_galleries/media_galleries_preferences_unittest.cc
@@ -36,6 +36,9 @@
#endif
using base::ASCIIToUTF16;
+using storage_monitor::MediaStorageUtil;
+using storage_monitor::StorageInfo;
+using storage_monitor::TestStorageMonitor;
namespace {
diff --git a/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.cc b/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.cc
index 0bad540..1cdc5bb 100644
--- a/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.cc
+++ b/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.cc
@@ -26,6 +26,9 @@
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
+using storage_monitor::StorageInfo;
+using storage_monitor::StorageMonitor;
+
namespace {
// Comparator for sorting OrderedScanResults -- more files first and then sorts
diff --git a/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.h b/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.h
index 8f004b0..6b316a8 100644
--- a/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.h
+++ b/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.h
@@ -53,7 +53,7 @@ class MediaGalleriesScanResultDialog {
// interfacing with the model (i.e., MediaGalleriesPreferences). It shows
// the dialog and owns itself.
class MediaGalleriesScanResultDialogController
- : public RemovableStorageObserver,
+ : public storage_monitor::RemovableStorageObserver,
public MediaGalleriesPreferences::GalleryChangeObserver {
public:
struct ScanResult {
@@ -144,8 +144,10 @@ class MediaGalleriesScanResultDialogController
// RemovableStorageObserver implementation.
// Used to keep dialog in sync with removable device status.
- virtual void OnRemovableStorageAttached(const StorageInfo& info) OVERRIDE;
- virtual void OnRemovableStorageDetached(const StorageInfo& info) OVERRIDE;
+ virtual void OnRemovableStorageAttached(
+ const storage_monitor::StorageInfo& info) OVERRIDE;
+ virtual void OnRemovableStorageDetached(
+ const storage_monitor::StorageInfo& info) OVERRIDE;
// MediaGalleriesPreferences::GalleryChangeObserver implementations.
// Used to keep the dialog in sync when the preferences change.
diff --git a/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller_unittest.cc b/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller_unittest.cc
index 87e5c81..6e14ef8 100644
--- a/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller_unittest.cc
+++ b/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller_unittest.cc
@@ -86,7 +86,7 @@ class MediaGalleriesScanResultDialogControllerTest : public testing::Test {
}
virtual void SetUp() OVERRIDE {
- ASSERT_TRUE(TestStorageMonitor::CreateAndInstall());
+ ASSERT_TRUE(storage_monitor::TestStorageMonitor::CreateAndInstall());
extensions::TestExtensionSystem* extension_system(
static_cast<extensions::TestExtensionSystem*>(
@@ -106,7 +106,7 @@ class MediaGalleriesScanResultDialogControllerTest : public testing::Test {
}
virtual void TearDown() OVERRIDE {
- TestStorageMonitor::Destroy();
+ storage_monitor::TestStorageMonitor::Destroy();
}
void StartDialog() {
@@ -210,7 +210,7 @@ class MediaGalleriesScanResultDialogControllerTest : public testing::Test {
chromeos::ScopedTestUserManager test_user_manager_;
#endif
- TestStorageMonitor monitor_;
+ storage_monitor::TestStorageMonitor monitor_;
scoped_ptr<TestingProfile> profile_;
scoped_ptr<MediaGalleriesPreferences> gallery_prefs_;
diff --git a/chrome/browser/media_galleries/media_scan_manager_unittest.cc b/chrome/browser/media_galleries/media_scan_manager_unittest.cc
index 232ee3b..8a9bb0e 100644
--- a/chrome/browser/media_galleries/media_scan_manager_unittest.cc
+++ b/chrome/browser/media_galleries/media_scan_manager_unittest.cc
@@ -102,7 +102,7 @@ class MediaScanManagerTest : public MediaScanManagerObserver,
}
virtual void SetUp() OVERRIDE {
- ASSERT_TRUE(TestStorageMonitor::CreateAndInstall());
+ ASSERT_TRUE(storage_monitor::TestStorageMonitor::CreateAndInstall());
extensions::TestExtensionSystem* extension_system(
static_cast<extensions::TestExtensionSystem*>(
@@ -139,7 +139,7 @@ class MediaScanManagerTest : public MediaScanManagerObserver,
virtual void TearDown() OVERRIDE {
media_scan_manager_->RemoveObserver(profile_.get());
media_scan_manager_.reset();
- TestStorageMonitor::Destroy();
+ storage_monitor::TestStorageMonitor::Destroy();
}
// Create a test folder in the test specific scoped temp dir and return the
@@ -271,7 +271,7 @@ class MediaScanManagerTest : public MediaScanManagerObserver,
chromeos::ScopedTestUserManager test_user_manager_;
#endif
- TestStorageMonitor monitor_;
+ storage_monitor::TestStorageMonitor monitor_;
scoped_ptr<TestingProfile> profile_;
MediaGalleriesPreferences* gallery_prefs_;
diff --git a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc
index 56a121c..3bdeeb8 100644
--- a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc
+++ b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc
@@ -47,7 +47,8 @@ bool GetStorageInfoOnUIThread(const base::string16& storage_path,
base::RemoveChars(storage_path, L"\\\\", &storage_device_id);
DCHECK(!storage_device_id.empty());
// TODO(gbillock): Take the StorageMonitor as an argument.
- StorageMonitor* monitor = StorageMonitor::GetInstance();
+ storage_monitor::StorageMonitor* monitor =
+ storage_monitor::StorageMonitor::GetInstance();
DCHECK(monitor);
return monitor->GetMTPStorageInfoFromDeviceId(
base::UTF16ToUTF8(storage_device_id), pnp_device_id, storage_object_id);
diff --git a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win_unittest.cc b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win_unittest.cc
index 6b7346c..7d4be62 100644
--- a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win_unittest.cc
+++ b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win_unittest.cc
@@ -28,6 +28,14 @@
#include "extensions/browser/extension_system.h"
#include "testing/gtest/include/gtest/gtest.h"
+using storage_monitor::PortableDeviceWatcherWin;
+using storage_monitor::StorageInfo;
+using storage_monitor::StorageMonitor;
+using storage_monitor::TestPortableDeviceWatcherWin;
+using storage_monitor::TestStorageMonitor;
+using storage_monitor::TestStorageMonitorWin;
+using storage_monitor::TestVolumeMountWatcherWin;
+
namespace {
typedef std::map<MediaGalleryPrefId, MediaFileSystemInfo> FSInfoMap;
diff --git a/chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_unittest.mm b/chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_unittest.mm
index 76d8f62..30e0e8a 100644
--- a/chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_unittest.mm
+++ b/chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_unittest.mm
@@ -20,9 +20,9 @@ using ::testing::ReturnRef;
MediaGalleryPrefInfo MakePrefInfoForTesting(MediaGalleryPrefId pref_id) {
MediaGalleryPrefInfo gallery;
gallery.pref_id = pref_id;
- gallery.device_id =
- StorageInfo::MakeDeviceId(StorageInfo::FIXED_MASS_STORAGE,
- base::Int64ToString(pref_id));
+ gallery.device_id = storage_monitor::StorageInfo::MakeDeviceId(
+ storage_monitor::StorageInfo::FIXED_MASS_STORAGE,
+ base::Int64ToString(pref_id));
gallery.display_name = base::ASCIIToUTF16("name");
return gallery;
}
diff --git a/chrome/browser/ui/cocoa/extensions/media_galleries_scan_result_dialog_cocoa_unittest.mm b/chrome/browser/ui/cocoa/extensions/media_galleries_scan_result_dialog_cocoa_unittest.mm
index 7c9b442..4a5ed33 100644
--- a/chrome/browser/ui/cocoa/extensions/media_galleries_scan_result_dialog_cocoa_unittest.mm
+++ b/chrome/browser/ui/cocoa/extensions/media_galleries_scan_result_dialog_cocoa_unittest.mm
@@ -32,8 +32,8 @@ class MockMediaGalleriesScanResultDialogController
MediaGalleryPrefInfo test_pref_info;
test_pref_info.pref_id = 1;
test_pref_info.display_name = base::ASCIIToUTF16("Test Gallery");
- test_pref_info.device_id =
- StorageInfo::MakeDeviceId(StorageInfo::FIXED_MASS_STORAGE, "blah");
+ test_pref_info.device_id = storage_monitor::StorageInfo::MakeDeviceId(
+ storage_monitor::StorageInfo::FIXED_MASS_STORAGE, "blah");
test_pref_info.type = MediaGalleryPrefInfo::kScanResult;
OrderedScanResults result;
diff --git a/chrome/browser/ui/gtk/extensions/media_galleries_dialog_gtk_unittest.cc b/chrome/browser/ui/gtk/extensions/media_galleries_dialog_gtk_unittest.cc
index deadd39..5dd79f1 100644
--- a/chrome/browser/ui/gtk/extensions/media_galleries_dialog_gtk_unittest.cc
+++ b/chrome/browser/ui/gtk/extensions/media_galleries_dialog_gtk_unittest.cc
@@ -22,8 +22,9 @@ namespace {
MediaGalleryPrefInfo MakePrefInfoForTesting(MediaGalleryPrefId id) {
MediaGalleryPrefInfo gallery;
gallery.pref_id = id;
- gallery.device_id = StorageInfo::MakeDeviceId(StorageInfo::FIXED_MASS_STORAGE,
- base::Int64ToString(id));
+ gallery.device_id = storage_monitor::StorageInfo::MakeDeviceId(
+ storage_monitor::StorageInfo::FIXED_MASS_STORAGE,
+ base::Int64ToString(id));
gallery.display_name = base::ASCIIToUTF16("Display Name");
return gallery;
}
diff --git a/chrome/browser/ui/views/extensions/media_galleries_dialog_views_unittest.cc b/chrome/browser/ui/views/extensions/media_galleries_dialog_views_unittest.cc
index 9df0fe6..5f2e313 100644
--- a/chrome/browser/ui/views/extensions/media_galleries_dialog_views_unittest.cc
+++ b/chrome/browser/ui/views/extensions/media_galleries_dialog_views_unittest.cc
@@ -22,8 +22,9 @@ namespace {
MediaGalleryPrefInfo MakePrefInfoForTesting(MediaGalleryPrefId id) {
MediaGalleryPrefInfo gallery;
gallery.pref_id = id;
- gallery.device_id = StorageInfo::MakeDeviceId(StorageInfo::FIXED_MASS_STORAGE,
- base::Int64ToString(id));
+ gallery.device_id = storage_monitor::StorageInfo::MakeDeviceId(
+ storage_monitor::StorageInfo::FIXED_MASS_STORAGE,
+ base::Int64ToString(id));
gallery.display_name = base::ASCIIToUTF16("Display Name");
return gallery;
}
diff --git a/chrome/browser/ui/webui/options/media_galleries_handler.cc b/chrome/browser/ui/webui/options/media_galleries_handler.cc
index 2bd431b..cae80a2 100644
--- a/chrome/browser/ui/webui/options/media_galleries_handler.cc
+++ b/chrome/browser/ui/webui/options/media_galleries_handler.cc
@@ -138,7 +138,7 @@ void MediaGalleriesHandler::HandleForgetGallery(const base::ListValue* args) {
}
media_galleries::UsageCount(media_galleries::WEBUI_FORGET_GALLERY);
- DCHECK(StorageMonitor::GetInstance()->IsInitialized());
+ DCHECK(storage_monitor::StorageMonitor::GetInstance()->IsInitialized());
MediaGalleriesPreferences* preferences =
g_browser_process->media_file_system_registry()->GetPreferences(
Profile::FromWebUI(web_ui()));
@@ -149,7 +149,7 @@ void MediaGalleriesHandler::FileSelected(const base::FilePath& path,
int index,
void* params) {
media_galleries::UsageCount(media_galleries::WEBUI_ADD_GALLERY);
- DCHECK(StorageMonitor::GetInstance()->IsInitialized());
+ DCHECK(storage_monitor::StorageMonitor::GetInstance()->IsInitialized());
MediaGalleriesPreferences* preferences =
g_browser_process->media_file_system_registry()->GetPreferences(
Profile::FromWebUI(web_ui()));
diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc
index 099689b..518977e 100644
--- a/chrome/test/base/in_process_browser_test.cc
+++ b/chrome/test/base/in_process_browser_test.cc
@@ -406,7 +406,7 @@ void InProcessBrowserTest::RunTestOnMainThreadLoop() {
#if !defined(OS_ANDROID) && !defined(OS_IOS)
// Do not use the real StorageMonitor for tests, which introduces another
// source of variability and potential slowness.
- ASSERT_TRUE(TestStorageMonitor::CreateForBrowserTests());
+ ASSERT_TRUE(storage_monitor::TestStorageMonitor::CreateForBrowserTests());
#endif
// Pump any pending events that were created as a result of creating a
diff --git a/components/storage_monitor/image_capture_device.h b/components/storage_monitor/image_capture_device.h
index 67de8ef..55dc1fe 100644
--- a/components/storage_monitor/image_capture_device.h
+++ b/components/storage_monitor/image_capture_device.h
@@ -19,6 +19,8 @@
#include "base/strings/sys_string_conversions.h"
#include "base/synchronization/lock.h"
+namespace storage_monitor {
+
// Clients use this listener interface to get notifications about
// events happening as a particular ImageCapture device is interacted with.
// Clients drive the interaction through the ImageCaptureDeviceManager
@@ -50,6 +52,8 @@ class ImageCaptureDeviceListener {
virtual void DeviceRemoved() = 0;
};
+} // namespace storage_monitor
+
// Interface to a camera device found by ImageCaptureCore. This class manages a
// session to the camera and provides the backing interactions to present the
// media files on it to the filesystem delegate. FilePaths will be artificial,
@@ -59,12 +63,13 @@ class ImageCaptureDeviceListener {
: NSObject<ICCameraDeviceDelegate, ICCameraDeviceDownloadDelegate> {
@private
base::scoped_nsobject<ICCameraDevice> camera_;
- base::WeakPtr<ImageCaptureDeviceListener> listener_;
+ base::WeakPtr<storage_monitor::ImageCaptureDeviceListener> listener_;
bool closing_;
}
- (id)initWithCameraDevice:(ICCameraDevice*)cameraDevice;
-- (void)setListener:(base::WeakPtr<ImageCaptureDeviceListener>)listener;
+- (void)setListener:
+ (base::WeakPtr<storage_monitor::ImageCaptureDeviceListener>)listener;
- (void)open;
- (void)close;
diff --git a/components/storage_monitor/image_capture_device.mm b/components/storage_monitor/image_capture_device.mm
index 9e1fcdc..e28137e 100644
--- a/components/storage_monitor/image_capture_device.mm
+++ b/components/storage_monitor/image_capture_device.mm
@@ -7,6 +7,8 @@
#include "base/file_util.h"
#include "content/public/browser/browser_thread.h"
+namespace storage_monitor {
+
namespace {
base::File::Error RenameFile(const base::FilePath& downloaded_filename,
@@ -50,6 +52,8 @@ base::FilePath PathForCameraItem(ICCameraItem* item) {
} // namespace
+} // namespace storage_monitor
+
@implementation ImageCaptureDevice
- (id)initWithCameraDevice:(ICCameraDevice*)cameraDevice {
@@ -69,7 +73,8 @@ base::FilePath PathForCameraItem(ICCameraItem* item) {
[super dealloc];
}
-- (void)setListener:(base::WeakPtr<ImageCaptureDeviceListener>)listener {
+- (void)setListener:(base::WeakPtr<storage_monitor::ImageCaptureDeviceListener>)
+ listener {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
listener_ = listener;
}
@@ -99,7 +104,7 @@ base::FilePath PathForCameraItem(ICCameraItem* item) {
// Find the file with that name and start download.
for (ICCameraItem* item in [camera_ mediaFiles]) {
- std::string itemName = PathForCameraItem(item).value();
+ std::string itemName = storage_monitor::PathForCameraItem(item).value();
if (itemName == name) {
// To create save options for ImageCapture, we need to
// split the target filename into directory/name
@@ -137,10 +142,11 @@ base::FilePath PathForCameraItem(ICCameraItem* item) {
else
info.size = [base::mac::ObjCCastStrict<ICCameraFile>(item) fileSize];
- base::FilePath path = PathForCameraItem(item);
+ base::FilePath path = storage_monitor::PathForCameraItem(item);
- info.last_modified = NSDateToBaseTime([item modificationDate]);
- info.creation_time = NSDateToBaseTime([item creationDate]);
+ info.last_modified =
+ storage_monitor::NSDateToBaseTime([item modificationDate]);
+ info.creation_time = storage_monitor::NSDateToBaseTime([item creationDate]);
info.last_accessed = info.last_modified;
if (listener_)
@@ -183,7 +189,7 @@ base::FilePath PathForCameraItem(ICCameraItem* item) {
if (closing_)
return;
- std::string name = PathForCameraItem(file).value();
+ std::string name = storage_monitor::PathForCameraItem(file).value();
if (error) {
DVLOG(1) << "error..."
@@ -214,8 +220,9 @@ base::FilePath PathForCameraItem(ICCameraItem* item) {
content::BrowserThread::PostTaskAndReplyWithResult(
content::BrowserThread::FILE,
FROM_HERE,
- base::Bind(&RenameFile, savedPath, saveAsPath),
- base::Bind(&ReturnRenameResultToListener, listener_, name));
+ base::Bind(&storage_monitor::RenameFile, savedPath, saveAsPath),
+ base::Bind(
+ &storage_monitor::ReturnRenameResultToListener, listener_, name));
}
@end // ImageCaptureDevice
diff --git a/components/storage_monitor/image_capture_device_manager.h b/components/storage_monitor/image_capture_device_manager.h
index cc0287a..2a4578f 100644
--- a/components/storage_monitor/image_capture_device_manager.h
+++ b/components/storage_monitor/image_capture_device_manager.h
@@ -15,6 +15,8 @@
@class ImageCaptureDevice;
@class ImageCaptureDeviceManagerImpl;
+namespace storage_monitor {
+
// Upon creation, begins monitoring for any attached devices using the
// ImageCapture API. Notifies clients of the presence of such devices
// (i.e. cameras, USB cards) using the SystemMonitor and makes them
@@ -45,4 +47,6 @@ class ImageCaptureDeviceManager {
base::scoped_nsobject<ImageCaptureDeviceManagerImpl> device_browser_;
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_IMAGE_CAPTURE_DEVICE_MANAGER_H_
diff --git a/components/storage_monitor/image_capture_device_manager.mm b/components/storage_monitor/image_capture_device_manager.mm
index 95b1c79..10b4d4e 100644
--- a/components/storage_monitor/image_capture_device_manager.mm
+++ b/components/storage_monitor/image_capture_device_manager.mm
@@ -11,7 +11,8 @@
namespace {
-ImageCaptureDeviceManager* g_image_capture_device_manager = NULL;
+storage_monitor::ImageCaptureDeviceManager* g_image_capture_device_manager =
+ NULL;
} // namespace
@@ -30,10 +31,11 @@ ImageCaptureDeviceManager* g_image_capture_device_manager = NULL;
// Guaranteed to outlive this class.
// TODO(gbillock): Update when ownership chains go up through
// a StorageMonitor subclass.
- StorageMonitor::Receiver* notifications_;
+ storage_monitor::StorageMonitor::Receiver* notifications_;
}
-- (void)setNotifications:(StorageMonitor::Receiver*)notifications;
+- (void)setNotifications:
+ (storage_monitor::StorageMonitor::Receiver*)notifications;
- (void)close;
// The UUIDs passed here are available in the device attach notifications.
@@ -58,7 +60,8 @@ ImageCaptureDeviceManager* g_image_capture_device_manager = NULL;
return self;
}
-- (void)setNotifications:(StorageMonitor::Receiver*)notifications {
+- (void)setNotifications:
+ (storage_monitor::StorageMonitor::Receiver*)notifications {
notifications_ = notifications;
}
@@ -97,9 +100,9 @@ ImageCaptureDeviceManager* g_image_capture_device_manager = NULL;
[cameras_ addObject:addedDevice];
// TODO(gbillock): use [cameraDevice mountPoint] here when possible.
- StorageInfo info(
- StorageInfo::MakeDeviceId(
- StorageInfo::MAC_IMAGE_CAPTURE,
+ storage_monitor::StorageInfo info(
+ storage_monitor::StorageInfo::MakeDeviceId(
+ storage_monitor::StorageInfo::MAC_IMAGE_CAPTURE,
base::SysNSStringToUTF8([cameraDevice UUIDString])),
base::SysNSStringToUTF16([cameraDevice name]),
"",
@@ -121,12 +124,14 @@ ImageCaptureDeviceManager* g_image_capture_device_manager = NULL;
// May delete |device|.
[cameras_ removeObject:device];
- notifications_->ProcessDetach(
- StorageInfo::MakeDeviceId(StorageInfo::MAC_IMAGE_CAPTURE, uuid));
+ notifications_->ProcessDetach(storage_monitor::StorageInfo::MakeDeviceId(
+ storage_monitor::StorageInfo::MAC_IMAGE_CAPTURE, uuid));
}
@end // ImageCaptureDeviceManagerImpl
+namespace storage_monitor {
+
ImageCaptureDeviceManager::ImageCaptureDeviceManager() {
device_browser_.reset([[ImageCaptureDeviceManagerImpl alloc] init]);
g_image_capture_device_manager = this;
@@ -163,3 +168,5 @@ ImageCaptureDevice* ImageCaptureDeviceManager::deviceForUUID(
id<ICDeviceBrowserDelegate> ImageCaptureDeviceManager::device_browser() {
return device_browser_.get();
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/image_capture_device_manager_unittest.mm b/components/storage_monitor/image_capture_device_manager_unittest.mm
index 2f4aae9..01a74df 100644
--- a/components/storage_monitor/image_capture_device_manager_unittest.mm
+++ b/components/storage_monitor/image_capture_device_manager_unittest.mm
@@ -207,6 +207,8 @@ const char kTestFileContents[] = "test";
@end
+namespace storage_monitor {
+
class TestCameraListener
: public ImageCaptureDeviceListener,
public base::SupportsWeakPtr<TestCameraListener> {
@@ -432,3 +434,5 @@ TEST_F(ImageCaptureDeviceManagerTest, TestSubdirectories) {
[camera didRemoveDevice:device];
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/media_storage_util.cc b/components/storage_monitor/media_storage_util.cc
index 149f10c..20190d4 100644
--- a/components/storage_monitor/media_storage_util.cc
+++ b/components/storage_monitor/media_storage_util.cc
@@ -18,6 +18,8 @@
using content::BrowserThread;
+namespace storage_monitor {
+
namespace {
// MediaDeviceNotification.DeviceInfo histogram values.
@@ -244,3 +246,5 @@ bool MediaStorageUtil::IsRemovableStorageAttached(const std::string& id) {
}
return false;
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/media_storage_util.h b/components/storage_monitor/media_storage_util.h
index 7c3ed10..12dcd46 100644
--- a/components/storage_monitor/media_storage_util.h
+++ b/components/storage_monitor/media_storage_util.h
@@ -15,6 +15,8 @@
#include "base/callback_forward.h"
#include "base/files/file_path.h"
+namespace storage_monitor {
+
class StorageInfo;
class MediaStorageUtil {
@@ -63,4 +65,6 @@ class MediaStorageUtil {
DISALLOW_IMPLICIT_CONSTRUCTORS(MediaStorageUtil);
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_MEDIA_STORAGE_UTIL_H_
diff --git a/components/storage_monitor/media_storage_util_unittest.cc b/components/storage_monitor/media_storage_util_unittest.cc
index 5f93ce1..1d32e49 100644
--- a/components/storage_monitor/media_storage_util_unittest.cc
+++ b/components/storage_monitor/media_storage_util_unittest.cc
@@ -25,6 +25,8 @@ const char kImageCaptureDeviceId[] = "ic:xyz";
using content::BrowserThread;
+namespace storage_monitor {
+
class MediaStorageUtilTest : public testing::Test {
public:
MediaStorageUtilTest()
@@ -150,3 +152,5 @@ TEST_F(MediaStorageUtilTest, DetectDeviceFiltered) {
EXPECT_TRUE(devices.find(kImageCaptureDeviceId) != devices.end());
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/media_transfer_protocol_device_observer_linux.cc b/components/storage_monitor/media_transfer_protocol_device_observer_linux.cc
index 0bd7375..5babbca 100644
--- a/components/storage_monitor/media_transfer_protocol_device_observer_linux.cc
+++ b/components/storage_monitor/media_transfer_protocol_device_observer_linux.cc
@@ -15,6 +15,8 @@
#include "components/storage_monitor/removable_device_constants.h"
#include "device/media_transfer_protocol/mtp_storage_info.pb.h"
+namespace storage_monitor {
+
namespace {
// Device root path constant.
@@ -237,3 +239,5 @@ bool MediaTransferProtocolDeviceObserverLinux::GetLocationForDeviceId(
return false;
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/media_transfer_protocol_device_observer_linux.h b/components/storage_monitor/media_transfer_protocol_device_observer_linux.h
index 51eaac6..84fee1d 100644
--- a/components/storage_monitor/media_transfer_protocol_device_observer_linux.h
+++ b/components/storage_monitor/media_transfer_protocol_device_observer_linux.h
@@ -16,6 +16,8 @@ namespace base {
class FilePath;
}
+namespace storage_monitor {
+
// Gets the mtp device information given a |storage_name|. On success,
// fills in |id|, |name| and |location|.
typedef void (*GetStorageInfoFunc)(
@@ -85,4 +87,6 @@ class MediaTransferProtocolDeviceObserverLinux
DISALLOW_COPY_AND_ASSIGN(MediaTransferProtocolDeviceObserverLinux);
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_MEDIA_TRANSFER_PROTOCOL_DEVICE_OBSERVER_LINUX_H_
diff --git a/components/storage_monitor/media_transfer_protocol_device_observer_linux_unittest.cc b/components/storage_monitor/media_transfer_protocol_device_observer_linux_unittest.cc
index 5b9274b..4bd6a63 100644
--- a/components/storage_monitor/media_transfer_protocol_device_observer_linux_unittest.cc
+++ b/components/storage_monitor/media_transfer_protocol_device_observer_linux_unittest.cc
@@ -19,6 +19,8 @@
#include "device/media_transfer_protocol/media_transfer_protocol_manager.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace storage_monitor {
+
namespace {
// Sample mtp device storage information.
@@ -159,3 +161,5 @@ TEST_F(MediaTransferProtocolDeviceObserverLinuxTest, StorageWithInvalidInfo) {
EXPECT_EQ(0, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/mock_removable_storage_observer.cc b/components/storage_monitor/mock_removable_storage_observer.cc
index f89a8a6..f043391 100644
--- a/components/storage_monitor/mock_removable_storage_observer.cc
+++ b/components/storage_monitor/mock_removable_storage_observer.cc
@@ -4,6 +4,8 @@
#include "components/storage_monitor/mock_removable_storage_observer.h"
+namespace storage_monitor {
+
MockRemovableStorageObserver::MockRemovableStorageObserver()
: attach_calls_(0), detach_calls_(0) {
}
@@ -22,3 +24,5 @@ void MockRemovableStorageObserver::OnRemovableStorageDetached(
detach_calls_++;
last_detached_ = info;
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/mock_removable_storage_observer.h b/components/storage_monitor/mock_removable_storage_observer.h
index 9d8c57c..80019b3 100644
--- a/components/storage_monitor/mock_removable_storage_observer.h
+++ b/components/storage_monitor/mock_removable_storage_observer.h
@@ -8,6 +8,8 @@
#include "components/storage_monitor/removable_storage_observer.h"
#include "components/storage_monitor/storage_info.h"
+namespace storage_monitor {
+
class MockRemovableStorageObserver : public RemovableStorageObserver {
public:
MockRemovableStorageObserver();
@@ -36,4 +38,6 @@ class MockRemovableStorageObserver : public RemovableStorageObserver {
StorageInfo last_detached_;
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_MOCK_REMOVABLE_STORAGE_OBSERVER_H_
diff --git a/components/storage_monitor/mtab_watcher_linux.cc b/components/storage_monitor/mtab_watcher_linux.cc
index 353381f..00a9d0c 100644
--- a/components/storage_monitor/mtab_watcher_linux.cc
+++ b/components/storage_monitor/mtab_watcher_linux.cc
@@ -31,6 +31,8 @@ const char* const kKnownFileSystems[] = {
} // namespace
+namespace storage_monitor {
+
MtabWatcherLinux::MtabWatcherLinux(const base::FilePath& mtab_path,
base::WeakPtr<Delegate> delegate)
: mtab_path_(mtab_path),
@@ -100,3 +102,5 @@ void MtabWatcherLinux::OnFilePathChanged(
ReadMtab();
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/mtab_watcher_linux.h b/components/storage_monitor/mtab_watcher_linux.h
index 7078779..206ed53 100644
--- a/components/storage_monitor/mtab_watcher_linux.h
+++ b/components/storage_monitor/mtab_watcher_linux.h
@@ -20,6 +20,8 @@
#include "base/files/file_path_watcher.h"
#include "base/memory/weak_ptr.h"
+namespace storage_monitor {
+
class MtabWatcherLinux {
public:
// (mount point, mount device)
@@ -59,4 +61,6 @@ class MtabWatcherLinux {
DISALLOW_COPY_AND_ASSIGN(MtabWatcherLinux);
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_MTAB_WATCHER_LINUX_H_
diff --git a/components/storage_monitor/portable_device_watcher_win.cc b/components/storage_monitor/portable_device_watcher_win.cc
index ad0a547..571bdaf 100644
--- a/components/storage_monitor/portable_device_watcher_win.cc
+++ b/components/storage_monitor/portable_device_watcher_win.cc
@@ -25,6 +25,8 @@
#include "components/storage_monitor/storage_info.h"
#include "content/public/browser/browser_thread.h"
+namespace storage_monitor {
+
namespace {
// Name of the client application that communicates with the MTP device.
@@ -666,3 +668,5 @@ void PortableDeviceWatcherWin::HandleDeviceDetachEvent(
}
device_map_.erase(device_iter);
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/portable_device_watcher_win.h b/components/storage_monitor/portable_device_watcher_win.h
index 494181f..cc5e54a 100644
--- a/components/storage_monitor/portable_device_watcher_win.h
+++ b/components/storage_monitor/portable_device_watcher_win.h
@@ -20,6 +20,8 @@ namespace base {
class SequencedTaskRunner;
}
+namespace storage_monitor {
+
class TestPortableDeviceWatcherWin;
// This class watches the portable device mount points and sends notifications
@@ -139,4 +141,6 @@ class PortableDeviceWatcherWin {
DISALLOW_COPY_AND_ASSIGN(PortableDeviceWatcherWin);
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_PORTABLE_DEVICE_WATCHER_WIN_H_
diff --git a/components/storage_monitor/removable_device_constants.cc b/components/storage_monitor/removable_device_constants.cc
index 03fa0fd..ce76b23 100644
--- a/components/storage_monitor/removable_device_constants.cc
+++ b/components/storage_monitor/removable_device_constants.cc
@@ -4,6 +4,8 @@
#include "components/storage_monitor/removable_device_constants.h"
+namespace storage_monitor {
+
const char kFSUniqueIdPrefix[] = "UUID:";
const char kVendorModelSerialPrefix[] = "VendorModelSerial:";
@@ -17,3 +19,5 @@ const base::char16 kWPDDevInterfaceGUID[] =
#endif
const base::FilePath::CharType kDCIMDirectoryName[] = FILE_PATH_LITERAL("DCIM");
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/removable_device_constants.h b/components/storage_monitor/removable_device_constants.h
index 236b097..97a059f 100644
--- a/components/storage_monitor/removable_device_constants.h
+++ b/components/storage_monitor/removable_device_constants.h
@@ -9,6 +9,8 @@
#include "base/strings/string16.h"
#include "build/build_config.h"
+namespace storage_monitor {
+
// Prefix constants used in device unique id.
extern const char kFSUniqueIdPrefix[];
extern const char kVendorModelSerialPrefix[];
@@ -24,4 +26,6 @@ extern const base::char16 kWPDDevInterfaceGUID[];
extern const base::FilePath::CharType kDCIMDirectoryName[];
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_REMOVABLE_DEVICE_CONSTANTS_H_
diff --git a/components/storage_monitor/removable_storage_observer.h b/components/storage_monitor/removable_storage_observer.h
index a5db82f..67d578e 100644
--- a/components/storage_monitor/removable_storage_observer.h
+++ b/components/storage_monitor/removable_storage_observer.h
@@ -7,6 +7,8 @@
#include "components/storage_monitor/storage_info.h"
+namespace storage_monitor {
+
// Clients use this class to register for event-based notifications of
// removable storage devices attached to or removed from the system.
class RemovableStorageObserver {
@@ -23,4 +25,6 @@ class RemovableStorageObserver {
virtual ~RemovableStorageObserver() {}
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_REMOVABLE_STORAGE_OBSERVER_H_
diff --git a/components/storage_monitor/storage_info.cc b/components/storage_monitor/storage_info.cc
index a389611..b9734e2 100644
--- a/components/storage_monitor/storage_info.cc
+++ b/components/storage_monitor/storage_info.cc
@@ -20,6 +20,8 @@ const char kIPhotoPrefix[] = "iphoto:";
} // namespace
+namespace storage_monitor {
+
StorageInfo::StorageInfo() : total_size_in_bytes_(0) {
}
@@ -151,3 +153,5 @@ bool StorageInfo::IsPicasaDevice(const std::string& device_id) {
Type type;
return CrackDeviceId(device_id, &type, NULL) && type == PICASA;
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/storage_info.h b/components/storage_monitor/storage_info.h
index 1afdc52..83b6d87 100644
--- a/components/storage_monitor/storage_info.h
+++ b/components/storage_monitor/storage_info.h
@@ -8,6 +8,8 @@
#include "base/files/file_path.h"
#include "base/strings/string16.h"
+namespace storage_monitor {
+
class StorageInfo {
public:
enum Type {
@@ -112,4 +114,6 @@ class StorageInfo {
uint64 total_size_in_bytes_;
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_STORAGE_INFO_H_
diff --git a/components/storage_monitor/storage_info_unittest.cc b/components/storage_monitor/storage_info_unittest.cc
index 34959d3..e9ef378 100644
--- a/components/storage_monitor/storage_info_unittest.cc
+++ b/components/storage_monitor/storage_info_unittest.cc
@@ -7,6 +7,8 @@
#include "components/storage_monitor/storage_info.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace storage_monitor {
+
const char kMtpDeviceId[] = "mtp:VendorModelSerial:ABC:1233:1237912873";
const char kUniqueId[] = "VendorModelSerial:ABC:1233:1237912873";
const char kImageCaptureDeviceId[] = "ic:xyz";
@@ -36,3 +38,5 @@ TEST(StorageInfoTest, TestImageCaptureDeviceId) {
EXPECT_EQ(StorageInfo::MAC_IMAGE_CAPTURE, type);
EXPECT_EQ("xyz", id);
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/storage_monitor.cc b/components/storage_monitor/storage_monitor.cc
index 5fd39a1..de2c2b7 100644
--- a/components/storage_monitor/storage_monitor.cc
+++ b/components/storage_monitor/storage_monitor.cc
@@ -9,6 +9,8 @@
#include "components/storage_monitor/removable_storage_observer.h"
#include "components/storage_monitor/transient_device_ids.h"
+namespace storage_monitor {
+
namespace {
StorageMonitor* g_storage_monitor = NULL;
@@ -192,3 +194,5 @@ void StorageMonitor::ProcessDetach(const std::string& id) {
&RemovableStorageObserver::OnRemovableStorageDetached, info);
}
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/storage_monitor.h b/components/storage_monitor/storage_monitor.h
index 30c48dd..637c4ce 100644
--- a/components/storage_monitor/storage_monitor.h
+++ b/components/storage_monitor/storage_monitor.h
@@ -21,15 +21,18 @@
class MediaFileSystemRegistryTest;
class MediaGalleriesPlatformAppBrowserTest;
class MediaGalleriesPrivateApiTest;
-class RemovableStorageObserver;
class SystemStorageApiTest;
class SystemStorageEjectApiTest;
-class TransientDeviceIds;
namespace device {
class MediaTransferProtocolManager;
}
+namespace storage_monitor {
+
+class RemovableStorageObserver;
+class TransientDeviceIds;
+
// Base class for platform-specific instances watching for removable storage
// attachments/detachments.
// Lifecycle contracts: This class is created in the browser process
@@ -188,4 +191,6 @@ class StorageMonitor {
scoped_ptr<TransientDeviceIds> transient_device_ids_;
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_H_
diff --git a/components/storage_monitor/storage_monitor_chromeos.cc b/components/storage_monitor/storage_monitor_chromeos.cc
index 7428b1d8..ec9301c 100644
--- a/components/storage_monitor/storage_monitor_chromeos.cc
+++ b/components/storage_monitor/storage_monitor_chromeos.cc
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// chromeos::StorageMonitorCros implementation.
-
#include "components/storage_monitor/storage_monitor_chromeos.h"
#include "base/files/file_path.h"
@@ -19,13 +17,15 @@
#include "content/public/browser/browser_thread.h"
#include "device/media_transfer_protocol/media_transfer_protocol_manager.h"
-namespace chromeos {
+using chromeos::disks::DiskMountManager;
+
+namespace storage_monitor {
namespace {
// Constructs a device id using uuid or manufacturer (vendor and product) id
// details.
-std::string MakeDeviceUniqueId(const disks::DiskMountManager::Disk& disk) {
+std::string MakeDeviceUniqueId(const DiskMountManager::Disk& disk) {
std::string uuid = disk.fs_uuid();
if (!uuid.empty())
return kFSUniqueIdPrefix + uuid;
@@ -44,15 +44,15 @@ std::string MakeDeviceUniqueId(const disks::DiskMountManager::Disk& disk) {
// Returns true if the requested device is valid, else false. On success, fills
// in |info|.
-bool GetDeviceInfo(const disks::DiskMountManager::MountPointInfo& mount_info,
+bool GetDeviceInfo(const DiskMountManager::MountPointInfo& mount_info,
bool has_dcim,
StorageInfo* info) {
DCHECK(info);
std::string source_path = mount_info.source_path;
- const disks::DiskMountManager::Disk* disk =
- disks::DiskMountManager::GetInstance()->FindDiskBySourcePath(source_path);
- if (!disk || disk->device_type() == DEVICE_TYPE_UNKNOWN)
+ const DiskMountManager::Disk* disk =
+ DiskMountManager::GetInstance()->FindDiskBySourcePath(source_path);
+ if (!disk || disk->device_type() == chromeos::DEVICE_TYPE_UNKNOWN)
return false;
std::string unique_id = MakeDeviceUniqueId(*disk);
@@ -79,7 +79,7 @@ bool GetDeviceInfo(const disks::DiskMountManager::MountPointInfo& mount_info,
// Returns whether the mount point in |mount_info| is a media device or not.
bool CheckMountedPathOnFileThread(
- const disks::DiskMountManager::MountPointInfo& mount_info) {
+ const DiskMountManager::MountPointInfo& mount_info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
return MediaStorageUtil::HasDcim(base::FilePath(mount_info.mount_path));
}
@@ -93,15 +93,15 @@ StorageMonitorCros::StorageMonitorCros()
}
StorageMonitorCros::~StorageMonitorCros() {
- disks::DiskMountManager* manager = disks::DiskMountManager::GetInstance();
+ DiskMountManager* manager = DiskMountManager::GetInstance();
if (manager) {
manager->RemoveObserver(this);
}
}
void StorageMonitorCros::Init() {
- DCHECK(disks::DiskMountManager::GetInstance());
- disks::DiskMountManager::GetInstance()->AddObserver(this);
+ DCHECK(DiskMountManager::GetInstance());
+ DiskMountManager::GetInstance()->AddObserver(this);
CheckExistingMountPoints();
if (!media_transfer_protocol_manager_) {
@@ -117,10 +117,10 @@ void StorageMonitorCros::Init() {
void StorageMonitorCros::CheckExistingMountPoints() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- const disks::DiskMountManager::MountPointMap& mount_point_map =
- disks::DiskMountManager::GetInstance()->mount_points();
- for (disks::DiskMountManager::MountPointMap::const_iterator it =
- mount_point_map.begin(); it != mount_point_map.end(); ++it) {
+ const DiskMountManager::MountPointMap& mount_point_map =
+ DiskMountManager::GetInstance()->mount_points();
+ for (DiskMountManager::MountPointMap::const_iterator it =
+ mount_point_map.begin(); it != mount_point_map.end(); ++it) {
BrowserThread::PostTaskAndReplyWithResult(
BrowserThread::FILE, FROM_HERE,
base::Bind(&CheckMountedPathOnFileThread, it->second),
@@ -139,33 +139,29 @@ void StorageMonitorCros::CheckExistingMountPoints() {
weak_ptr_factory_.GetWeakPtr()));
}
-void StorageMonitorCros::OnDiskEvent(
- disks::DiskMountManager::DiskEvent event,
- const disks::DiskMountManager::Disk* disk) {
-}
+void StorageMonitorCros::OnDiskEvent(DiskMountManager::DiskEvent event,
+ const DiskMountManager::Disk* disk) {}
-void StorageMonitorCros::OnDeviceEvent(
- disks::DiskMountManager::DeviceEvent event,
- const std::string& device_path) {
-}
+void StorageMonitorCros::OnDeviceEvent(DiskMountManager::DeviceEvent event,
+ const std::string& device_path) {}
void StorageMonitorCros::OnMountEvent(
- disks::DiskMountManager::MountEvent event,
- MountError error_code,
- const disks::DiskMountManager::MountPointInfo& mount_info) {
+ DiskMountManager::MountEvent event,
+ chromeos::MountError error_code,
+ const DiskMountManager::MountPointInfo& mount_info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// Ignore mount points that are not devices.
- if (mount_info.mount_type != MOUNT_TYPE_DEVICE)
+ if (mount_info.mount_type != chromeos::MOUNT_TYPE_DEVICE)
return;
// Ignore errors.
- if (error_code != MOUNT_ERROR_NONE)
+ if (error_code != chromeos::MOUNT_ERROR_NONE)
return;
- if (mount_info.mount_condition != disks::MOUNT_CONDITION_NONE)
+ if (mount_info.mount_condition != chromeos::disks::MOUNT_CONDITION_NONE)
return;
switch (event) {
- case disks::DiskMountManager::MOUNTING: {
+ case DiskMountManager::MOUNTING: {
if (ContainsKey(mount_map_, mount_info.mount_path)) {
NOTREACHED();
return;
@@ -178,7 +174,7 @@ void StorageMonitorCros::OnMountEvent(
weak_ptr_factory_.GetWeakPtr(), mount_info));
break;
}
- case disks::DiskMountManager::UNMOUNTING: {
+ case DiskMountManager::UNMOUNTING: {
MountMap::iterator it = mount_map_.find(mount_info.mount_path);
if (it == mount_map_.end())
return;
@@ -189,11 +185,9 @@ void StorageMonitorCros::OnMountEvent(
}
}
-void StorageMonitorCros::OnFormatEvent(
- disks::DiskMountManager::FormatEvent event,
- FormatError error_code,
- const std::string& device_path) {
-}
+void StorageMonitorCros::OnFormatEvent(DiskMountManager::FormatEvent event,
+ chromeos::FormatError error_code,
+ const std::string& device_path) {}
void StorageMonitorCros::SetMediaTransferProtocolManagerForTest(
device::MediaTransferProtocolManager* test_manager) {
@@ -234,7 +228,7 @@ bool StorageMonitorCros::GetStorageInfoForPath(
void NotifyUnmountResult(
base::Callback<void(StorageMonitor::EjectStatus)> callback,
chromeos::MountError error_code) {
- if (error_code == MOUNT_ERROR_NONE)
+ if (error_code == chromeos::MOUNT_ERROR_NONE)
callback.Run(StorageMonitor::EJECT_OK);
else
callback.Run(StorageMonitor::EJECT_FAILURE);
@@ -266,7 +260,7 @@ void StorageMonitorCros::EjectDevice(
return;
}
- disks::DiskMountManager* manager = disks::DiskMountManager::GetInstance();
+ DiskMountManager* manager = DiskMountManager::GetInstance();
if (!manager) {
callback.Run(EJECT_FAILURE);
return;
@@ -282,7 +276,8 @@ StorageMonitorCros::media_transfer_protocol_manager() {
}
void StorageMonitorCros::AddMountedPath(
- const disks::DiskMountManager::MountPointInfo& mount_info, bool has_dcim) {
+ const DiskMountManager::MountPointInfo& mount_info,
+ bool has_dcim) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (ContainsKey(mount_map_, mount_info.mount_path)) {
@@ -305,8 +300,8 @@ void StorageMonitorCros::AddMountedPath(
receiver()->ProcessAttach(info);
}
-} // namespace chromeos
-
StorageMonitor* StorageMonitor::CreateInternal() {
- return new chromeos::StorageMonitorCros();
+ return new StorageMonitorCros();
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/storage_monitor_chromeos.h b/components/storage_monitor/storage_monitor_chromeos.h
index 6331753..b3deb54 100644
--- a/components/storage_monitor/storage_monitor_chromeos.h
+++ b/components/storage_monitor/storage_monitor_chromeos.h
@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// chromeos::StorageMonitorCros listens for mount point changes and notifies
-// listeners about the addition and deletion of media devices.
-// This class lives on the UI thread.
+// StorageMonitorCros listens for mount point changes and notifies listeners
+// about the addition and deletion of media devices. This class lives on the
+// UI thread.
#ifndef COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_
#define COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_
@@ -23,12 +23,12 @@
#include "chromeos/disks/disk_mount_manager.h"
#include "components/storage_monitor/storage_monitor.h"
-class MediaTransferProtocolDeviceObserverLinux;
+namespace storage_monitor {
-namespace chromeos {
+class MediaTransferProtocolDeviceObserverLinux;
class StorageMonitorCros : public StorageMonitor,
- public disks::DiskMountManager::Observer {
+ public chromeos::disks::DiskMountManager::Observer {
public:
// Should only be called by browser start up code.
// Use StorageMonitor::GetInstance() instead.
@@ -43,18 +43,22 @@ class StorageMonitorCros : public StorageMonitor,
void SetMediaTransferProtocolManagerForTest(
device::MediaTransferProtocolManager* test_manager);
- // disks::DiskMountManager::Observer implementation.
- virtual void OnDiskEvent(disks::DiskMountManager::DiskEvent event,
- const disks::DiskMountManager::Disk* disk) OVERRIDE;
- virtual void OnDeviceEvent(disks::DiskMountManager::DeviceEvent event,
- const std::string& device_path) OVERRIDE;
+ // chromeos::disks::DiskMountManager::Observer implementation.
+ virtual void OnDiskEvent(
+ chromeos::disks::DiskMountManager::DiskEvent event,
+ const chromeos::disks::DiskMountManager::Disk* disk) OVERRIDE;
+ virtual void OnDeviceEvent(
+ chromeos::disks::DiskMountManager::DeviceEvent event,
+ const std::string& device_path) OVERRIDE;
virtual void OnMountEvent(
- disks::DiskMountManager::MountEvent event,
- MountError error_code,
- const disks::DiskMountManager::MountPointInfo& mount_info) OVERRIDE;
- virtual void OnFormatEvent(disks::DiskMountManager::FormatEvent event,
- FormatError error_code,
- const std::string& device_path) OVERRIDE;
+ chromeos::disks::DiskMountManager::MountEvent event,
+ chromeos::MountError error_code,
+ const chromeos::disks::DiskMountManager::MountPointInfo& mount_info)
+ OVERRIDE;
+ virtual void OnFormatEvent(
+ chromeos::disks::DiskMountManager::FormatEvent event,
+ chromeos::FormatError error_code,
+ const std::string& device_path) OVERRIDE;
// StorageMonitor implementation.
virtual bool GetStorageInfoForPath(const base::FilePath& path,
@@ -76,8 +80,9 @@ class StorageMonitorCros : public StorageMonitor,
// Adds the mount point in |mount_info| to |mount_map_| and send a media
// device attach notification. |has_dcim| is true if the attached device has
// a DCIM folder.
- void AddMountedPath(const disks::DiskMountManager::MountPointInfo& mount_info,
- bool has_dcim);
+ void AddMountedPath(
+ const chromeos::disks::DiskMountManager::MountPointInfo& mount_info,
+ bool has_dcim);
// Mapping of relevant mount points and their corresponding mount devices.
MountMap mount_map_;
@@ -92,6 +97,6 @@ class StorageMonitorCros : public StorageMonitor,
DISALLOW_COPY_AND_ASSIGN(StorageMonitorCros);
};
-} // namespace chromeos
+} // namespace storage_monitor
#endif // COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_
diff --git a/components/storage_monitor/storage_monitor_chromeos_unittest.cc b/components/storage_monitor/storage_monitor_chromeos_unittest.cc
index b47cb12..60f5364 100644
--- a/components/storage_monitor/storage_monitor_chromeos_unittest.cc
+++ b/components/storage_monitor/storage_monitor_chromeos_unittest.cc
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// chromeos::StorageMonitorCros unit tests.
-
#include "components/storage_monitor/storage_monitor_chromeos.h"
#include "base/file_util.h"
@@ -22,12 +20,12 @@
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace chromeos {
+namespace storage_monitor {
namespace {
using content::BrowserThread;
-using disks::DiskMountManager;
+using chromeos::disks::DiskMountManager;
using testing::_;
const char kDevice1[] = "/dev/d1";
@@ -69,10 +67,9 @@ class TestStorageMonitorCros : public StorageMonitorCros {
StorageMonitorCros::Init();
}
- virtual void OnMountEvent(
- disks::DiskMountManager::MountEvent event,
- MountError error_code,
- const disks::DiskMountManager::MountPointInfo& mount_info) OVERRIDE {
+ virtual void OnMountEvent(DiskMountManager::MountEvent event,
+ chromeos::MountError error_code,
+ const DiskMountManager::MountPointInfo& mount_info) OVERRIDE {
StorageMonitorCros::OnMountEvent(event, error_code, mount_info);
}
@@ -103,16 +100,16 @@ class StorageMonitorCrosTest : public testing::Test {
virtual void SetUp() OVERRIDE;
virtual void TearDown() OVERRIDE;
- void MountDevice(MountError error_code,
+ void MountDevice(chromeos::MountError error_code,
const DiskMountManager::MountPointInfo& mount_info,
const std::string& unique_id,
const std::string& device_label,
const std::string& vendor_name,
const std::string& product_name,
- DeviceType device_type,
+ chromeos::DeviceType device_type,
uint64 device_size_in_bytes);
- void UnmountDevice(MountError error_code,
+ void UnmountDevice(chromeos::MountError error_code,
const DiskMountManager::MountPointInfo& mount_info);
uint64 GetDeviceStorageSize(const std::string& device_location);
@@ -134,7 +131,7 @@ class StorageMonitorCrosTest : public testing::Test {
TestStorageMonitorCros* monitor_;
// Owned by DiskMountManager.
- disks::MockDiskMountManager* disk_mount_manager_mock_;
+ chromeos::disks::MockDiskMountManager* disk_mount_manager_mock_;
StorageMonitor::EjectStatus status_;
@@ -163,7 +160,7 @@ StorageMonitorCrosTest::~StorageMonitorCrosTest() {
void StorageMonitorCrosTest::SetUp() {
ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI));
ASSERT_TRUE(scoped_temp_dir_.CreateUniqueTempDir());
- disk_mount_manager_mock_ = new disks::MockDiskMountManager();
+ disk_mount_manager_mock_ = new chromeos::disks::MockDiskMountManager();
DiskMountManager::InitializeForTesting(disk_mount_manager_mock_);
disk_mount_manager_mock_->SetupDefaultReplies();
@@ -189,30 +186,28 @@ void StorageMonitorCrosTest::TearDown() {
}
void StorageMonitorCrosTest::MountDevice(
- MountError error_code,
+ chromeos::MountError error_code,
const DiskMountManager::MountPointInfo& mount_info,
const std::string& unique_id,
const std::string& device_label,
const std::string& vendor_name,
const std::string& product_name,
- DeviceType device_type,
+ chromeos::DeviceType device_type,
uint64 device_size_in_bytes) {
- if (error_code == MOUNT_ERROR_NONE) {
+ if (error_code == chromeos::MOUNT_ERROR_NONE) {
disk_mount_manager_mock_->CreateDiskEntryForMountDevice(
mount_info, unique_id, device_label, vendor_name, product_name,
device_type, device_size_in_bytes);
}
- monitor_->OnMountEvent(disks::DiskMountManager::MOUNTING, error_code,
- mount_info);
+ monitor_->OnMountEvent(DiskMountManager::MOUNTING, error_code, mount_info);
WaitForFileThread();
}
void StorageMonitorCrosTest::UnmountDevice(
- MountError error_code,
+ chromeos::MountError error_code,
const DiskMountManager::MountPointInfo& mount_info) {
- monitor_->OnMountEvent(disks::DiskMountManager::UNMOUNTING, error_code,
- mount_info);
- if (error_code == MOUNT_ERROR_NONE)
+ monitor_->OnMountEvent(DiskMountManager::UNMOUNTING, error_code, mount_info);
+ if (error_code == chromeos::MOUNT_ERROR_NONE)
disk_mount_manager_mock_->RemoveDiskEntryForMountDevice(mount_info);
WaitForFileThread();
}
@@ -259,12 +254,19 @@ void StorageMonitorCrosTest::EjectNotify(StorageMonitor::EjectStatus status) {
TEST_F(StorageMonitorCrosTest, BasicAttachDetach) {
base::FilePath mount_path1 = CreateMountPoint(kMountPointA, true);
ASSERT_FALSE(mount_path1.empty());
- DiskMountManager::MountPointInfo mount_info(kDevice1,
- mount_path1.value(),
- MOUNT_TYPE_DEVICE,
- disks::MOUNT_CONDITION_NONE);
- MountDevice(MOUNT_ERROR_NONE, mount_info, kUniqueId1, kDevice1Name,
- kVendorName, kProductName, DEVICE_TYPE_USB, kDevice1SizeInBytes);
+ DiskMountManager::MountPointInfo mount_info(
+ kDevice1,
+ mount_path1.value(),
+ chromeos::MOUNT_TYPE_DEVICE,
+ chromeos::disks::MOUNT_CONDITION_NONE);
+ MountDevice(chromeos::MOUNT_ERROR_NONE,
+ mount_info,
+ kUniqueId1,
+ kDevice1Name,
+ kVendorName,
+ kProductName,
+ chromeos::DEVICE_TYPE_USB,
+ kDevice1SizeInBytes);
EXPECT_EQ(1, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());
EXPECT_EQ(GetDCIMDeviceId(kUniqueId1),
@@ -272,7 +274,7 @@ TEST_F(StorageMonitorCrosTest, BasicAttachDetach) {
EXPECT_EQ(base::string16(), observer().last_attached().name());
EXPECT_EQ(mount_path1.value(), observer().last_attached().location());
- UnmountDevice(MOUNT_ERROR_NONE, mount_info);
+ UnmountDevice(chromeos::MOUNT_ERROR_NONE, mount_info);
EXPECT_EQ(1, observer().attach_calls());
EXPECT_EQ(1, observer().detach_calls());
EXPECT_EQ(GetDCIMDeviceId(kUniqueId1),
@@ -280,12 +282,19 @@ TEST_F(StorageMonitorCrosTest, BasicAttachDetach) {
base::FilePath mount_path2 = CreateMountPoint(kMountPointB, true);
ASSERT_FALSE(mount_path2.empty());
- DiskMountManager::MountPointInfo mount_info2(kDevice2,
- mount_path2.value(),
- MOUNT_TYPE_DEVICE,
- disks::MOUNT_CONDITION_NONE);
- MountDevice(MOUNT_ERROR_NONE, mount_info2, kUniqueId2, kDevice2Name,
- kVendorName, kProductName, DEVICE_TYPE_USB, kDevice2SizeInBytes);
+ DiskMountManager::MountPointInfo mount_info2(
+ kDevice2,
+ mount_path2.value(),
+ chromeos::MOUNT_TYPE_DEVICE,
+ chromeos::disks::MOUNT_CONDITION_NONE);
+ MountDevice(chromeos::MOUNT_ERROR_NONE,
+ mount_info2,
+ kUniqueId2,
+ kDevice2Name,
+ kVendorName,
+ kProductName,
+ chromeos::DEVICE_TYPE_USB,
+ kDevice2SizeInBytes);
EXPECT_EQ(2, observer().attach_calls());
EXPECT_EQ(1, observer().detach_calls());
EXPECT_EQ(GetDCIMDeviceId(kUniqueId2),
@@ -293,7 +302,7 @@ TEST_F(StorageMonitorCrosTest, BasicAttachDetach) {
EXPECT_EQ(base::string16(), observer().last_attached().name());
EXPECT_EQ(mount_path2.value(), observer().last_attached().location());
- UnmountDevice(MOUNT_ERROR_NONE, mount_info2);
+ UnmountDevice(chromeos::MOUNT_ERROR_NONE, mount_info2);
EXPECT_EQ(2, observer().attach_calls());
EXPECT_EQ(2, observer().detach_calls());
EXPECT_EQ(GetDCIMDeviceId(kUniqueId2),
@@ -306,15 +315,22 @@ TEST_F(StorageMonitorCrosTest, NoDCIM) {
base::FilePath mount_path = CreateMountPoint(kMountPointA, false);
const std::string kUniqueId = "FFFF-FFFF";
ASSERT_FALSE(mount_path.empty());
- DiskMountManager::MountPointInfo mount_info(kDevice1,
- mount_path.value(),
- MOUNT_TYPE_DEVICE,
- disks::MOUNT_CONDITION_NONE);
+ DiskMountManager::MountPointInfo mount_info(
+ kDevice1,
+ mount_path.value(),
+ chromeos::MOUNT_TYPE_DEVICE,
+ chromeos::disks::MOUNT_CONDITION_NONE);
const std::string device_id = StorageInfo::MakeDeviceId(
StorageInfo::REMOVABLE_MASS_STORAGE_NO_DCIM,
kFSUniqueIdPrefix + kUniqueId);
- MountDevice(MOUNT_ERROR_NONE, mount_info, kUniqueId, kDevice1Name,
- kVendorName, kProductName, DEVICE_TYPE_USB, kDevice1SizeInBytes);
+ MountDevice(chromeos::MOUNT_ERROR_NONE,
+ mount_info,
+ kUniqueId,
+ kDevice1Name,
+ kVendorName,
+ kProductName,
+ chromeos::DEVICE_TYPE_USB,
+ kDevice1SizeInBytes);
EXPECT_EQ(1, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());
EXPECT_EQ(device_id, observer().last_attached().device_id());
@@ -330,27 +346,47 @@ TEST_F(StorageMonitorCrosTest, Ignore) {
ASSERT_FALSE(mount_path.empty());
// Mount error.
- DiskMountManager::MountPointInfo mount_info(kDevice1,
- mount_path.value(),
- MOUNT_TYPE_DEVICE,
- disks::MOUNT_CONDITION_NONE);
- MountDevice(MOUNT_ERROR_UNKNOWN, mount_info, kUniqueId, kDevice1Name,
- kVendorName, kProductName, DEVICE_TYPE_USB, kDevice1SizeInBytes);
+ DiskMountManager::MountPointInfo mount_info(
+ kDevice1,
+ mount_path.value(),
+ chromeos::MOUNT_TYPE_DEVICE,
+ chromeos::disks::MOUNT_CONDITION_NONE);
+ MountDevice(chromeos::MOUNT_ERROR_UNKNOWN,
+ mount_info,
+ kUniqueId,
+ kDevice1Name,
+ kVendorName,
+ kProductName,
+ chromeos::DEVICE_TYPE_USB,
+ kDevice1SizeInBytes);
EXPECT_EQ(0, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());
// Not a device
- mount_info.mount_type = MOUNT_TYPE_ARCHIVE;
- MountDevice(MOUNT_ERROR_NONE, mount_info, kUniqueId, kDevice1Name,
- kVendorName, kProductName, DEVICE_TYPE_USB, kDevice1SizeInBytes);
+ mount_info.mount_type = chromeos::MOUNT_TYPE_ARCHIVE;
+ MountDevice(chromeos::MOUNT_ERROR_NONE,
+ mount_info,
+ kUniqueId,
+ kDevice1Name,
+ kVendorName,
+ kProductName,
+ chromeos::DEVICE_TYPE_USB,
+ kDevice1SizeInBytes);
EXPECT_EQ(0, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());
// Unsupported file system.
- mount_info.mount_type = MOUNT_TYPE_DEVICE;
- mount_info.mount_condition = disks::MOUNT_CONDITION_UNSUPPORTED_FILESYSTEM;
- MountDevice(MOUNT_ERROR_NONE, mount_info, kUniqueId, kDevice1Name,
- kVendorName, kProductName, DEVICE_TYPE_USB, kDevice1SizeInBytes);
+ mount_info.mount_type = chromeos::MOUNT_TYPE_DEVICE;
+ mount_info.mount_condition =
+ chromeos::disks::MOUNT_CONDITION_UNSUPPORTED_FILESYSTEM;
+ MountDevice(chromeos::MOUNT_ERROR_NONE,
+ mount_info,
+ kUniqueId,
+ kDevice1Name,
+ kVendorName,
+ kProductName,
+ chromeos::DEVICE_TYPE_USB,
+ kDevice1SizeInBytes);
EXPECT_EQ(0, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());
}
@@ -358,12 +394,19 @@ TEST_F(StorageMonitorCrosTest, Ignore) {
TEST_F(StorageMonitorCrosTest, SDCardAttachDetach) {
base::FilePath mount_path1 = CreateMountPoint(kSDCardMountPoint1, true);
ASSERT_FALSE(mount_path1.empty());
- DiskMountManager::MountPointInfo mount_info1(kSDCardDeviceName1,
- mount_path1.value(),
- MOUNT_TYPE_DEVICE,
- disks::MOUNT_CONDITION_NONE);
- MountDevice(MOUNT_ERROR_NONE, mount_info1, kUniqueId2, kSDCardDeviceName1,
- kVendorName, kProductName, DEVICE_TYPE_SD, kSDCardSizeInBytes);
+ DiskMountManager::MountPointInfo mount_info1(
+ kSDCardDeviceName1,
+ mount_path1.value(),
+ chromeos::MOUNT_TYPE_DEVICE,
+ chromeos::disks::MOUNT_CONDITION_NONE);
+ MountDevice(chromeos::MOUNT_ERROR_NONE,
+ mount_info1,
+ kUniqueId2,
+ kSDCardDeviceName1,
+ kVendorName,
+ kProductName,
+ chromeos::DEVICE_TYPE_SD,
+ kSDCardSizeInBytes);
EXPECT_EQ(1, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());
EXPECT_EQ(GetDCIMDeviceId(kUniqueId2),
@@ -371,7 +414,7 @@ TEST_F(StorageMonitorCrosTest, SDCardAttachDetach) {
EXPECT_EQ(base::string16(), observer().last_attached().name());
EXPECT_EQ(mount_path1.value(), observer().last_attached().location());
- UnmountDevice(MOUNT_ERROR_NONE, mount_info1);
+ UnmountDevice(chromeos::MOUNT_ERROR_NONE, mount_info1);
EXPECT_EQ(1, observer().attach_calls());
EXPECT_EQ(1, observer().detach_calls());
EXPECT_EQ(GetDCIMDeviceId(kUniqueId2),
@@ -379,12 +422,19 @@ TEST_F(StorageMonitorCrosTest, SDCardAttachDetach) {
base::FilePath mount_path2 = CreateMountPoint(kSDCardMountPoint2, true);
ASSERT_FALSE(mount_path2.empty());
- DiskMountManager::MountPointInfo mount_info2(kSDCardDeviceName2,
- mount_path2.value(),
- MOUNT_TYPE_DEVICE,
- disks::MOUNT_CONDITION_NONE);
- MountDevice(MOUNT_ERROR_NONE, mount_info2, kUniqueId2, kSDCardDeviceName2,
- kVendorName, kProductName, DEVICE_TYPE_SD, kSDCardSizeInBytes);
+ DiskMountManager::MountPointInfo mount_info2(
+ kSDCardDeviceName2,
+ mount_path2.value(),
+ chromeos::MOUNT_TYPE_DEVICE,
+ chromeos::disks::MOUNT_CONDITION_NONE);
+ MountDevice(chromeos::MOUNT_ERROR_NONE,
+ mount_info2,
+ kUniqueId2,
+ kSDCardDeviceName2,
+ kVendorName,
+ kProductName,
+ chromeos::DEVICE_TYPE_SD,
+ kSDCardSizeInBytes);
EXPECT_EQ(2, observer().attach_calls());
EXPECT_EQ(1, observer().detach_calls());
EXPECT_EQ(GetDCIMDeviceId(kUniqueId2),
@@ -392,7 +442,7 @@ TEST_F(StorageMonitorCrosTest, SDCardAttachDetach) {
EXPECT_EQ(base::string16(), observer().last_attached().name());
EXPECT_EQ(mount_path2.value(), observer().last_attached().location());
- UnmountDevice(MOUNT_ERROR_NONE, mount_info2);
+ UnmountDevice(chromeos::MOUNT_ERROR_NONE, mount_info2);
EXPECT_EQ(2, observer().attach_calls());
EXPECT_EQ(2, observer().detach_calls());
EXPECT_EQ(GetDCIMDeviceId(kUniqueId2),
@@ -402,12 +452,19 @@ TEST_F(StorageMonitorCrosTest, SDCardAttachDetach) {
TEST_F(StorageMonitorCrosTest, AttachDeviceWithEmptyLabel) {
base::FilePath mount_path1 = CreateMountPoint(kMountPointA, true);
ASSERT_FALSE(mount_path1.empty());
- DiskMountManager::MountPointInfo mount_info(kEmptyDeviceLabel,
- mount_path1.value(),
- MOUNT_TYPE_DEVICE,
- disks::MOUNT_CONDITION_NONE);
- MountDevice(MOUNT_ERROR_NONE, mount_info, kUniqueId1, kEmptyDeviceLabel,
- kVendorName, kProductName, DEVICE_TYPE_USB, kDevice1SizeInBytes);
+ DiskMountManager::MountPointInfo mount_info(
+ kEmptyDeviceLabel,
+ mount_path1.value(),
+ chromeos::MOUNT_TYPE_DEVICE,
+ chromeos::disks::MOUNT_CONDITION_NONE);
+ MountDevice(chromeos::MOUNT_ERROR_NONE,
+ mount_info,
+ kUniqueId1,
+ kEmptyDeviceLabel,
+ kVendorName,
+ kProductName,
+ chromeos::DEVICE_TYPE_USB,
+ kDevice1SizeInBytes);
EXPECT_EQ(1, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());
EXPECT_EQ(GetDCIMDeviceId(kUniqueId1),
@@ -415,7 +472,7 @@ TEST_F(StorageMonitorCrosTest, AttachDeviceWithEmptyLabel) {
EXPECT_EQ(base::string16(), observer().last_attached().name());
EXPECT_EQ(mount_path1.value(), observer().last_attached().location());
- UnmountDevice(MOUNT_ERROR_NONE, mount_info);
+ UnmountDevice(chromeos::MOUNT_ERROR_NONE, mount_info);
EXPECT_EQ(1, observer().attach_calls());
EXPECT_EQ(1, observer().detach_calls());
EXPECT_EQ(GetDCIMDeviceId(kUniqueId1),
@@ -425,12 +482,19 @@ TEST_F(StorageMonitorCrosTest, AttachDeviceWithEmptyLabel) {
TEST_F(StorageMonitorCrosTest, GetStorageSize) {
base::FilePath mount_path1 = CreateMountPoint(kMountPointA, true);
ASSERT_FALSE(mount_path1.empty());
- DiskMountManager::MountPointInfo mount_info(kEmptyDeviceLabel,
- mount_path1.value(),
- MOUNT_TYPE_DEVICE,
- disks::MOUNT_CONDITION_NONE);
- MountDevice(MOUNT_ERROR_NONE, mount_info, kUniqueId1, kEmptyDeviceLabel,
- kVendorName, kProductName, DEVICE_TYPE_USB, kDevice1SizeInBytes);
+ DiskMountManager::MountPointInfo mount_info(
+ kEmptyDeviceLabel,
+ mount_path1.value(),
+ chromeos::MOUNT_TYPE_DEVICE,
+ chromeos::disks::MOUNT_CONDITION_NONE);
+ MountDevice(chromeos::MOUNT_ERROR_NONE,
+ mount_info,
+ kUniqueId1,
+ kEmptyDeviceLabel,
+ kVendorName,
+ kProductName,
+ chromeos::DEVICE_TYPE_USB,
+ kDevice1SizeInBytes);
EXPECT_EQ(1, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());
EXPECT_EQ(GetDCIMDeviceId(kUniqueId1),
@@ -439,7 +503,7 @@ TEST_F(StorageMonitorCrosTest, GetStorageSize) {
EXPECT_EQ(mount_path1.value(), observer().last_attached().location());
EXPECT_EQ(kDevice1SizeInBytes, GetDeviceStorageSize(mount_path1.value()));
- UnmountDevice(MOUNT_ERROR_NONE, mount_info);
+ UnmountDevice(chromeos::MOUNT_ERROR_NONE, mount_info);
EXPECT_EQ(1, observer().attach_calls());
EXPECT_EQ(1, observer().detach_calls());
EXPECT_EQ(GetDCIMDeviceId(kUniqueId1),
@@ -447,7 +511,7 @@ TEST_F(StorageMonitorCrosTest, GetStorageSize) {
}
void UnmountFake(const std::string& location,
- UnmountOptions options,
+ chromeos::UnmountOptions options,
const DiskMountManager::UnmountPathCallback& cb) {
cb.Run(chromeos::MOUNT_ERROR_NONE);
}
@@ -455,12 +519,19 @@ void UnmountFake(const std::string& location,
TEST_F(StorageMonitorCrosTest, EjectTest) {
base::FilePath mount_path1 = CreateMountPoint(kMountPointA, true);
ASSERT_FALSE(mount_path1.empty());
- DiskMountManager::MountPointInfo mount_info(kEmptyDeviceLabel,
- mount_path1.value(),
- MOUNT_TYPE_DEVICE,
- disks::MOUNT_CONDITION_NONE);
- MountDevice(MOUNT_ERROR_NONE, mount_info, kUniqueId1, kEmptyDeviceLabel,
- kVendorName, kProductName, DEVICE_TYPE_USB, kDevice1SizeInBytes);
+ DiskMountManager::MountPointInfo mount_info(
+ kEmptyDeviceLabel,
+ mount_path1.value(),
+ chromeos::MOUNT_TYPE_DEVICE,
+ chromeos::disks::MOUNT_CONDITION_NONE);
+ MountDevice(chromeos::MOUNT_ERROR_NONE,
+ mount_info,
+ kUniqueId1,
+ kEmptyDeviceLabel,
+ kVendorName,
+ kProductName,
+ chromeos::DEVICE_TYPE_USB,
+ kDevice1SizeInBytes);
EXPECT_EQ(1, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());
@@ -478,4 +549,4 @@ TEST_F(StorageMonitorCrosTest, EjectTest) {
} // namespace
-} // namespace chromeos
+} // namespace storage_monitor
diff --git a/components/storage_monitor/storage_monitor_linux.cc b/components/storage_monitor/storage_monitor_linux.cc
index f18a133..76cfdfd 100644
--- a/components/storage_monitor/storage_monitor_linux.cc
+++ b/components/storage_monitor/storage_monitor_linux.cc
@@ -28,6 +28,9 @@
#include "device/media_transfer_protocol/media_transfer_protocol_manager.h"
using content::BrowserThread;
+
+namespace storage_monitor {
+
typedef MtabWatcherLinux::MountPointDeviceMap MountPointDeviceMap;
namespace {
@@ -500,3 +503,5 @@ StorageMonitor* StorageMonitor::CreateInternal() {
const base::FilePath kDefaultMtabPath("/etc/mtab");
return new StorageMonitorLinux(kDefaultMtabPath);
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/storage_monitor_linux.h b/components/storage_monitor/storage_monitor_linux.h
index 74ee260..9bd0e13 100644
--- a/components/storage_monitor/storage_monitor_linux.h
+++ b/components/storage_monitor/storage_monitor_linux.h
@@ -28,6 +28,8 @@
#include "components/storage_monitor/storage_monitor.h"
#include "content/public/browser/browser_thread.h"
+namespace storage_monitor {
+
class MediaTransferProtocolDeviceObserverLinux;
class StorageMonitorLinux : public StorageMonitor,
@@ -139,4 +141,6 @@ class StorageMonitorLinux : public StorageMonitor,
DISALLOW_COPY_AND_ASSIGN(StorageMonitorLinux);
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_LINUX_H_
diff --git a/components/storage_monitor/storage_monitor_linux_unittest.cc b/components/storage_monitor/storage_monitor_linux_unittest.cc
index 3b37e0a..7949ae0 100644
--- a/components/storage_monitor/storage_monitor_linux_unittest.cc
+++ b/components/storage_monitor/storage_monitor_linux_unittest.cc
@@ -26,6 +26,8 @@
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace storage_monitor {
+
namespace {
const char kValidFS[] = "vfat";
@@ -679,3 +681,5 @@ TEST_F(StorageMonitorLinuxTest, DevicePartitionSize) {
}
} // namespace
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/storage_monitor_mac.h b/components/storage_monitor/storage_monitor_mac.h
index 7fa1231..f107058 100644
--- a/components/storage_monitor/storage_monitor_mac.h
+++ b/components/storage_monitor/storage_monitor_mac.h
@@ -12,6 +12,8 @@
#include "base/memory/weak_ptr.h"
#include "components/storage_monitor/storage_monitor.h"
+namespace storage_monitor {
+
class ImageCaptureDeviceManager;
// This class posts notifications to listeners when a new disk
@@ -69,4 +71,6 @@ class StorageMonitorMac : public StorageMonitor,
DISALLOW_COPY_AND_ASSIGN(StorageMonitorMac);
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_MAC_H_
diff --git a/components/storage_monitor/storage_monitor_mac.mm b/components/storage_monitor/storage_monitor_mac.mm
index b326749..a2ba2e3 100644
--- a/components/storage_monitor/storage_monitor_mac.mm
+++ b/components/storage_monitor/storage_monitor_mac.mm
@@ -13,6 +13,8 @@
#include "components/storage_monitor/storage_info.h"
#include "content/public/browser/browser_thread.h"
+namespace storage_monitor {
+
namespace {
const char kDiskImageModelName[] = "Disk Image";
@@ -385,3 +387,5 @@ bool StorageMonitorMac::FindDiskWithMountPoint(
StorageMonitor* StorageMonitor::CreateInternal() {
return new StorageMonitorMac();
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/storage_monitor_mac_unittest.mm b/components/storage_monitor/storage_monitor_mac_unittest.mm
index 9b63601..f8d79b3 100644
--- a/components/storage_monitor/storage_monitor_mac_unittest.mm
+++ b/components/storage_monitor/storage_monitor_mac_unittest.mm
@@ -21,6 +21,8 @@
uint64 kTestSize = 1000000ULL;
+namespace storage_monitor {
+
namespace {
StorageInfo CreateStorageInfo(
@@ -171,3 +173,5 @@ TEST_F(StorageMonitorMacTest, DMG) {
UpdateDisk(info, StorageMonitorMac::UPDATE_DEVICE_ADDED);
EXPECT_EQ(0, mock_storage_observer_->attach_calls());
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/storage_monitor_unittest.cc b/components/storage_monitor/storage_monitor_unittest.cc
index 82a6574..dd11ed7 100644
--- a/components/storage_monitor/storage_monitor_unittest.cc
+++ b/components/storage_monitor/storage_monitor_unittest.cc
@@ -18,6 +18,8 @@ void SetLatch(bool* called) {
} // namespace
+namespace storage_monitor {
+
TEST(StorageMonitorTest, TestInitialize) {
TestStorageMonitor::Destroy();
TestStorageMonitor monitor;
@@ -133,3 +135,5 @@ TEST(StorageMonitorTest, GetAllAvailableStorageAttachDetach) {
devices = monitor.GetAllAvailableStorages();
EXPECT_EQ(0U, devices.size());
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/storage_monitor_win.cc b/components/storage_monitor/storage_monitor_win.cc
index ccc8aec..fb721bb 100644
--- a/components/storage_monitor/storage_monitor_win.cc
+++ b/components/storage_monitor/storage_monitor_win.cc
@@ -16,6 +16,8 @@
// StorageMonitorWin -------------------------------------------------------
+namespace storage_monitor {
+
StorageMonitorWin::StorageMonitorWin(
VolumeMountWatcherWin* volume_mount_watcher,
PortableDeviceWatcherWin* portable_device_watcher)
@@ -162,3 +164,5 @@ StorageMonitor* StorageMonitor::CreateInternal() {
return new StorageMonitorWin(new VolumeMountWatcherWin(),
new PortableDeviceWatcherWin());
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/storage_monitor_win.h b/components/storage_monitor/storage_monitor_win.h
index 773c7fe..f59b3c3 100644
--- a/components/storage_monitor/storage_monitor_win.h
+++ b/components/storage_monitor/storage_monitor_win.h
@@ -14,6 +14,8 @@ namespace base {
class FilePath;
}
+namespace storage_monitor {
+
class PortableDeviceWatcherWin;
class TestStorageMonitorWin;
class VolumeMountWatcherWin;
@@ -78,4 +80,6 @@ class StorageMonitorWin : public StorageMonitor {
DISALLOW_COPY_AND_ASSIGN(StorageMonitorWin);
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_WIN_H_
diff --git a/components/storage_monitor/storage_monitor_win_unittest.cc b/components/storage_monitor/storage_monitor_win_unittest.cc
index 6ef9e0d..40645a8 100644
--- a/components/storage_monitor/storage_monitor_win_unittest.cc
+++ b/components/storage_monitor/storage_monitor_win_unittest.cc
@@ -34,6 +34,8 @@ typedef std::vector<int> DeviceIndices;
// StorageMonitorWinTest -------------------------------------------------------
+namespace storage_monitor {
+
class StorageMonitorWinTest : public testing::Test {
public:
StorageMonitorWinTest();
@@ -544,3 +546,5 @@ TEST_F(StorageMonitorWinTest, GetMTPStorageInfoFromDeviceId) {
}
DoMTPDeviceTest(TestPortableDeviceWatcherWin::kMTPDeviceWithValidInfo, false);
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/test_media_transfer_protocol_manager_linux.cc b/components/storage_monitor/test_media_transfer_protocol_manager_linux.cc
index 0fdfe50..2763d30 100644
--- a/components/storage_monitor/test_media_transfer_protocol_manager_linux.cc
+++ b/components/storage_monitor/test_media_transfer_protocol_manager_linux.cc
@@ -6,6 +6,8 @@
#include "device/media_transfer_protocol/mtp_file_entry.pb.h"
+namespace storage_monitor {
+
TestMediaTransferProtocolManagerLinux::
TestMediaTransferProtocolManagerLinux() {}
@@ -84,3 +86,5 @@ void TestMediaTransferProtocolManagerLinux::GetFileInfoById(
const GetFileInfoCallback& callback) {
callback.Run(MtpFileEntry(), true);
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/test_media_transfer_protocol_manager_linux.h b/components/storage_monitor/test_media_transfer_protocol_manager_linux.h
index 34d163b..b2ccc4e 100644
--- a/components/storage_monitor/test_media_transfer_protocol_manager_linux.h
+++ b/components/storage_monitor/test_media_transfer_protocol_manager_linux.h
@@ -7,6 +7,8 @@
#include "device/media_transfer_protocol/media_transfer_protocol_manager.h"
+namespace storage_monitor {
+
// A dummy MediaTransferProtocolManager implementation.
class TestMediaTransferProtocolManagerLinux
: public device::MediaTransferProtocolManager {
@@ -54,4 +56,6 @@ class TestMediaTransferProtocolManagerLinux
DISALLOW_COPY_AND_ASSIGN(TestMediaTransferProtocolManagerLinux);
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_TEST_MEDIA_TRANSFER_PROTOCOL_MANAGER_LINUX_H_
diff --git a/components/storage_monitor/test_portable_device_watcher_win.cc b/components/storage_monitor/test_portable_device_watcher_win.cc
index 5a85a25..03ef756 100644
--- a/components/storage_monitor/test_portable_device_watcher_win.cc
+++ b/components/storage_monitor/test_portable_device_watcher_win.cc
@@ -10,6 +10,8 @@
#include "base/strings/utf_string_conversions.h"
+namespace storage_monitor {
+
namespace {
// Sample MTP device storage information.
@@ -143,3 +145,5 @@ bool TestPortableDeviceWatcherWin::GetMTPStorageInfoFromDeviceId(
return PortableDeviceWatcherWin::GetMTPStorageInfoFromDeviceId(
storage_device_id, device_location, storage_object_id);
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/test_portable_device_watcher_win.h b/components/storage_monitor/test_portable_device_watcher_win.h
index 976a5ac..ed773ed 100644
--- a/components/storage_monitor/test_portable_device_watcher_win.h
+++ b/components/storage_monitor/test_portable_device_watcher_win.h
@@ -13,6 +13,8 @@
#include "base/strings/string16.h"
#include "components/storage_monitor/portable_device_watcher_win.h"
+namespace storage_monitor {
+
class TestPortableDeviceWatcherWin : public PortableDeviceWatcherWin {
public:
// MTP device PnP identifiers.
@@ -73,4 +75,6 @@ class TestPortableDeviceWatcherWin : public PortableDeviceWatcherWin {
DISALLOW_COPY_AND_ASSIGN(TestPortableDeviceWatcherWin);
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_TEST_PORTABLE_DEVICE_WATCHER_WIN_H_
diff --git a/components/storage_monitor/test_storage_monitor.cc b/components/storage_monitor/test_storage_monitor.cc
index 5be63dd..34cca9b 100644
--- a/components/storage_monitor/test_storage_monitor.cc
+++ b/components/storage_monitor/test_storage_monitor.cc
@@ -13,6 +13,8 @@
#include "device/media_transfer_protocol/media_transfer_protocol_manager.h"
#endif
+namespace storage_monitor {
+
TestStorageMonitor::TestStorageMonitor()
: StorageMonitor(),
init_called_(false) {
@@ -116,3 +118,5 @@ void TestStorageMonitor::EjectDevice(
ejected_device_ = device_id;
callback.Run(EJECT_OK);
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/test_storage_monitor.h b/components/storage_monitor/test_storage_monitor.h
index bdd0537..9b37304 100644
--- a/components/storage_monitor/test_storage_monitor.h
+++ b/components/storage_monitor/test_storage_monitor.h
@@ -9,6 +9,8 @@
#include "components/storage_monitor/storage_monitor.h"
+namespace storage_monitor {
+
class TestStorageMonitor : public StorageMonitor {
public:
TestStorageMonitor();
@@ -72,4 +74,6 @@ class TestStorageMonitor : public StorageMonitor {
#endif
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_TEST_STORAGE_MONITOR_H_
diff --git a/components/storage_monitor/test_storage_monitor_win.cc b/components/storage_monitor/test_storage_monitor_win.cc
index 7e12e64..63dec3d 100644
--- a/components/storage_monitor/test_storage_monitor_win.cc
+++ b/components/storage_monitor/test_storage_monitor_win.cc
@@ -9,6 +9,8 @@
#include "components/storage_monitor/test_portable_device_watcher_win.h"
#include "components/storage_monitor/test_volume_mount_watcher_win.h"
+namespace storage_monitor {
+
TestStorageMonitorWin::TestStorageMonitorWin(
TestVolumeMountWatcherWin* volume_mount_watcher,
TestPortableDeviceWatcherWin* portable_device_watcher)
@@ -32,3 +34,5 @@ TestStorageMonitorWin::volume_mount_watcher() {
StorageMonitor::Receiver* TestStorageMonitorWin::receiver() const {
return StorageMonitor::receiver();
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/test_storage_monitor_win.h b/components/storage_monitor/test_storage_monitor_win.h
index dd14a76..1280a7a 100644
--- a/components/storage_monitor/test_storage_monitor_win.h
+++ b/components/storage_monitor/test_storage_monitor_win.h
@@ -13,6 +13,8 @@
#include "base/memory/ref_counted.h"
#include "components/storage_monitor/storage_monitor_win.h"
+namespace storage_monitor {
+
class TestPortableDeviceWatcherWin;
class TestVolumeMountWatcherWin;
@@ -34,4 +36,6 @@ class TestStorageMonitorWin: public StorageMonitorWin {
DISALLOW_COPY_AND_ASSIGN(TestStorageMonitorWin);
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_TEST_STORAGE_MONITOR_WIN_H_
diff --git a/components/storage_monitor/test_volume_mount_watcher_win.cc b/components/storage_monitor/test_volume_mount_watcher_win.cc
index f5591f5..50c22b5 100644
--- a/components/storage_monitor/test_volume_mount_watcher_win.cc
+++ b/components/storage_monitor/test_volume_mount_watcher_win.cc
@@ -12,6 +12,8 @@
#include "base/strings/utf_string_conversions.h"
#include "components/storage_monitor/storage_info.h"
+namespace storage_monitor {
+
namespace {
base::FilePath GetTempRoot() {
@@ -151,3 +153,5 @@ VolumeMountWatcherWin::GetAttachedDevicesCallbackType
void TestVolumeMountWatcherWin::ShutdownWorkerPool() {
device_info_worker_pool_->Shutdown();
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/test_volume_mount_watcher_win.h b/components/storage_monitor/test_volume_mount_watcher_win.h
index 35060db..280a034 100644
--- a/components/storage_monitor/test_volume_mount_watcher_win.h
+++ b/components/storage_monitor/test_volume_mount_watcher_win.h
@@ -19,6 +19,8 @@ namespace base {
class FilePath;
}
+namespace storage_monitor {
+
class TestVolumeMountWatcherWin : public VolumeMountWatcherWin {
public:
TestVolumeMountWatcherWin();
@@ -64,4 +66,6 @@ class TestVolumeMountWatcherWin : public VolumeMountWatcherWin {
DISALLOW_COPY_AND_ASSIGN(TestVolumeMountWatcherWin);
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_TEST_VOLUME_MOUNT_WATCHER_WIN_H_
diff --git a/components/storage_monitor/transient_device_ids.cc b/components/storage_monitor/transient_device_ids.cc
index c69d251..3f19302 100644
--- a/components/storage_monitor/transient_device_ids.cc
+++ b/components/storage_monitor/transient_device_ids.cc
@@ -11,6 +11,8 @@
#include "base/stl_util.h"
#include "components/storage_monitor/storage_info.h"
+namespace storage_monitor {
+
TransientDeviceIds::TransientDeviceIds() {}
TransientDeviceIds::~TransientDeviceIds() {}
@@ -39,3 +41,5 @@ std::string TransientDeviceIds::DeviceIdFromTransientId(
return std::string();
return it->second;
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/transient_device_ids.h b/components/storage_monitor/transient_device_ids.h
index 7ebf0a2..53227a9 100644
--- a/components/storage_monitor/transient_device_ids.h
+++ b/components/storage_monitor/transient_device_ids.h
@@ -16,6 +16,8 @@
#include "base/basictypes.h"
#include "base/threading/thread_checker.h"
+namespace storage_monitor {
+
class TransientDeviceIds {
public:
TransientDeviceIds();
@@ -42,4 +44,6 @@ class TransientDeviceIds {
DISALLOW_COPY_AND_ASSIGN(TransientDeviceIds);
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_TRANSIENT_DEVICE_IDS_H_
diff --git a/components/storage_monitor/udev_util_linux.cc b/components/storage_monitor/udev_util_linux.cc
index db32f82..142a54e 100644
--- a/components/storage_monitor/udev_util_linux.cc
+++ b/components/storage_monitor/udev_util_linux.cc
@@ -6,6 +6,8 @@
#include "base/files/file_path.h"
+namespace storage_monitor {
+
void UdevDeleter::operator()(struct udev* udev) {
udev_unref(udev);
}
@@ -33,3 +35,5 @@ bool GetUdevDevicePropertyValueByPath(const base::FilePath& device_path,
*result = GetUdevDevicePropertyValue(device.get(), key);
return true;
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/udev_util_linux.h b/components/storage_monitor/udev_util_linux.h
index 203f282..108816b 100644
--- a/components/storage_monitor/udev_util_linux.h
+++ b/components/storage_monitor/udev_util_linux.h
@@ -15,6 +15,8 @@ namespace base {
class FilePath;
}
+namespace storage_monitor {
+
// Deleter for ScopedUdevObject.
struct UdevDeleter {
void operator()(struct udev* udev);
@@ -39,4 +41,6 @@ bool GetUdevDevicePropertyValueByPath(const base::FilePath& device_path,
const char* key,
std::string* result);
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_
diff --git a/components/storage_monitor/volume_mount_watcher_win.cc b/components/storage_monitor/volume_mount_watcher_win.cc
index fe82720..101cbda 100644
--- a/components/storage_monitor/volume_mount_watcher_win.cc
+++ b/components/storage_monitor/volume_mount_watcher_win.cc
@@ -27,6 +27,8 @@
using content::BrowserThread;
+namespace storage_monitor {
+
namespace {
const DWORD kMaxPathBufLen = MAX_PATH + 1;
@@ -526,3 +528,5 @@ void VolumeMountWatcherWin::EjectDevice(
FROM_HERE,
base::Bind(&EjectDeviceInThreadPool, device, callback, task_runner_, 0));
}
+
+} // namespace storage_monitor
diff --git a/components/storage_monitor/volume_mount_watcher_win.h b/components/storage_monitor/volume_mount_watcher_win.h
index 5168671..0940d5c 100644
--- a/components/storage_monitor/volume_mount_watcher_win.h
+++ b/components/storage_monitor/volume_mount_watcher_win.h
@@ -20,6 +20,8 @@
#include "components/storage_monitor/storage_info.h"
#include "components/storage_monitor/storage_monitor.h"
+namespace storage_monitor {
+
class TestVolumeMountWatcherWin;
// This class watches the volume mount points and sends notifications to
@@ -116,4 +118,6 @@ class VolumeMountWatcherWin {
DISALLOW_COPY_AND_ASSIGN(VolumeMountWatcherWin);
};
+} // namespace storage_monitor
+
#endif // COMPONENTS_STORAGE_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_