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

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

Issue 10231010: gdata: Apply correct mount label when mounting archives in GData (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: gdata: Apply correct mount label when mounting archives in GData Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/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 6a5ae128fb34db755edf21d12de3fff7eacdc6a0..64c21b58acb9838ffe41734b11320a445eea1baf 100644
--- a/chrome/browser/chromeos/extensions/file_browser_event_router.cc
+++ b/chrome/browser/chromeos/extensions/file_browser_event_router.cc
@@ -368,11 +368,24 @@ void FileBrowserEventRouter::DispatchMountCompletedEvent(
"mountType",
DiskMountManager::MountTypeToString(mount_info.mount_type));
- if (mount_info.mount_type == chromeos::MOUNT_TYPE_ARCHIVE ||
- mount_info.mount_type == chromeos::MOUNT_TYPE_GDATA) {
+ // Determine if the source path is an archive on gdata.
+ bool is_archive_on_gdata = false;
+ FilePath source_path(mount_info.source_path);
+ if (mount_info.mount_type == chromeos::MOUNT_TYPE_ARCHIVE) {
+ gdata::GDataSystemService* system_service =
+ gdata::GDataSystemServiceFactory::GetForProfile(profile_);
+ gdata::GDataFileSystem* file_system =
tbarzic 2012/04/27 05:44:21 This should probably be separate function. On the
hshi 2012/04/27 18:48:56 Removed as suggested.
+ system_service ? system_service->file_system() : NULL;
+ is_archive_on_gdata =
+ file_system && file_system->IsUnderGDataCacheDirectory(source_path);
+ }
+
+ if (!is_archive_on_gdata &&
+ (mount_info.mount_type == chromeos::MOUNT_TYPE_ARCHIVE ||
+ mount_info.mount_type == chromeos::MOUNT_TYPE_GDATA)) {
GURL source_url;
if (file_manager_util::ConvertFileToFileSystemUrl(profile_,
tbarzic 2012/04/27 05:44:21 We do this conversion for archives file_manager ca
hshi 2012/04/27 18:48:56 Done.
- FilePath(mount_info.source_path),
+ source_path,
file_manager_util::GetFileBrowserExtensionUrl().GetOrigin(),
&source_url)) {
mount_info_value->SetString("sourceUrl", source_url.spec());
@@ -430,9 +443,11 @@ void FileBrowserEventRouter::OnDiskAdded(
// If disk is not mounted yet and it has media, give it a try.
if (disk->mount_path().empty() && disk->has_media()) {
// Initiate disk mount operation. MountPath auto-detects the filesystem
- // format if the second argument is empty.
+ // format if the second argument is empty. The third argument (mount label)
+ // is not used in a disk mount operation.
DiskMountManager::GetInstance()->MountPath(
- disk->device_path(), std::string(), chromeos::MOUNT_TYPE_DEVICE);
+ disk->device_path(), std::string(), std::string(),
+ chromeos::MOUNT_TYPE_DEVICE);
} else {
// Either the disk was mounted or it has no media. In both cases we don't
// want the Scanning notification to persist.
@@ -499,7 +514,9 @@ void FileBrowserEventRouter::OnFormattingFinished(
notifications_->HideNotificationDelayed(
FileBrowserNotifications::FORMAT_SUCCESS, device_path, 4000);
// MountPath auto-detects filesystem format if second argument is empty.
+ // The third argument (mount path) is not used in a disk mount operation.
tbarzic 2012/04/27 05:44:21 Isn't the third arg label to be used for the mount
hshi 2012/04/27 18:48:56 Sorry for the typo, the 3rd arg should be mount la
DiskMountManager::GetInstance()->MountPath(device_path, std::string(),
+ std::string(),
chromeos::MOUNT_TYPE_DEVICE);
} else {
notifications_->HideNotification(FileBrowserNotifications::FORMAT_START,

Powered by Google App Engine
This is Rietveld 408576698