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

Unified Diff: chrome/browser/chromeos/extensions/file_browser_event_router.cc

Issue 8386031: Move chromeos_mount.cc from libcros to Chrome tree (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up format Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/extensions/file_browser_event_router.cc
diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.cc b/chrome/browser/chromeos/extensions/file_browser_event_router.cc
index b7fbc6893d04a92b936356f728b6079dc6a92dfe..098d5bb0194409b1d7b4d4e6500733838e747888 100644
--- a/chrome/browser/chromeos/extensions/file_browser_event_router.cc
+++ b/chrome/browser/chromeos/extensions/file_browser_event_router.cc
@@ -9,7 +9,7 @@
#include "base/message_loop.h"
#include "base/stl_util.h"
#include "base/values.h"
-#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
#include "chrome/browser/chromeos/extensions/file_browser_notifications.h"
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/extensions/extension_event_names.h"
@@ -45,7 +45,7 @@ namespace {
}
DictionaryValue* DiskToDictionaryValue(
- const chromeos::MountLibrary::Disk* disk) {
+ const chromeos::CrosDisksClient::Disk* disk) {
DictionaryValue* result = new DictionaryValue();
result->SetString("mountPath", disk->mount_path());
result->SetString("devicePath", disk->device_path());
@@ -95,10 +95,8 @@ ExtensionFileBrowserEventRouter::~ExtensionFileBrowserEventRouter() {
return;
}
profile_ = NULL;
- if (!chromeos::CrosLibrary::Get()->EnsureLoaded())
- return;
- chromeos::MountLibrary* lib =
- chromeos::CrosLibrary::Get()->GetMountLibrary();
+ chromeos::CrosDisksClient* lib =
satorux1 2011/11/07 23:21:55 lib -> client ?
hashimoto 2011/11/08 07:31:05 Done.
+ chromeos::DBusThreadManager::Get()->GetCrosDisksClient();
lib->RemoveObserver(this);
}
@@ -107,11 +105,9 @@ void ExtensionFileBrowserEventRouter::ObserveFileSystemEvents() {
NOTREACHED();
return;
}
- if (!chromeos::CrosLibrary::Get()->EnsureLoaded())
- return;
if (chromeos::UserManager::Get()->user_is_logged_in()) {
- chromeos::MountLibrary* lib =
- chromeos::CrosLibrary::Get()->GetMountLibrary();
+ chromeos::CrosDisksClient* lib =
+ chromeos::DBusThreadManager::Get()->GetCrosDisksClient();
lib->RemoveObserver(this);
lib->AddObserver(this);
lib->RequestMountInfoRefresh();
@@ -156,8 +152,8 @@ void ExtensionFileBrowserEventRouter::RemoveFileWatch(
}
void ExtensionFileBrowserEventRouter::DiskChanged(
- chromeos::MountLibraryEventType event,
- const chromeos::MountLibrary::Disk* disk) {
+ chromeos::CrosDisksClientEventType event,
+ const chromeos::CrosDisksClient::Disk* disk) {
// Disregard hidden devices.
if (disk->is_hidden())
return;
@@ -169,7 +165,7 @@ void ExtensionFileBrowserEventRouter::DiskChanged(
}
void ExtensionFileBrowserEventRouter::DeviceChanged(
- chromeos::MountLibraryEventType event,
+ chromeos::CrosDisksClientEventType event,
const std::string& device_path) {
if (event == chromeos::MOUNT_DEVICE_ADDED) {
OnDeviceAdded(device_path);
@@ -194,21 +190,21 @@ void ExtensionFileBrowserEventRouter::DeviceChanged(
}
void ExtensionFileBrowserEventRouter::MountCompleted(
- chromeos::MountLibrary::MountEvent event_type,
+ chromeos::CrosDisksClient::MountEvent event_type,
chromeos::MountError error_code,
- const chromeos::MountLibrary::MountPointInfo& mount_info) {
+ const chromeos::CrosDisksClient::MountPointInfo& mount_info) {
DispatchMountCompletedEvent(event_type, error_code, mount_info);
if (mount_info.mount_type == chromeos::MOUNT_TYPE_DEVICE &&
- event_type == chromeos::MountLibrary::MOUNTING) {
- chromeos::MountLibrary* mount_lib =
- chromeos::CrosLibrary::Get()->GetMountLibrary();
- chromeos::MountLibrary::DiskMap::const_iterator disk_it =
+ event_type == chromeos::CrosDisksClient::MOUNTING) {
+ chromeos::CrosDisksClient* mount_lib =
+ chromeos::DBusThreadManager::Get()->GetCrosDisksClient();
+ chromeos::CrosDisksClient::DiskMap::const_iterator disk_it =
mount_lib->disks().find(mount_info.source_path);
if (disk_it == mount_lib->disks().end()) {
return;
}
- chromeos::MountLibrary::Disk* disk = disk_it->second;
+ chromeos::CrosDisksClient::Disk* disk = disk_it->second;
notifications_->ManageNotificationsOnMountCompleted(
disk->system_path_prefix(), disk->drive_label(), disk->is_parent(),
@@ -261,7 +257,7 @@ void ExtensionFileBrowserEventRouter::DispatchFolderChangeEvent(
}
void ExtensionFileBrowserEventRouter::DispatchDiskEvent(
- const chromeos::MountLibrary::Disk* disk, bool added) {
+ const chromeos::CrosDisksClient::Disk* disk, bool added) {
if (!profile_) {
NOTREACHED();
return;
@@ -283,9 +279,9 @@ void ExtensionFileBrowserEventRouter::DispatchDiskEvent(
}
void ExtensionFileBrowserEventRouter::DispatchMountCompletedEvent(
- chromeos::MountLibrary::MountEvent event,
+ chromeos::CrosDisksClient::MountEvent event,
chromeos::MountError error_code,
- const chromeos::MountLibrary::MountPointInfo& mount_info) {
+ const chromeos::CrosDisksClient::MountPointInfo& mount_info) {
if (!profile_ || mount_info.mount_type == chromeos::MOUNT_TYPE_INVALID) {
NOTREACHED();
return;
@@ -294,14 +290,14 @@ void ExtensionFileBrowserEventRouter::DispatchMountCompletedEvent(
ListValue args;
DictionaryValue* mount_info_value = new DictionaryValue();
args.Append(mount_info_value);
- if (event == chromeos::MountLibrary::MOUNTING) {
+ if (event == chromeos::CrosDisksClient::MOUNTING) {
mount_info_value->SetString("eventType", "mount");
} else {
mount_info_value->SetString("eventType", "unmount");
}
mount_info_value->SetString("status", MountErrorToString(error_code));
mount_info_value->SetString("mountType",
- chromeos::MountLibrary::MountTypeToString(mount_info.mount_type));
+ chromeos::CrosDisksClient::MountTypeToString(mount_info.mount_type));
if (mount_info.mount_type == chromeos::MOUNT_TYPE_ARCHIVE) {
GURL source_url;
@@ -342,13 +338,13 @@ void ExtensionFileBrowserEventRouter::DispatchMountCompletedEvent(
if (relative_mount_path_set &&
mount_info.mount_type == chromeos::MOUNT_TYPE_DEVICE &&
!mount_info.mount_condition &&
- event == chromeos::MountLibrary::MOUNTING) {
+ event == chromeos::CrosDisksClient::MOUNTING) {
FileManagerUtil::ShowFullTabUrl(profile_, FilePath(mount_info.mount_path));
}
}
void ExtensionFileBrowserEventRouter::OnDiskAdded(
- const chromeos::MountLibrary::Disk* disk) {
+ const chromeos::CrosDisksClient::Disk* disk) {
VLOG(1) << "Disk added: " << disk->device_path();
if (disk->device_path().empty()) {
VLOG(1) << "Empty system path for " << disk->device_path();
@@ -358,8 +354,8 @@ void ExtensionFileBrowserEventRouter::OnDiskAdded(
// If disk is not mounted yet, give it a try.
if (disk->mount_path().empty()) {
// Initiate disk mount operation.
- chromeos::MountLibrary* lib =
- chromeos::CrosLibrary::Get()->GetMountLibrary();
+ chromeos::CrosDisksClient* lib =
+ chromeos::DBusThreadManager::Get()->GetCrosDisksClient();
lib->MountPath(disk->device_path().c_str(),
chromeos::MOUNT_TYPE_DEVICE,
chromeos::MountPathOptions()); // Unused.
@@ -368,12 +364,12 @@ void ExtensionFileBrowserEventRouter::OnDiskAdded(
}
void ExtensionFileBrowserEventRouter::OnDiskRemoved(
- const chromeos::MountLibrary::Disk* disk) {
+ const chromeos::CrosDisksClient::Disk* disk) {
VLOG(1) << "Disk removed: " << disk->device_path();
if (!disk->mount_path().empty()) {
- chromeos::MountLibrary* lib =
- chromeos::CrosLibrary::Get()->GetMountLibrary();
+ chromeos::CrosDisksClient* lib =
+ chromeos::DBusThreadManager::Get()->GetCrosDisksClient();
lib->UnmountPath(disk->mount_path().c_str());
}
DispatchDiskEvent(disk, false);
@@ -426,8 +422,8 @@ void ExtensionFileBrowserEventRouter::OnFormattingFinished(
notifications_->HideNotificationDelayed(
FileBrowserNotifications::FORMAT_SUCCESS, device_path, 4000);
- chromeos::MountLibrary* lib =
- chromeos::CrosLibrary::Get()->GetMountLibrary();
+ chromeos::CrosDisksClient* lib =
+ chromeos::DBusThreadManager::Get()->GetCrosDisksClient();
lib->MountPath(device_path.c_str(),
chromeos::MOUNT_TYPE_DEVICE,
chromeos::MountPathOptions()); // Unused.

Powered by Google App Engine
This is Rietveld 408576698