| 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 "base/bind.h" | 9 #include "base/bind.h" |
| 9 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 13 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 14 #include "base/strings/sys_string_conversions.h" | 15 #include "base/strings/sys_string_conversions.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/value_conversions.h" | 17 #include "base/value_conversions.h" |
| 17 #include "base/values.h" | 18 #include "base/values.h" |
| 18 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" | 19 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" |
| 19 #include "chrome/browser/extensions/extension_service.h" | 20 #include "chrome/browser/extensions/extension_service.h" |
| 20 #include "chrome/browser/extensions/extension_system.h" | 21 #include "chrome/browser/extensions/extension_system.h" |
| 21 #include "chrome/browser/extensions/shell_window_registry.h" | 22 #include "chrome/browser/extensions/shell_window_registry.h" |
| 22 #include "chrome/browser/platform_util.h" | 23 #include "chrome/browser/platform_util.h" |
| 23 #include "chrome/browser/ui/chrome_select_file_policy.h" | 24 #include "chrome/browser/ui/chrome_select_file_policy.h" |
| 24 #include "chrome/browser/ui/extensions/shell_window.h" | |
| 25 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/common/extensions/api/file_system.h" | 26 #include "chrome/common/extensions/api/file_system.h" |
| 27 #include "chrome/common/extensions/permissions/api_permission.h" | 27 #include "chrome/common/extensions/permissions/api_permission.h" |
| 28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
| 29 #include "content/public/browser/child_process_security_policy.h" | 29 #include "content/public/browser/child_process_security_policy.h" |
| 30 #include "content/public/browser/render_process_host.h" | 30 #include "content/public/browser/render_process_host.h" |
| 31 #include "content/public/browser/render_view_host.h" | 31 #include "content/public/browser/render_view_host.h" |
| 32 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
| 33 #include "content/public/browser/web_contents_view.h" | 33 #include "content/public/browser/web_contents_view.h" |
| 34 #include "grit/generated_resources.h" | 34 #include "grit/generated_resources.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 45 #include <CoreFoundation/CoreFoundation.h> | 45 #include <CoreFoundation/CoreFoundation.h> |
| 46 #include "base/mac/foundation_util.h" | 46 #include "base/mac/foundation_util.h" |
| 47 #endif | 47 #endif |
| 48 | 48 |
| 49 #if defined(OS_CHROMEOS) | 49 #if defined(OS_CHROMEOS) |
| 50 #include "chrome/browser/chromeos/drive/file_system_util.h" | 50 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 51 #endif | 51 #endif |
| 52 | 52 |
| 53 using apps::SavedFileEntry; | 53 using apps::SavedFileEntry; |
| 54 using apps::SavedFilesService; | 54 using apps::SavedFilesService; |
| 55 using apps::ShellWindow; |
| 55 using fileapi::IsolatedContext; | 56 using fileapi::IsolatedContext; |
| 56 | 57 |
| 57 const char kInvalidParameters[] = "Invalid parameters"; | 58 const char kInvalidParameters[] = "Invalid parameters"; |
| 58 const char kSecurityError[] = "Security error"; | 59 const char kSecurityError[] = "Security error"; |
| 59 const char kInvalidCallingPage[] = "Invalid calling page. This function can't " | 60 const char kInvalidCallingPage[] = "Invalid calling page. This function can't " |
| 60 "be called from a background page."; | 61 "be called from a background page."; |
| 61 const char kUserCancelled[] = "User cancelled"; | 62 const char kUserCancelled[] = "User cancelled"; |
| 62 const char kWritableFileError[] = | 63 const char kWritableFileError[] = |
| 63 "Cannot write to file in a restricted location"; | 64 "Cannot write to file in a restricted location"; |
| 64 const char kRequiresFileSystemWriteError[] = | 65 const char kRequiresFileSystemWriteError[] = |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 // ID that was passed to restoreEntry. | 872 // ID that was passed to restoreEntry. |
| 872 RegisterFileSystemAndSendResponseWithIdOverride( | 873 RegisterFileSystemAndSendResponseWithIdOverride( |
| 873 file_entry->path, | 874 file_entry->path, |
| 874 file_entry->writable ? WRITABLE : READ_ONLY, | 875 file_entry->writable ? WRITABLE : READ_ONLY, |
| 875 file_entry->id); | 876 file_entry->id); |
| 876 } | 877 } |
| 877 return true; | 878 return true; |
| 878 } | 879 } |
| 879 | 880 |
| 880 } // namespace extensions | 881 } // namespace extensions |
| OLD | NEW |