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 "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "chrome/browser/extensions/extension_prefs.h" | 9 #include "chrome/browser/extensions/extension_prefs.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 for (std::set<std::string>::const_iterator type = handler.types.begin(); | 54 for (std::set<std::string>::const_iterator type = handler.types.begin(); |
55 type != handler.types.end(); ++type) { | 55 type != handler.types.end(); ++type) { |
56 if (net::MatchesMimeType(*type, mime_type)) | 56 if (net::MatchesMimeType(*type, mime_type)) |
57 return true; | 57 return true; |
58 } | 58 } |
59 return false; | 59 return false; |
60 } | 60 } |
61 | 61 |
62 bool DoCheckWritableFile(const base::FilePath& path, bool is_directory) { | 62 bool DoCheckWritableFile(const base::FilePath& path, bool is_directory) { |
63 // Don't allow links. | 63 // Don't allow links. |
64 if (base::PathExists(path) && file_util::IsLink(path)) | 64 if (base::PathExists(path) && base::IsLink(path)) |
65 return false; | 65 return false; |
66 | 66 |
67 if (is_directory) | 67 if (is_directory) |
68 return base::DirectoryExists(path); | 68 return base::DirectoryExists(path); |
69 | 69 |
70 // Create the file if it doesn't already exist. | 70 // Create the file if it doesn't already exist. |
71 base::PlatformFileError error = base::PLATFORM_FILE_OK; | 71 base::PlatformFileError error = base::PLATFORM_FILE_OK; |
72 int creation_flags = base::PLATFORM_FILE_CREATE | | 72 int creation_flags = base::PLATFORM_FILE_CREATE | |
73 base::PLATFORM_FILE_READ | | 73 base::PLATFORM_FILE_READ | |
74 base::PLATFORM_FILE_WRITE; | 74 base::PLATFORM_FILE_WRITE; |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 335 |
336 GrantedFileEntry::GrantedFileEntry() {} | 336 GrantedFileEntry::GrantedFileEntry() {} |
337 | 337 |
338 bool HasFileSystemWritePermission(const Extension* extension) { | 338 bool HasFileSystemWritePermission(const Extension* extension) { |
339 return extension->HasAPIPermission(APIPermission::kFileSystemWrite); | 339 return extension->HasAPIPermission(APIPermission::kFileSystemWrite); |
340 } | 340 } |
341 | 341 |
342 } // namespace app_file_handler_util | 342 } // namespace app_file_handler_util |
343 | 343 |
344 } // namespace extensions | 344 } // namespace extensions |
OLD | NEW |