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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_UTIL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_UTIL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/memory/scoped_ptr.h" |
11 #include "base/platform_file.h" | 12 #include "base/platform_file.h" |
12 #include "chrome/browser/chromeos/drive/drive_file_error.h" | 13 #include "chrome/browser/chromeos/drive/drive_file_error.h" |
13 #include "chrome/browser/google_apis/gdata_errorcode.h" | 14 #include "chrome/browser/google_apis/gdata_errorcode.h" |
14 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
15 | 16 |
16 class Profile; | 17 class Profile; |
17 | 18 |
18 namespace base { | 19 namespace base { |
19 class FilePath; | 20 class FilePath; |
20 } | 21 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 void ConvertProtoToPlatformFileInfo(const PlatformFileInfoProto& proto, | 133 void ConvertProtoToPlatformFileInfo(const PlatformFileInfoProto& proto, |
133 base::PlatformFileInfo* file_info); | 134 base::PlatformFileInfo* file_info); |
134 | 135 |
135 // Converts the platform file info to the proto representation. | 136 // Converts the platform file info to the proto representation. |
136 void ConvertPlatformFileInfoToProto(const base::PlatformFileInfo& file_info, | 137 void ConvertPlatformFileInfoToProto(const base::PlatformFileInfo& file_info, |
137 PlatformFileInfoProto* proto); | 138 PlatformFileInfoProto* proto); |
138 | 139 |
139 // Does nothing with |error|. Used with functions taking FileOperationCallback. | 140 // Does nothing with |error|. Used with functions taking FileOperationCallback. |
140 void EmptyFileOperationCallback(DriveFileError error); | 141 void EmptyFileOperationCallback(DriveFileError error); |
141 | 142 |
| 143 // Helper to destroy objects which needs Destroy() to be called on destruction. |
| 144 struct DestroyHelper { |
| 145 template<typename T> |
| 146 void operator()(T* object) const { |
| 147 if (object) |
| 148 object->Destroy(); |
| 149 } |
| 150 }; |
| 151 |
142 } // namespace util | 152 } // namespace util |
143 } // namespace drive | 153 } // namespace drive |
144 | 154 |
145 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_UTIL_H_ | 155 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_UTIL_H_ |
OLD | NEW |