| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <string> | 11 #include <string> |
| 11 | 12 |
| 12 #include "base/bind.h" | 13 #include "base/bind.h" |
| 13 #include "base/callback.h" | 14 #include "base/callback.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h" | 15 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h" |
| 16 #include "chrome/browser/sync_file_system/sync_status_code.h" | 16 #include "chrome/browser/sync_file_system/sync_status_code.h" |
| 17 #include "google_apis/drive/drive_api_error_codes.h" | 17 #include "google_apis/drive/drive_api_error_codes.h" |
| 18 #include "storage/browser/blob/scoped_file.h" | 18 #include "storage/browser/blob/scoped_file.h" |
| 19 | 19 |
| 20 namespace google_apis { | 20 namespace google_apis { |
| 21 class ChangeResource; | 21 class ChangeResource; |
| 22 class FileResource; | 22 class FileResource; |
| 23 } | 23 } |
| 24 | 24 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 45 std::string GetTrackerTitle(const FileTracker& tracker); | 45 std::string GetTrackerTitle(const FileTracker& tracker); |
| 46 | 46 |
| 47 SyncStatusCode DriveApiErrorCodeToSyncStatusCode( | 47 SyncStatusCode DriveApiErrorCodeToSyncStatusCode( |
| 48 google_apis::DriveApiErrorCode error); | 48 google_apis::DriveApiErrorCode error); |
| 49 | 49 |
| 50 // Returns true if |str| starts with |prefix|, and removes |prefix| from |str|. | 50 // Returns true if |str| starts with |prefix|, and removes |prefix| from |str|. |
| 51 // If |out| is not NULL, the result is stored in it. | 51 // If |out| is not NULL, the result is stored in it. |
| 52 bool RemovePrefix(const std::string& str, const std::string& prefix, | 52 bool RemovePrefix(const std::string& str, const std::string& prefix, |
| 53 std::string* out); | 53 std::string* out); |
| 54 | 54 |
| 55 scoped_ptr<ServiceMetadata> InitializeServiceMetadata(LevelDBWrapper* db); | 55 std::unique_ptr<ServiceMetadata> InitializeServiceMetadata(LevelDBWrapper* db); |
| 56 | 56 |
| 57 template <typename Src, typename Dest> | 57 template <typename Src, typename Dest> |
| 58 void AppendContents(const Src& src, Dest* dest) { | 58 void AppendContents(const Src& src, Dest* dest) { |
| 59 dest->insert(dest->end(), src.begin(), src.end()); | 59 dest->insert(dest->end(), src.begin(), src.end()); |
| 60 } | 60 } |
| 61 | 61 |
| 62 template <typename Container> | 62 template <typename Container> |
| 63 const typename Container::mapped_type& LookUpMap( | 63 const typename Container::mapped_type& LookUpMap( |
| 64 const Container& container, | 64 const Container& container, |
| 65 const typename Container::key_type& key, | 65 const typename Container::key_type& key, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 80 base::Callback<R()> CreateComposedFunction( | 80 base::Callback<R()> CreateComposedFunction( |
| 81 const base::Callback<T()>& g, | 81 const base::Callback<T()>& g, |
| 82 const base::Callback<R(S)>& f) { | 82 const base::Callback<R(S)>& f) { |
| 83 return base::Bind(&ComposeFunction<R, S, T>, g, f); | 83 return base::Bind(&ComposeFunction<R, S, T>, g, f); |
| 84 } | 84 } |
| 85 | 85 |
| 86 } // namespace drive_backend | 86 } // namespace drive_backend |
| 87 } // namespace sync_file_system | 87 } // namespace sync_file_system |
| 88 | 88 |
| 89 #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 |