| 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/app_window.h" | 7 #include "apps/app_window.h" |
| 8 #include "apps/app_window_registry.h" | 8 #include "apps/app_window_registry.h" |
| 9 #include "apps/saved_files_service.h" | 9 #include "apps/saved_files_service.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 } | 239 } |
| 240 | 240 |
| 241 void SetLastChooseEntryDirectory(ExtensionPrefs* prefs, | 241 void SetLastChooseEntryDirectory(ExtensionPrefs* prefs, |
| 242 const std::string& extension_id, | 242 const std::string& extension_id, |
| 243 const base::FilePath& path) { | 243 const base::FilePath& path) { |
| 244 prefs->UpdateExtensionPref(extension_id, | 244 prefs->UpdateExtensionPref(extension_id, |
| 245 kLastChooseEntryDirectory, | 245 kLastChooseEntryDirectory, |
| 246 base::CreateFilePathValue(path)); | 246 base::CreateFilePathValue(path)); |
| 247 } | 247 } |
| 248 | 248 |
| 249 std::vector<base::FilePath> GetGrayListedDirectories() { |
| 250 std::vector<base::FilePath> graylisted_directories; |
| 251 for (size_t i = 0; i < arraysize(kGraylistedPaths); ++i) { |
| 252 base::FilePath graylisted_path; |
| 253 if (PathService::Get(kGraylistedPaths[i], &graylisted_path)) |
| 254 graylisted_directories.push_back(graylisted_path); |
| 255 } |
| 256 return graylisted_directories; |
| 257 } |
| 258 |
| 249 } // namespace file_system_api | 259 } // namespace file_system_api |
| 250 | 260 |
| 251 bool FileSystemGetDisplayPathFunction::RunImpl() { | 261 bool FileSystemGetDisplayPathFunction::RunImpl() { |
| 252 std::string filesystem_name; | 262 std::string filesystem_name; |
| 253 std::string filesystem_path; | 263 std::string filesystem_path; |
| 254 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &filesystem_name)); | 264 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &filesystem_name)); |
| 255 EXTENSION_FUNCTION_VALIDATE(args_->GetString(1, &filesystem_path)); | 265 EXTENSION_FUNCTION_VALIDATE(args_->GetString(1, &filesystem_path)); |
| 256 | 266 |
| 257 base::FilePath file_path; | 267 base::FilePath file_path; |
| 258 if (!app_file_handler_util::ValidateFileEntryAndGetPath(filesystem_name, | 268 if (!app_file_handler_util::ValidateFileEntryAndGetPath(filesystem_name, |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 if (needs_new_entry) { | 977 if (needs_new_entry) { |
| 968 is_directory_ = file_entry->is_directory; | 978 is_directory_ = file_entry->is_directory; |
| 969 CreateResponse(); | 979 CreateResponse(); |
| 970 AddEntryToResponse(file_entry->path, file_entry->id); | 980 AddEntryToResponse(file_entry->path, file_entry->id); |
| 971 } | 981 } |
| 972 SendResponse(true); | 982 SendResponse(true); |
| 973 return true; | 983 return true; |
| 974 } | 984 } |
| 975 | 985 |
| 976 } // namespace extensions | 986 } // namespace extensions |
| OLD | NEW |