Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "webkit/chromeos/fileapi/cros_mount_point_provider.h" | 5 #include "webkit/chromeos/fileapi/cros_mount_point_provider.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_callback_factory.h" | 8 #include "base/memory/scoped_callback_factory.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 // Check first to make sure this extension has fileBrowserHander permissions. | 126 // Check first to make sure this extension has fileBrowserHander permissions. |
| 127 if (!special_storage_policy_->IsFileHandler(extension_id)) | 127 if (!special_storage_policy_->IsFileHandler(extension_id)) |
| 128 return false; | 128 return false; |
| 129 | 129 |
| 130 return file_access_permissions_->HasAccessPermission(extension_id, | 130 return file_access_permissions_->HasAccessPermission(extension_id, |
| 131 virtual_path); | 131 virtual_path); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void CrosMountPointProvider::AddMountPoint(FilePath mount_point) { | 134 void CrosMountPointProvider::AddMountPoint(FilePath mount_point) { |
| 135 base::AutoLock locker(lock_); | 135 base::AutoLock locker(lock_); |
| 136 mount_point_map_.erase(mount_point.BaseName().value()); | |
| 136 mount_point_map_.insert(std::pair<std::string, FilePath>( | 137 mount_point_map_.insert(std::pair<std::string, FilePath>( |
|
SeRya
2011/12/06 16:18:31
This two line are equal to:
mount_point_map_[moun
| |
| 137 mount_point.BaseName().value(), mount_point.DirName())); | 138 mount_point.BaseName().value(), mount_point.DirName())); |
| 138 } | 139 } |
| 139 | 140 |
| 140 void CrosMountPointProvider::RemoveMountPoint(FilePath mount_point) { | 141 void CrosMountPointProvider::RemoveMountPoint(FilePath mount_point) { |
| 141 base::AutoLock locker(lock_); | 142 base::AutoLock locker(lock_); |
| 142 mount_point_map_.erase(mount_point.BaseName().value()); | 143 mount_point_map_.erase(mount_point.BaseName().value()); |
| 143 } | 144 } |
| 144 | 145 |
| 145 void CrosMountPointProvider::GrantFullAccessToExtension( | 146 void CrosMountPointProvider::GrantFullAccessToExtension( |
| 146 const std::string& extension_id) { | 147 const std::string& extension_id) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 } else if (mount_prefix == filesystem_path) { | 195 } else if (mount_prefix == filesystem_path) { |
| 195 FilePath root = FilePath(FILE_PATH_LITERAL("/")); | 196 FilePath root = FilePath(FILE_PATH_LITERAL("/")); |
| 196 *virtual_path = root.Append(iter->first); | 197 *virtual_path = root.Append(iter->first); |
| 197 return true; | 198 return true; |
| 198 } | 199 } |
| 199 } | 200 } |
| 200 return false; | 201 return false; |
| 201 } | 202 } |
| 202 | 203 |
| 203 } // namespace chromeos | 204 } // namespace chromeos |
| OLD | NEW |