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

Side by Side Diff: chrome/browser/extensions/extension_file_browser_private_api.cc

Issue 7174002: Change {Obfuscated|Local}FileSystemFileUtil non-Singleton to take an underlying *FileUtil. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebased. Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/chromeos/fileapi/cros_mount_point_provider.h » ('j') | 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) 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 "chrome/browser/extensions/extension_file_browser_private_api.h" 5 #include "chrome/browser/extensions/extension_file_browser_private_api.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 29 matching lines...) Expand all
40 #include "grit/generated_resources.h" 40 #include "grit/generated_resources.h"
41 #include "grit/platform_locale_settings.h" 41 #include "grit/platform_locale_settings.h"
42 #include "webkit/fileapi/file_system_context.h" 42 #include "webkit/fileapi/file_system_context.h"
43 #include "webkit/fileapi/file_system_mount_point_provider.h" 43 #include "webkit/fileapi/file_system_mount_point_provider.h"
44 #include "webkit/fileapi/file_system_operation.h" 44 #include "webkit/fileapi/file_system_operation.h"
45 #include "webkit/fileapi/file_system_operation_context.h" 45 #include "webkit/fileapi/file_system_operation_context.h"
46 #include "webkit/fileapi/file_system_path_manager.h" 46 #include "webkit/fileapi/file_system_path_manager.h"
47 #include "webkit/fileapi/file_system_types.h" 47 #include "webkit/fileapi/file_system_types.h"
48 #include "webkit/fileapi/file_system_util.h" 48 #include "webkit/fileapi/file_system_util.h"
49 #include "webkit/fileapi/file_system_file_util.h" 49 #include "webkit/fileapi/file_system_file_util.h"
50 #include "webkit/fileapi/local_file_system_file_util.h"
51 #include "ui/base/l10n/l10n_util.h" 50 #include "ui/base/l10n/l10n_util.h"
52 51
53 #ifdef OS_CHROMEOS 52 #ifdef OS_CHROMEOS
54 #include "chrome/browser/chromeos/cros/cros_library.h" 53 #include "chrome/browser/chromeos/cros/cros_library.h"
55 #endif 54 #endif
56 55
57 // Error messages. 56 // Error messages.
58 const char kFileError[] = "File error %d"; 57 const char kFileError[] = "File error %d";
59 const char kInvalidFileUrl[] = "Invalid file URL"; 58 const char kInvalidFileUrl[] = "Invalid file URL";
60 #ifdef OS_CHROMEOS 59 #ifdef OS_CHROMEOS
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 } 643 }
645 644
646 FilePath root_path = 645 FilePath root_path =
647 path_manager->ValidateFileSystemRootAndGetPathOnFileThread( 646 path_manager->ValidateFileSystemRootAndGetPathOnFileThread(
648 file_origin_url, 647 file_origin_url,
649 fileapi::kFileSystemTypeExternal, 648 fileapi::kFileSystemTypeExternal,
650 virtual_path, 649 virtual_path,
651 false); // create 650 false); // create
652 FilePath final_file_path = root_path.Append(virtual_path); 651 FilePath final_file_path = root_path.Append(virtual_path);
653 652
653 fileapi::ExternalFileSystemMountPointProvider* external_provider =
654 path_manager->external_provider();
655 if (!external_provider)
656 return false;
657
654 // Check if this file system entry exists first. 658 // Check if this file system entry exists first.
655 base::PlatformFileInfo file_info; 659 base::PlatformFileInfo file_info;
656 FilePath platform_path; 660 FilePath platform_path;
657 fileapi::FileSystemOperationContext file_system_operation_context( 661 fileapi::FileSystemOperationContext file_system_operation_context(
658 profile_->GetFileSystemContext(), 662 profile_->GetFileSystemContext(),
659 fileapi::LocalFileSystemFileUtil::GetInstance()); 663 external_provider->GetFileSystemFileUtil());
660 if (base::PLATFORM_FILE_OK != 664 if (base::PLATFORM_FILE_OK !=
661 fileapi::FileSystemFileUtil::GetInstance()->GetFileInfo( 665 fileapi::FileSystemFileUtil::GetInstance()->GetFileInfo(
662 &file_system_operation_context, final_file_path, &file_info, 666 &file_system_operation_context, final_file_path, &file_info,
663 &platform_path)) { 667 &platform_path)) {
664 return false; 668 return false;
665 } 669 }
666 670
667 fileapi::ExternalFileSystemMountPointProvider* external_provider =
668 path_manager->external_provider();
669 if (!external_provider)
670 return false;
671
672 // TODO(zelidrag): Let's just prevent all symlinks for now. We don't want a 671 // TODO(zelidrag): Let's just prevent all symlinks for now. We don't want a
673 // USB drive content to point to something in the rest of the file system. 672 // USB drive content to point to something in the rest of the file system.
674 // Ideally, we should permit symlinks within the boundary of the same 673 // Ideally, we should permit symlinks within the boundary of the same
675 // virtual mount point. 674 // virtual mount point.
676 if (file_info.is_symbolic_link) 675 if (file_info.is_symbolic_link)
677 return false; 676 return false;
678 677
679 // Get task details. 678 // Get task details.
680 std::string target_extension_id; 679 std::string target_extension_id;
681 std::string action_id; 680 std::string action_id;
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 #undef SET_STRING 1244 #undef SET_STRING
1246 1245
1247 // TODO(serya): Create a new string in .grd file for this one in M13. 1246 // TODO(serya): Create a new string in .grd file for this one in M13.
1248 dict->SetString("PREVIEW_IMAGE", 1247 dict->SetString("PREVIEW_IMAGE",
1249 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_VIEW_CERT_BUTTON)); 1248 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_VIEW_CERT_BUTTON));
1250 dict->SetString("PLAY_MEDIA", 1249 dict->SetString("PLAY_MEDIA",
1251 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY)); 1250 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY));
1252 1251
1253 return true; 1252 return true;
1254 } 1253 }
OLDNEW
« no previous file with comments | « no previous file | webkit/chromeos/fileapi/cros_mount_point_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698