diff options
author | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-24 00:15:50 +0000 |
---|---|---|
committer | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-24 00:15:50 +0000 |
commit | 4d5843ce942b8df8d5b098a431aee5ba87aca6ac (patch) | |
tree | d680365932ce62eafc04eea385d81e452dc9f137 /chrome/browser/extensions/extension_file_browser_private_api.cc | |
parent | fe098abb2738d1abdc089d080343626cc276bab7 (diff) | |
download | chromium_src-4d5843ce942b8df8d5b098a431aee5ba87aca6ac.zip chromium_src-4d5843ce942b8df8d5b098a431aee5ba87aca6ac.tar.gz chromium_src-4d5843ce942b8df8d5b098a431aee5ba87aca6ac.tar.bz2 |
Revert 93813 - Re-landing for tbarzic@ - r93754:
Adding support for mount point different from removable devices to MountLibrary
(work in progress..have to add GetMountPoints support)
tested on ChromeOS with these three patches: http://gerrit.chromium.org/gerrit/#change,4447
http://gerrit.chromium.org/gerrit/#change,4449
http://gerrit.chromium.org/gerrit/#change,4544
BUG=chromium-os:17673,chromium-os:17783
TEST=Made sure mounting devices still works and that
MountCompleted event gets through to
file_browser_event_router (checking ui and chrome logs
for mount completed entries)
TBR=tbarzic
Review URL: http://codereview.chromium.org/7492038
TBR=zelidrag@chromium.org
Review URL: http://codereview.chromium.org/7488043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93815 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_file_browser_private_api.cc')
-rw-r--r-- | chrome/browser/extensions/extension_file_browser_private_api.cc | 124 |
1 files changed, 7 insertions, 117 deletions
diff --git a/chrome/browser/extensions/extension_file_browser_private_api.cc b/chrome/browser/extensions/extension_file_browser_private_api.cc index 9549c78..3f0cb0e 100644 --- a/chrome/browser/extensions/extension_file_browser_private_api.cc +++ b/chrome/browser/extensions/extension_file_browser_private_api.cc @@ -1075,141 +1075,31 @@ bool CancelFileDialogFunction::RunImpl() { return true; } -AddMountFunction::AddMountFunction() { +UnmountVolumeFunction::UnmountVolumeFunction() { } -AddMountFunction::~AddMountFunction() { +UnmountVolumeFunction::~UnmountVolumeFunction() { } -bool AddMountFunction::RunImpl() { - if (args_->GetSize() != 2 && args_->GetSize() != 3) { - error_ = "Invalid argument count"; - return false; - } - - std::string source; - if (!args_->GetString(0, &source)) { - return false; - } - - std::string mount_type_str; - if (!args_->GetString(1, &mount_type_str)) { - return false; - } - -#ifdef OS_CHROMEOS - chromeos::MountLibrary *mount_lib = - chromeos::CrosLibrary::Get()->GetMountLibrary(); - - chromeos::MountType mount_type = - mount_lib->MountTypeFromString(mount_type_str); - if (mount_type == chromeos::MOUNT_TYPE_INVALID) { - error_ = "Invalid mount type"; - return false; - } - - chromeos::MountPathOptions options; - - if (args_->GetSize() == 3) { - DictionaryValue *dict; - if (!args_->GetDictionary(2, &dict)) { - NOTREACHED(); - } - - for (base::DictionaryValue::key_iterator it = dict->begin_keys(); - it != dict->end_keys(); - ++it) { - std::string value; - if (!dict->GetString(*it, &value)) { - NOTREACHED(); - } - - options.push_back(chromeos::MountPathOptions::value_type((*it).c_str(), - value.c_str())); - } - } - - mount_lib->MountPath(source.c_str(), mount_type, options); -#endif - - return true; -} - -RemoveMountFunction::RemoveMountFunction() { -} - -RemoveMountFunction::~RemoveMountFunction() { -} - -bool RemoveMountFunction::RunImpl() { +bool UnmountVolumeFunction::RunImpl() { if (args_->GetSize() != 1) { return false; } - std::string mount_path; - if (!args_->GetString(0, &mount_path)) { - return false; + std::string volume_device_path; + if (!args_->GetString(0, &volume_device_path)) { + NOTREACHED(); } #ifdef OS_CHROMEOS chromeos::CrosLibrary::Get()->GetMountLibrary()->UnmountPath( - mount_path.c_str()); + volume_device_path.c_str()); #endif SendResponse(true); return true; } -GetMountPointsFunction::GetMountPointsFunction() { -} - -GetMountPointsFunction::~GetMountPointsFunction() { -} - -bool GetMountPointsFunction::RunImpl() { - if (args_->GetSize() != 0) - return false; - -#ifdef OS_CHROMEOS - chromeos::MountLibrary *mount_lib = - chromeos::CrosLibrary::Get()->GetMountLibrary(); - chromeos::MountLibrary::MountPointMap mount_points = - mount_lib->mount_points(); - - base::DictionaryValue *mounts = new base::DictionaryValue(); - - for (chromeos::MountLibrary::MountPointMap::const_iterator it = - mount_points.begin(); - it != mount_points.end(); - ++it) { - chromeos::MountLibrary::MountPointInfo mount_point_info = it->second; - - mounts->Set(mount_point_info.mount_path, - MountPointToValue(mount_point_info, mount_lib)); - } - - result_.reset(mounts); -#endif - - return true; -} - -#ifdef OS_CHROMEOS -base::DictionaryValue* GetMountPointsFunction::MountPointToValue( - const chromeos::MountLibrary::MountPointInfo& mount_point_info, - chromeos::MountLibrary* mount_lib) { - - base::DictionaryValue *mount_info = new base::DictionaryValue(); - - mount_info->SetString("mountPath", mount_point_info.mount_path); - mount_info->SetString( - "mountType", - mount_lib->MountTypeToString(mount_point_info.mount_type)); - mount_info->SetString("sourcePath", mount_point_info.source_path); - return mount_info; -} -#endif - GetVolumeMetadataFunction::GetVolumeMetadataFunction() { } |