OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/create_file_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/create_file_operation.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "chrome/browser/chromeos/drive/drive.pb.h" | 10 #include "chrome/browser/chromeos/drive/drive.pb.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 if (error == FILE_ERROR_OK) { | 108 if (error == FILE_ERROR_OK) { |
109 // At this point, upload to the server is fully succeeded. | 109 // At this point, upload to the server is fully succeeded. |
110 // Populate the |file_path| which will be used to notify the observer. | 110 // Populate the |file_path| which will be used to notify the observer. |
111 *file_path = metadata->GetFilePath(local_id); | 111 *file_path = metadata->GetFilePath(local_id); |
112 | 112 |
113 // Also store an empty file to the cache. | 113 // Also store an empty file to the cache. |
114 // Here, failure is not a fatal error, so ignore the returned code. | 114 // Here, failure is not a fatal error, so ignore the returned code. |
115 FileError cache_store_error = FILE_ERROR_FAILED; | 115 FileError cache_store_error = FILE_ERROR_FAILED; |
116 base::FilePath empty_file; | 116 base::FilePath empty_file; |
117 if (file_util::CreateTemporaryFile(&empty_file)) { | 117 if (base::CreateTemporaryFile(&empty_file)) { |
118 cache_store_error = cache->Store( | 118 cache_store_error = cache->Store( |
119 local_id, | 119 local_id, |
120 entry.file_specific_info().md5(), | 120 entry.file_specific_info().md5(), |
121 empty_file, | 121 empty_file, |
122 internal::FileCache::FILE_OPERATION_MOVE); | 122 internal::FileCache::FILE_OPERATION_MOVE); |
123 } | 123 } |
124 DLOG_IF(WARNING, cache_store_error != FILE_ERROR_OK) | 124 DLOG_IF(WARNING, cache_store_error != FILE_ERROR_OK) |
125 << "Failed to store a cache file: " | 125 << "Failed to store a cache file: " |
126 << FileErrorToString(cache_store_error) | 126 << FileErrorToString(cache_store_error) |
127 << ", local_id: " << local_id; | 127 << ", local_id: " << local_id; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 245 |
246 // Notify observer if the file creation process is successfully done. | 246 // Notify observer if the file creation process is successfully done. |
247 if (error == FILE_ERROR_OK) | 247 if (error == FILE_ERROR_OK) |
248 observer_->OnDirectoryChangedByOperation(file_path->DirName()); | 248 observer_->OnDirectoryChangedByOperation(file_path->DirName()); |
249 | 249 |
250 callback.Run(error); | 250 callback.Run(error); |
251 } | 251 } |
252 | 252 |
253 } // namespace file_system | 253 } // namespace file_system |
254 } // namespace drive | 254 } // namespace drive |
OLD | NEW |