| 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/chromeos/drive/file_system.h" | 5 #include "chrome/browser/chromeos/drive/file_system.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 } | 448 } |
| 449 | 449 |
| 450 void FileSystem::CreateDirectory( | 450 void FileSystem::CreateDirectory( |
| 451 const base::FilePath& directory_path, | 451 const base::FilePath& directory_path, |
| 452 bool is_exclusive, | 452 bool is_exclusive, |
| 453 bool is_recursive, | 453 bool is_recursive, |
| 454 const FileOperationCallback& callback) { | 454 const FileOperationCallback& callback) { |
| 455 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 455 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 456 DCHECK(!callback.is_null()); | 456 DCHECK(!callback.is_null()); |
| 457 | 457 |
| 458 change_list_loader_->LoadIfNeeded( | 458 // Ensure its parent directory is loaded to the local metadata. |
| 459 internal::DirectoryFetchInfo(), | 459 LoadDirectoryIfNeeded( |
| 460 directory_path.DirName(), |
| 460 base::Bind(&FileSystem::CreateDirectoryAfterLoad, | 461 base::Bind(&FileSystem::CreateDirectoryAfterLoad, |
| 461 weak_ptr_factory_.GetWeakPtr(), | 462 weak_ptr_factory_.GetWeakPtr(), |
| 462 directory_path, is_exclusive, is_recursive, callback)); | 463 directory_path, is_exclusive, is_recursive, callback)); |
| 463 } | 464 } |
| 464 | 465 |
| 465 void FileSystem::CreateDirectoryAfterLoad( | 466 void FileSystem::CreateDirectoryAfterLoad( |
| 466 const base::FilePath& directory_path, | 467 const base::FilePath& directory_path, |
| 467 bool is_exclusive, | 468 bool is_exclusive, |
| 468 bool is_recursive, | 469 bool is_recursive, |
| 469 const FileOperationCallback& callback, | 470 const FileOperationCallback& callback, |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 if (util::IsSpecialResourceId(id)) | 1086 if (util::IsSpecialResourceId(id)) |
| 1086 return; | 1087 return; |
| 1087 | 1088 |
| 1088 util::Log(logging::LOG_INFO, | 1089 util::Log(logging::LOG_INFO, |
| 1089 "Thumbnail refresh for %s", directory_path.AsUTF8Unsafe().c_str()); | 1090 "Thumbnail refresh for %s", directory_path.AsUTF8Unsafe().c_str()); |
| 1090 change_list_loader_->LoadDirectoryFromServer( | 1091 change_list_loader_->LoadDirectoryFromServer( |
| 1091 id, base::Bind(&util::EmptyFileOperationCallback)); | 1092 id, base::Bind(&util::EmptyFileOperationCallback)); |
| 1092 } | 1093 } |
| 1093 | 1094 |
| 1094 } // namespace drive | 1095 } // namespace drive |
| OLD | NEW |