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/update_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/update_operation.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/drive/drive.pb.h" | 7 #include "chrome/browser/chromeos/drive/drive.pb.h" |
8 #include "chrome/browser/chromeos/drive/file_cache.h" | 8 #include "chrome/browser/chromeos/drive/file_cache.h" |
9 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" | 9 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" |
10 #include "chrome/browser/chromeos/drive/file_system_util.h" | 10 #include "chrome/browser/chromeos/drive/file_system_util.h" |
11 #include "chrome/browser/chromeos/drive/job_scheduler.h" | 11 #include "chrome/browser/chromeos/drive/job_scheduler.h" |
12 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h" | 12 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h" |
13 #include "chrome/browser/chromeos/drive/resource_metadata.h" | 13 #include "chrome/browser/chromeos/drive/resource_metadata.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 | 15 |
16 using content::BrowserThread; | 16 using content::BrowserThread; |
17 | 17 |
18 namespace drive { | 18 namespace drive { |
19 namespace file_system { | 19 namespace file_system { |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 // Gets locally stored information about the specified file. | 23 // Gets locally stored information about the specified file. |
24 FileError GetFileLocalState(internal::ResourceMetadata* metadata, | 24 FileError GetFileLocalState(internal::ResourceMetadata* metadata, |
25 internal::FileCache* cache, | 25 internal::FileCache* cache, |
26 const std::string& resource_id, | 26 const std::string& resource_id, |
27 ResourceEntry* entry, | 27 ResourceEntry* entry, |
28 base::FilePath* drive_file_path, | 28 base::FilePath* drive_file_path, |
29 base::FilePath* cache_file_path) { | 29 base::FilePath* cache_file_path) { |
30 FileError error = metadata->GetResourceEntryById(resource_id, NULL, entry); | 30 FileError error = metadata->GetResourceEntryById(resource_id, entry); |
31 if (error != FILE_ERROR_OK) | 31 if (error != FILE_ERROR_OK) |
32 return error; | 32 return error; |
33 | 33 |
34 if (entry->file_info().is_directory()) | 34 if (entry->file_info().is_directory()) |
35 return FILE_ERROR_NOT_A_FILE; | 35 return FILE_ERROR_NOT_A_FILE; |
36 | 36 |
37 *drive_file_path = metadata->GetFilePath(resource_id); | 37 *drive_file_path = metadata->GetFilePath(resource_id); |
38 if (drive_file_path->empty()) | 38 if (drive_file_path->empty()) |
39 return FILE_ERROR_NOT_FOUND; | 39 return FILE_ERROR_NOT_FOUND; |
40 | 40 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 if (error != FILE_ERROR_OK) { | 181 if (error != FILE_ERROR_OK) { |
182 callback.Run(error); | 182 callback.Run(error); |
183 return; | 183 return; |
184 } | 184 } |
185 observer_->OnDirectoryChangedByOperation(drive_file_path->DirName()); | 185 observer_->OnDirectoryChangedByOperation(drive_file_path->DirName()); |
186 callback.Run(FILE_ERROR_OK); | 186 callback.Run(FILE_ERROR_OK); |
187 } | 187 } |
188 | 188 |
189 } // namespace file_system | 189 } // namespace file_system |
190 } // namespace drive | 190 } // namespace drive |
OLD | NEW |