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/sync_file_system/drive_backend_v1/drive_metadata_store.
h" | 5 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_metadata_store.
h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
19 #include "base/task_runner_util.h" | 19 #include "base/task_runner_util.h" |
20 #include "base/values.h" | 20 #include "base/values.h" |
21 #include "chrome/browser/sync_file_system/drive_backend/metadata_db_migration_ut
il.h" | 21 #include "chrome/browser/sync_file_system/drive_backend/metadata_db_migration_ut
il.h" |
22 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_servi
ce.h" | 22 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_servi
ce.h" |
23 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_util.
h" | 23 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_util.
h" |
24 #include "chrome/browser/sync_file_system/logger.h" | 24 #include "chrome/browser/sync_file_system/logger.h" |
25 #include "chrome/browser/sync_file_system/sync_file_system.pb.h" | 25 #include "chrome/browser/sync_file_system/sync_file_system.pb.h" |
26 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 26 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
27 #include "third_party/leveldatabase/src/include/leveldb/db.h" | 27 #include "third_party/leveldatabase/src/include/leveldb/db.h" |
28 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h" | 28 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h" |
29 #include "url/gurl.h" | 29 #include "url/gurl.h" |
30 #include "webkit/browser/fileapi/file_system_url.h" | 30 #include "storage/browser/fileapi/file_system_url.h" |
31 #include "webkit/common/fileapi/file_system_util.h" | 31 #include "storage/common/fileapi/file_system_util.h" |
32 | 32 |
33 using fileapi::FileSystemURL; | 33 using storage::FileSystemURL; |
34 | 34 |
35 namespace sync_file_system { | 35 namespace sync_file_system { |
36 | 36 |
37 typedef DriveMetadataStore::MetadataMap MetadataMap; | 37 typedef DriveMetadataStore::MetadataMap MetadataMap; |
38 typedef DriveMetadataStore::OriginByResourceId OriginByResourceId; | 38 typedef DriveMetadataStore::OriginByResourceId OriginByResourceId; |
39 typedef DriveMetadataStore::PathToMetadata PathToMetadata; | 39 typedef DriveMetadataStore::PathToMetadata PathToMetadata; |
40 typedef DriveMetadataStore::ResourceIdByOrigin ResourceIdByOrigin; | 40 typedef DriveMetadataStore::ResourceIdByOrigin ResourceIdByOrigin; |
41 | 41 |
42 const base::FilePath::CharType DriveMetadataStore::kDatabaseName[] = | 42 const base::FilePath::CharType DriveMetadataStore::kDatabaseName[] = |
43 FILE_PATH_LITERAL("DriveMetadata"); | 43 FILE_PATH_LITERAL("DriveMetadata"); |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 | 671 |
672 void DriveMetadataStore::UpdateDBStatusAndInvokeCallback( | 672 void DriveMetadataStore::UpdateDBStatusAndInvokeCallback( |
673 const SyncStatusCallback& callback, | 673 const SyncStatusCallback& callback, |
674 const leveldb::Status& leveldb_status) { | 674 const leveldb::Status& leveldb_status) { |
675 SyncStatusCode status = LevelDBStatusToSyncStatusCode(leveldb_status); | 675 SyncStatusCode status = LevelDBStatusToSyncStatusCode(leveldb_status); |
676 UpdateDBStatus(status); | 676 UpdateDBStatus(status); |
677 callback.Run(status); | 677 callback.Run(status); |
678 } | 678 } |
679 | 679 |
680 SyncStatusCode DriveMetadataStore::GetConflictURLs( | 680 SyncStatusCode DriveMetadataStore::GetConflictURLs( |
681 fileapi::FileSystemURLSet* urls) const { | 681 storage::FileSystemURLSet* urls) const { |
682 DCHECK(CalledOnValidThread()); | 682 DCHECK(CalledOnValidThread()); |
683 DCHECK_EQ(SYNC_STATUS_OK, db_status_); | 683 DCHECK_EQ(SYNC_STATUS_OK, db_status_); |
684 | 684 |
685 urls->clear(); | 685 urls->clear(); |
686 for (MetadataMap::const_iterator origin_itr = metadata_map_.begin(); | 686 for (MetadataMap::const_iterator origin_itr = metadata_map_.begin(); |
687 origin_itr != metadata_map_.end(); | 687 origin_itr != metadata_map_.end(); |
688 ++origin_itr) { | 688 ++origin_itr) { |
689 for (PathToMetadata::const_iterator itr = origin_itr->second.begin(); | 689 for (PathToMetadata::const_iterator itr = origin_itr->second.begin(); |
690 itr != origin_itr->second.end(); | 690 itr != origin_itr->second.end(); |
691 ++itr) { | 691 ++itr) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 details->SetString("dirty", metadata.to_be_fetched() ? "true" : "false"); | 791 details->SetString("dirty", metadata.to_be_fetched() ? "true" : "false"); |
792 | 792 |
793 file->Set("details", details); | 793 file->Set("details", details); |
794 files->Append(file); | 794 files->Append(file); |
795 } | 795 } |
796 | 796 |
797 return files.Pass(); | 797 return files.Pass(); |
798 } | 798 } |
799 | 799 |
800 } // namespace sync_file_system | 800 } // namespace sync_file_system |
OLD | NEW |