| 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 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_BACKEND_UTIL_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_BACKEND_UTIL_H_ |
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_BACKEND_UTIL_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_BACKEND_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // IO-allowed task runner, and the runner must be given as |file_task_runner|. | 55 // IO-allowed task runner, and the runner must be given as |file_task_runner|. |
| 56 webkit_blob::ScopedFile CreateTemporaryFile( | 56 webkit_blob::ScopedFile CreateTemporaryFile( |
| 57 base::TaskRunner* file_task_runner); | 57 base::TaskRunner* file_task_runner); |
| 58 | 58 |
| 59 std::string FileKindToString(FileKind file_kind); | 59 std::string FileKindToString(FileKind file_kind); |
| 60 | 60 |
| 61 bool HasFileAsParent(const FileDetails& details, const std::string& file_id); | 61 bool HasFileAsParent(const FileDetails& details, const std::string& file_id); |
| 62 | 62 |
| 63 std::string GetMimeTypeFromTitle(const base::FilePath& title); | 63 std::string GetMimeTypeFromTitle(const base::FilePath& title); |
| 64 | 64 |
| 65 scoped_ptr<google_apis::ResourceEntry> GetOldestCreatedFolderResource( | |
| 66 ScopedVector<google_apis::ResourceEntry> list); | |
| 67 | |
| 68 SyncStatusCode GDataErrorCodeToSyncStatusCode( | 65 SyncStatusCode GDataErrorCodeToSyncStatusCode( |
| 69 google_apis::GDataErrorCode error); | 66 google_apis::GDataErrorCode error); |
| 70 | 67 |
| 71 scoped_ptr<FileTracker> CloneFileTracker(const FileTracker* obj); | 68 scoped_ptr<FileTracker> CloneFileTracker(const FileTracker* obj); |
| 72 | 69 |
| 73 template <typename Src, typename Dest> | 70 template <typename Src, typename Dest> |
| 74 void AppendContents(const Src& src, Dest* dest) { | 71 void AppendContents(const Src& src, Dest* dest) { |
| 75 dest->insert(dest->end(), src.begin(), src.end()); | 72 dest->insert(dest->end(), src.begin(), src.end()); |
| 76 } | 73 } |
| 77 | 74 |
| 78 template <typename Container> | 75 template <typename Container> |
| 79 const typename Container::mapped_type& LookUpMap( | 76 const typename Container::mapped_type& LookUpMap( |
| 80 const Container& container, | 77 const Container& container, |
| 81 const typename Container::key_type& key, | 78 const typename Container::key_type& key, |
| 82 const typename Container::mapped_type& default_value) { | 79 const typename Container::mapped_type& default_value) { |
| 83 typename Container::const_iterator found = container.find(key); | 80 typename Container::const_iterator found = container.find(key); |
| 84 if (found == container.end()) | 81 if (found == container.end()) |
| 85 return default_value; | 82 return default_value; |
| 86 return found->second; | 83 return found->second; |
| 87 } | 84 } |
| 88 | 85 |
| 89 } // namespace drive_backend | 86 } // namespace drive_backend |
| 90 } // namespace sync_file_system | 87 } // namespace sync_file_system |
| 91 | 88 |
| 92 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_BACKEND_UTIL_H_ | 89 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_BACKEND_UTIL_H_ |
| OLD | NEW |