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 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 return metadata.details().change_id() >= change_id; | 1631 return metadata.details().change_id() >= change_id; |
1632 } | 1632 } |
1633 | 1633 |
1634 scoped_ptr<base::ListValue> MetadataDatabase::DumpTrackers() { | 1634 scoped_ptr<base::ListValue> MetadataDatabase::DumpTrackers() { |
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", | 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_UNSAFE(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 |
(...skipping 18 matching lines...) Expand all Loading... |
1670 "tracker_kind", | 1670 "tracker_kind", |
1671 tracker_kind == TRACKER_KIND_APP_ROOT ? "AppRoot" : | 1671 tracker_kind == TRACKER_KIND_APP_ROOT ? "AppRoot" : |
1672 tracker_kind == TRACKER_KIND_DISABLED_APP_ROOT ? "Disabled App" : | 1672 tracker_kind == TRACKER_KIND_DISABLED_APP_ROOT ? "Disabled App" : |
1673 tracker.tracker_id() == GetSyncRootTrackerID() ? "SyncRoot" : | 1673 tracker.tracker_id() == GetSyncRootTrackerID() ? "SyncRoot" : |
1674 "Regular"); | 1674 "Regular"); |
1675 dict->SetString("app_id", tracker.app_id()); | 1675 dict->SetString("app_id", tracker.app_id()); |
1676 dict->SetString("active", tracker.active() ? "true" : "false"); | 1676 dict->SetString("active", tracker.active() ? "true" : "false"); |
1677 dict->SetString("dirty", tracker.dirty() ? "true" : "false"); | 1677 dict->SetString("dirty", tracker.dirty() ? "true" : "false"); |
1678 dict->SetString("folder_listing", | 1678 dict->SetString("folder_listing", |
1679 tracker.needs_folder_listing() ? "needed" : "no"); | 1679 tracker.needs_folder_listing() ? "needed" : "no"); |
| 1680 |
| 1681 bool is_demoted = index_->IsDemotedDirtyTracker(tracker.tracker_id()); |
| 1682 dict->SetString("demoted", is_demoted ? "true" : "false"); |
1680 if (tracker.has_synced_details()) { | 1683 if (tracker.has_synced_details()) { |
1681 const FileDetails& details = tracker.synced_details(); | 1684 const FileDetails& details = tracker.synced_details(); |
1682 dict->SetString("title", details.title()); | 1685 dict->SetString("title", details.title()); |
1683 dict->SetString("kind", FileKindToString(details.file_kind())); | 1686 dict->SetString("kind", FileKindToString(details.file_kind())); |
1684 dict->SetString("md5", details.md5()); | 1687 dict->SetString("md5", details.md5()); |
1685 dict->SetString("etag", details.etag()); | 1688 dict->SetString("etag", details.etag()); |
1686 dict->SetString("missing", details.missing() ? "true" : "false"); | 1689 dict->SetString("missing", details.missing() ? "true" : "false"); |
1687 dict->SetString("change_id", base::Int64ToString(details.change_id())); | 1690 dict->SetString("change_id", base::Int64ToString(details.change_id())); |
1688 } | 1691 } |
1689 trackers->Append(dict); | 1692 trackers->Append(dict); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1791 return false; | 1794 return false; |
1792 | 1795 |
1793 if (!parents.empty()) | 1796 if (!parents.empty()) |
1794 return false; | 1797 return false; |
1795 | 1798 |
1796 return true; | 1799 return true; |
1797 } | 1800 } |
1798 | 1801 |
1799 } // namespace drive_backend | 1802 } // namespace drive_backend |
1800 } // namespace sync_file_system | 1803 } // namespace sync_file_system |
OLD | NEW |