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

Side by Side Diff: chrome/browser/chromeos/fileapi/file_system_backend.cc

Issue 148233008: Grant Files.app access for mount points added after its launch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/fileapi/file_access_permissions_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/chromeos/fileapi/file_system_backend.h" 5 #include "chrome/browser/chromeos/fileapi/file_system_backend.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 return file_access_permissions_->HasAccessPermission(extension_id, 141 return file_access_permissions_->HasAccessPermission(extension_id,
142 url.virtual_path()); 142 url.virtual_path());
143 } 143 }
144 144
145 void FileSystemBackend::GrantFullAccessToExtension( 145 void FileSystemBackend::GrantFullAccessToExtension(
146 const std::string& extension_id) { 146 const std::string& extension_id) {
147 DCHECK(special_storage_policy_->IsFileHandler(extension_id)); 147 DCHECK(special_storage_policy_->IsFileHandler(extension_id));
148 if (!special_storage_policy_->IsFileHandler(extension_id)) 148 if (!special_storage_policy_->IsFileHandler(extension_id))
149 return; 149 return;
150 150 file_access_permissions_->GrantFullAccessPermission(extension_id);
151 std::vector<fileapi::MountPoints::MountPointInfo> files;
152 mount_points_->AddMountPointInfosTo(&files);
153 system_mount_points_->AddMountPointInfosTo(&files);
154
155 for (size_t i = 0; i < files.size(); ++i) {
156 file_access_permissions_->GrantAccessPermission(
157 extension_id,
158 base::FilePath::FromUTF8Unsafe(files[i].name));
159 }
160 } 151 }
161 152
162 void FileSystemBackend::GrantFileAccessToExtension( 153 void FileSystemBackend::GrantFileAccessToExtension(
163 const std::string& extension_id, const base::FilePath& virtual_path) { 154 const std::string& extension_id, const base::FilePath& virtual_path) {
164 // All we care about here is access from extensions for now. 155 // All we care about here is access from extensions for now.
165 DCHECK(special_storage_policy_->IsFileHandler(extension_id)); 156 DCHECK(special_storage_policy_->IsFileHandler(extension_id));
166 if (!special_storage_policy_->IsFileHandler(extension_id)) 157 if (!special_storage_policy_->IsFileHandler(extension_id))
167 return; 158 return;
168 159
169 std::string id; 160 std::string id;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 273 }
283 274
284 bool FileSystemBackend::GetVirtualPath( 275 bool FileSystemBackend::GetVirtualPath(
285 const base::FilePath& filesystem_path, 276 const base::FilePath& filesystem_path,
286 base::FilePath* virtual_path) { 277 base::FilePath* virtual_path) {
287 return mount_points_->GetVirtualPath(filesystem_path, virtual_path) || 278 return mount_points_->GetVirtualPath(filesystem_path, virtual_path) ||
288 system_mount_points_->GetVirtualPath(filesystem_path, virtual_path); 279 system_mount_points_->GetVirtualPath(filesystem_path, virtual_path);
289 } 280 }
290 281
291 } // namespace chromeos 282 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/fileapi/file_access_permissions_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698