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

Unified Diff: trunk/src/chrome/browser/chromeos/file_system_provider/service.cc

Issue 389243002: Revert 282900 "Revert 282890 "[fsp] Add an option for mounting i..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 5 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: trunk/src/chrome/browser/chromeos/file_system_provider/service.cc
===================================================================
--- trunk/src/chrome/browser/chromeos/file_system_provider/service.cc (revision 282906)
+++ trunk/src/chrome/browser/chromeos/file_system_provider/service.cc (working copy)
@@ -39,6 +39,7 @@
const char kPrefKeyFileSystemId[] = "file-system-id";
const char kPrefKeyDisplayName[] = "display-name";
+const char kPrefKeyWritable[] = "writable";
void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterDictionaryPref(
@@ -101,7 +102,8 @@
bool Service::MountFileSystem(const std::string& extension_id,
const std::string& file_system_id,
- const std::string& display_name) {
+ const std::string& display_name,
+ bool writable) {
DCHECK(thread_checker_.CalledOnValidThread());
// If already exists a file system provided by the same extension with this
@@ -149,11 +151,12 @@
// Store the file system descriptor. Use the mount point name as the file
// system provider file system id.
// Examples:
- // file_system_id = 41
- // mount_point_name = b33f1337-41-5aa5
- // mount_path = /provided/b33f1337-41-5aa5
+ // file_system_id = hello_world
+ // mount_point_name = b33f1337-hello_world-5aa5
+ // writable = false
+ // mount_path = /provided/b33f1337-hello_world-5aa5
ProvidedFileSystemInfo file_system_info(
- extension_id, file_system_id, display_name, mount_path);
+ extension_id, file_system_id, display_name, writable, mount_path);
ProvidedFileSystemInterface* file_system =
file_system_factory_.Run(profile_, file_system_info);
@@ -331,6 +334,8 @@
file_system_info.file_system_id());
file_system->SetStringWithoutPathExpansion(kPrefKeyDisplayName,
file_system_info.display_name());
+ file_system->SetBooleanWithoutPathExpansion(kPrefKeyWritable,
+ file_system_info.writable());
PrefService* const pref_service = profile_->GetPrefs();
DCHECK(pref_service);
@@ -397,21 +402,23 @@
std::string file_system_id;
std::string display_name;
- if (file_system_value->GetAsDictionary(&file_system)) {
- file_system->GetStringWithoutPathExpansion(kPrefKeyFileSystemId,
- &file_system_id);
- file_system->GetStringWithoutPathExpansion(kPrefKeyDisplayName,
- &display_name);
- }
+ bool writable;
- if (file_system_id.empty() || display_name.empty()) {
+ if (!file_system_value->GetAsDictionary(&file_system) ||
+ !file_system->GetStringWithoutPathExpansion(kPrefKeyFileSystemId,
+ &file_system_id) ||
+ !file_system->GetStringWithoutPathExpansion(kPrefKeyDisplayName,
+ &display_name) ||
+ !file_system->GetBooleanWithoutPathExpansion(kPrefKeyWritable,
+ &writable) ||
+ file_system_id.empty() || display_name.empty()) {
LOG(ERROR)
<< "Malformed provided file system information in preferences.";
continue;
}
const bool result =
- MountFileSystem(extension_id, file_system_id, display_name);
+ MountFileSystem(extension_id, file_system_id, display_name, writable);
if (!result) {
LOG(ERROR) << "Failed to restore a provided file system from "
<< "preferences: " << extension_id << ", " << file_system_id

Powered by Google App Engine
This is Rietveld 408576698