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

Side by Side Diff: chrome/browser/chromeos/file_manager/file_browser_handlers.cc

Issue 251593005: Files.app auto pop up for MTP storage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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/extensions/file_manager/event_router.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/file_manager/file_browser_handlers.h" 5 #include "chrome/browser/chromeos/file_manager/file_browser_handlers.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/i18n/case_conversion.h" 9 #include "base/i18n/case_conversion.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 scoped_ptr<FileDefinitionList> file_definition_list(new FileDefinitionList); 208 scoped_ptr<FileDefinitionList> file_definition_list(new FileDefinitionList);
209 for (size_t i = 0; i < file_urls.size(); ++i) { 209 for (size_t i = 0; i < file_urls.size(); ++i) {
210 const FileSystemURL& url = file_urls[i]; 210 const FileSystemURL& url = file_urls[i];
211 211
212 // Check if this file system entry exists first. 212 // Check if this file system entry exists first.
213 base::File::Info file_info; 213 base::File::Info file_info;
214 214
215 base::FilePath local_path = url.path(); 215 base::FilePath local_path = url.path();
216 base::FilePath virtual_path = url.virtual_path(); 216 base::FilePath virtual_path = url.virtual_path();
217 217
218 bool is_drive_file = url.type() == fileapi::kFileSystemTypeDrive; 218 const bool is_drive_file = url.type() == fileapi::kFileSystemTypeDrive;
219 DCHECK(!is_drive_file || drive::util::IsUnderDriveMountPoint(local_path)); 219 DCHECK(!is_drive_file || drive::util::IsUnderDriveMountPoint(local_path));
220 220
221 // If the file is under drive mount point, there is no actual file to be 221 const bool is_native_file =
222 // found on the url.path(). 222 url.type() == fileapi::kFileSystemTypeNativeLocal ||
223 if (!is_drive_file) { 223 url.type() == fileapi::kFileSystemTypeRestrictedNativeLocal;
224
225 // If the file is from a physical volume, actual file must be found.
226 if (is_native_file) {
224 if (!base::PathExists(local_path) || 227 if (!base::PathExists(local_path) ||
225 base::IsLink(local_path) || 228 base::IsLink(local_path) ||
226 !base::GetFileInfo(local_path, &file_info)) { 229 !base::GetFileInfo(local_path, &file_info)) {
227 continue; 230 continue;
228 } 231 }
229 } 232 }
230 233
231 // Grant access to this particular file to target extension. This will 234 // Grant access to this particular file to target extension. This will
232 // ensure that the target extension can access only this FS entry and 235 // ensure that the target extension can access only this FS entry and
233 // prevent from traversing FS hierarchy upward. 236 // prevent from traversing FS hierarchy upward.
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 if (common_handlers.empty()) 527 if (common_handlers.empty())
525 return FileBrowserHandlerList(); 528 return FileBrowserHandlerList();
526 } 529 }
527 } 530 }
528 531
529 return common_handlers; 532 return common_handlers;
530 } 533 }
531 534
532 } // namespace file_browser_handlers 535 } // namespace file_browser_handlers
533 } // namespace file_manager 536 } // namespace file_manager
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/file_manager/event_router.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698