OLD | NEW |
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/extensions/api/file_system/file_system_api.h" | 5 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
6 | 6 |
7 #include "apps/saved_files_service.h" | 7 #include "apps/saved_files_service.h" |
8 #include "apps/shell_window.h" | 8 #include "apps/shell_window.h" |
9 #include "apps/shell_window_registry.h" | 9 #include "apps/shell_window_registry.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "webkit/browser/fileapi/external_mount_points.h" | 42 #include "webkit/browser/fileapi/external_mount_points.h" |
43 #include "webkit/browser/fileapi/isolated_context.h" | 43 #include "webkit/browser/fileapi/isolated_context.h" |
44 #include "webkit/common/fileapi/file_system_types.h" | 44 #include "webkit/common/fileapi/file_system_types.h" |
45 #include "webkit/common/fileapi/file_system_util.h" | 45 #include "webkit/common/fileapi/file_system_util.h" |
46 | 46 |
47 #if defined(OS_MACOSX) | 47 #if defined(OS_MACOSX) |
48 #include <CoreFoundation/CoreFoundation.h> | 48 #include <CoreFoundation/CoreFoundation.h> |
49 #include "base/mac/foundation_util.h" | 49 #include "base/mac/foundation_util.h" |
50 #endif | 50 #endif |
51 | 51 |
| 52 #if defined(OS_CHROMEOS) |
| 53 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 54 #endif |
| 55 |
52 using apps::SavedFileEntry; | 56 using apps::SavedFileEntry; |
53 using apps::SavedFilesService; | 57 using apps::SavedFilesService; |
54 using apps::ShellWindow; | 58 using apps::ShellWindow; |
55 using fileapi::IsolatedContext; | 59 using fileapi::IsolatedContext; |
56 | 60 |
57 const char kInvalidCallingPage[] = "Invalid calling page. This function can't " | 61 const char kInvalidCallingPage[] = "Invalid calling page. This function can't " |
58 "be called from a background page."; | 62 "be called from a background page."; |
59 const char kUserCancelled[] = "User cancelled"; | 63 const char kUserCancelled[] = "User cancelled"; |
60 const char kWritableFileErrorFormat[] = "Error opening %s"; | 64 const char kWritableFileErrorFormat[] = "Error opening %s"; |
61 const char kRequiresFileSystemWriteError[] = | 65 const char kRequiresFileSystemWriteError[] = |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 | 695 |
692 void FileSystemChooseEntryFunction::FileSelectionCanceled() { | 696 void FileSystemChooseEntryFunction::FileSelectionCanceled() { |
693 error_ = kUserCancelled; | 697 error_ = kUserCancelled; |
694 SendResponse(false); | 698 SendResponse(false); |
695 } | 699 } |
696 | 700 |
697 void FileSystemChooseEntryFunction::ConfirmDirectoryAccessOnFileThread( | 701 void FileSystemChooseEntryFunction::ConfirmDirectoryAccessOnFileThread( |
698 const std::vector<base::FilePath>& paths, | 702 const std::vector<base::FilePath>& paths, |
699 content::WebContents* web_contents) { | 703 content::WebContents* web_contents) { |
700 DCHECK_EQ(paths.size(), 1u); | 704 DCHECK_EQ(paths.size(), 1u); |
| 705 #if defined(OS_CHROMEOS) |
| 706 const base::FilePath path = |
| 707 drive::util::IsUnderDriveMountPoint(paths[0]) ? paths[0] : |
| 708 base::MakeAbsoluteFilePath(paths[0]); |
| 709 #else |
701 const base::FilePath path = base::MakeAbsoluteFilePath(paths[0]); | 710 const base::FilePath path = base::MakeAbsoluteFilePath(paths[0]); |
| 711 #endif |
702 if (path.empty()) { | 712 if (path.empty()) { |
703 content::BrowserThread::PostTask( | 713 content::BrowserThread::PostTask( |
704 content::BrowserThread::UI, | 714 content::BrowserThread::UI, |
705 FROM_HERE, | 715 FROM_HERE, |
706 base::Bind(&FileSystemChooseEntryFunction::FileSelectionCanceled, | 716 base::Bind(&FileSystemChooseEntryFunction::FileSelectionCanceled, |
707 this)); | 717 this)); |
708 return; | 718 return; |
709 } | 719 } |
710 | 720 |
711 for (size_t i = 0; i < arraysize(kGraylistedPaths); i++) { | 721 for (size_t i = 0; i < arraysize(kGraylistedPaths); i++) { |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 if (needs_new_entry) { | 976 if (needs_new_entry) { |
967 is_directory_ = file_entry->is_directory; | 977 is_directory_ = file_entry->is_directory; |
968 CreateResponse(); | 978 CreateResponse(); |
969 AddEntryToResponse(file_entry->path, file_entry->id); | 979 AddEntryToResponse(file_entry->path, file_entry->id); |
970 } | 980 } |
971 SendResponse(true); | 981 SendResponse(true); |
972 return true; | 982 return true; |
973 } | 983 } |
974 | 984 |
975 } // namespace extensions | 985 } // namespace extensions |
OLD | NEW |