| 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_handlers/app_file_handler_util.h" | 5 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" |
| 6 | 6 |
| 7 #include "apps/browser/file_handler_util.h" | 7 #include "apps/browser/file_handler_util.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
| 12 #include "content/public/browser/child_process_security_policy.h" | 12 #include "content/public/browser/child_process_security_policy.h" |
| 13 #include "content/public/browser/render_process_host.h" | 13 #include "content/public/browser/render_process_host.h" |
| 14 #include "extensions/browser/extension_prefs.h" | 14 #include "extensions/browser/extension_prefs.h" |
| 15 #include "extensions/common/permissions/permissions_data.h" |
| 15 #include "net/base/mime_util.h" | 16 #include "net/base/mime_util.h" |
| 16 #include "webkit/browser/fileapi/isolated_context.h" | 17 #include "webkit/browser/fileapi/isolated_context.h" |
| 17 #include "webkit/common/fileapi/file_system_mount_option.h" | 18 #include "webkit/common/fileapi/file_system_mount_option.h" |
| 18 #include "webkit/common/fileapi/file_system_types.h" | 19 #include "webkit/common/fileapi/file_system_types.h" |
| 19 | 20 |
| 20 #if defined(OS_CHROMEOS) | 21 #if defined(OS_CHROMEOS) |
| 21 #include "chrome/browser/chromeos/file_manager/filesystem_api_util.h" | 22 #include "chrome/browser/chromeos/file_manager/filesystem_api_util.h" |
| 22 #endif | 23 #endif |
| 23 | 24 |
| 24 using apps::file_handler_util::GrantedFileEntry; | 25 using apps::file_handler_util::GrantedFileEntry; |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 Profile* profile, | 323 Profile* profile, |
| 323 bool is_directory, | 324 bool is_directory, |
| 324 const base::Closure& on_success, | 325 const base::Closure& on_success, |
| 325 const base::Callback<void(const base::FilePath&)>& on_failure) { | 326 const base::Callback<void(const base::FilePath&)>& on_failure) { |
| 326 scoped_refptr<WritableFileChecker> checker(new WritableFileChecker( | 327 scoped_refptr<WritableFileChecker> checker(new WritableFileChecker( |
| 327 paths, profile, is_directory, on_success, on_failure)); | 328 paths, profile, is_directory, on_success, on_failure)); |
| 328 checker->Check(); | 329 checker->Check(); |
| 329 } | 330 } |
| 330 | 331 |
| 331 bool HasFileSystemWritePermission(const Extension* extension) { | 332 bool HasFileSystemWritePermission(const Extension* extension) { |
| 332 return extension->HasAPIPermission(APIPermission::kFileSystemWrite); | 333 return extension->permissions_data()->HasAPIPermission( |
| 334 APIPermission::kFileSystemWrite); |
| 333 } | 335 } |
| 334 | 336 |
| 335 bool ValidateFileEntryAndGetPath( | 337 bool ValidateFileEntryAndGetPath( |
| 336 const std::string& filesystem_name, | 338 const std::string& filesystem_name, |
| 337 const std::string& filesystem_path, | 339 const std::string& filesystem_path, |
| 338 const content::RenderViewHost* render_view_host, | 340 const content::RenderViewHost* render_view_host, |
| 339 base::FilePath* file_path, | 341 base::FilePath* file_path, |
| 340 std::string* error) { | 342 std::string* error) { |
| 341 if (filesystem_path.empty()) { | 343 if (filesystem_path.empty()) { |
| 342 *error = kInvalidParameters; | 344 *error = kInvalidParameters; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 *error = kInvalidParameters; | 382 *error = kInvalidParameters; |
| 381 return false; | 383 return false; |
| 382 } | 384 } |
| 383 | 385 |
| 384 return true; | 386 return true; |
| 385 } | 387 } |
| 386 | 388 |
| 387 } // namespace app_file_handler_util | 389 } // namespace app_file_handler_util |
| 388 | 390 |
| 389 } // namespace extensions | 391 } // namespace extensions |
| OLD | NEW |