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/metadata_database.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <stack> | 8 #include <stack> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1635 scoped_ptr<base::ListValue> trackers(new base::ListValue); | 1635 scoped_ptr<base::ListValue> trackers(new base::ListValue); |
1636 | 1636 |
1637 // Append the first element for metadata. | 1637 // Append the first element for metadata. |
1638 base::DictionaryValue* metadata = new base::DictionaryValue; | 1638 base::DictionaryValue* metadata = new base::DictionaryValue; |
1639 const char *trackerKeys[] = { | 1639 const char *trackerKeys[] = { |
1640 "tracker_id", "path", "file_id", "tracker_kind", "app_id", | 1640 "tracker_id", "path", "file_id", "tracker_kind", "app_id", |
1641 "active", "dirty", "folder_listing", "demoted", | 1641 "active", "dirty", "folder_listing", "demoted", |
1642 "title", "kind", "md5", "etag", "missing", "change_id", | 1642 "title", "kind", "md5", "etag", "missing", "change_id", |
1643 }; | 1643 }; |
1644 std::vector<std::string> key_strings( | 1644 std::vector<std::string> key_strings( |
1645 trackerKeys, trackerKeys + ARRAYSIZE_UNSAFE(trackerKeys)); | 1645 trackerKeys, trackerKeys + arraysize(trackerKeys)); |
1646 base::ListValue* keys = new base::ListValue; | 1646 base::ListValue* keys = new base::ListValue; |
1647 keys->AppendStrings(key_strings); | 1647 keys->AppendStrings(key_strings); |
1648 metadata->SetString("title", "Trackers"); | 1648 metadata->SetString("title", "Trackers"); |
1649 metadata->Set("keys", keys); | 1649 metadata->Set("keys", keys); |
1650 trackers->Append(metadata); | 1650 trackers->Append(metadata); |
1651 | 1651 |
1652 // Append tracker data. | 1652 // Append tracker data. |
1653 std::vector<int64> tracker_ids(index_->GetAllTrackerIDs()); | 1653 std::vector<int64> tracker_ids(index_->GetAllTrackerIDs()); |
1654 for (std::vector<int64>::const_iterator itr = tracker_ids.begin(); | 1654 for (std::vector<int64>::const_iterator itr = tracker_ids.begin(); |
1655 itr != tracker_ids.end(); ++itr) { | 1655 itr != tracker_ids.end(); ++itr) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 scoped_ptr<base::ListValue> MetadataDatabase::DumpMetadata() { | 1697 scoped_ptr<base::ListValue> MetadataDatabase::DumpMetadata() { |
1698 scoped_ptr<base::ListValue> files(new base::ListValue); | 1698 scoped_ptr<base::ListValue> files(new base::ListValue); |
1699 | 1699 |
1700 // Append the first element for metadata. | 1700 // Append the first element for metadata. |
1701 base::DictionaryValue* metadata = new base::DictionaryValue; | 1701 base::DictionaryValue* metadata = new base::DictionaryValue; |
1702 const char *fileKeys[] = { | 1702 const char *fileKeys[] = { |
1703 "file_id", "title", "type", "md5", "etag", "missing", | 1703 "file_id", "title", "type", "md5", "etag", "missing", |
1704 "change_id", "parents" | 1704 "change_id", "parents" |
1705 }; | 1705 }; |
1706 std::vector<std::string> key_strings( | 1706 std::vector<std::string> key_strings( |
1707 fileKeys, fileKeys + ARRAYSIZE_UNSAFE(fileKeys)); | 1707 fileKeys, fileKeys + arraysize(fileKeys)); |
1708 base::ListValue* keys = new base::ListValue; | 1708 base::ListValue* keys = new base::ListValue; |
1709 keys->AppendStrings(key_strings); | 1709 keys->AppendStrings(key_strings); |
1710 metadata->SetString("title", "Metadata"); | 1710 metadata->SetString("title", "Metadata"); |
1711 metadata->Set("keys", keys); | 1711 metadata->Set("keys", keys); |
1712 files->Append(metadata); | 1712 files->Append(metadata); |
1713 | 1713 |
1714 // Append metadata data. | 1714 // Append metadata data. |
1715 std::vector<std::string> metadata_ids(index_->GetAllMetadataIDs()); | 1715 std::vector<std::string> metadata_ids(index_->GetAllMetadataIDs()); |
1716 for (std::vector<std::string>::const_iterator itr = metadata_ids.begin(); | 1716 for (std::vector<std::string>::const_iterator itr = metadata_ids.begin(); |
1717 itr != metadata_ids.end(); ++itr) { | 1717 itr != metadata_ids.end(); ++itr) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1794 return false; | 1794 return false; |
1795 | 1795 |
1796 if (!parents.empty()) | 1796 if (!parents.empty()) |
1797 return false; | 1797 return false; |
1798 | 1798 |
1799 return true; | 1799 return true; |
1800 } | 1800 } |
1801 | 1801 |
1802 } // namespace drive_backend | 1802 } // namespace drive_backend |
1803 } // namespace sync_file_system | 1803 } // namespace sync_file_system |
OLD | NEW |