OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/browsing_data/chrome_browsing_data_types.h" |
| 6 |
| 7 #include <set> |
| 8 |
| 9 #include "base/lazy_instance.h" |
| 10 #include "build/build_config.h" |
| 11 |
| 12 //////////////////////////////////////////////////////////////////////////////// |
| 13 // Chrome-specific datatypes. |
| 14 |
| 15 const content::BrowsingDataType kBrowsingDataTypeHistory{"history", false}; |
| 16 |
| 17 const content::BrowsingDataType kBrowsingDataTypeFormData{"form data", false}; |
| 18 |
| 19 const content::BrowsingDataType kBrowsingDataTypePasswords{"passwords", true}; |
| 20 |
| 21 const content::BrowsingDataType kBrowsingDataTypePluginData{"plugin data", |
| 22 true}; |
| 23 |
| 24 #if defined(OS_ANDROID) |
| 25 const content::BrowsingDataType kBrowsingDataTypeWebAppData{"webapp data", |
| 26 true}; |
| 27 #endif |
| 28 |
| 29 const content::BrowsingDataType kBrowsingDataTypeSiteUsageData{ |
| 30 "site usage data", true}; |
| 31 |
| 32 const content::BrowsingDataType kBrowsingDataTypeDurablePermission{ |
| 33 "durable permission", true}; |
| 34 |
| 35 const content::BrowsingDataType kBrowsingDataTypeExternalProtocolData{ |
| 36 "external protocol data", true}; |
| 37 |
| 38 const content::BrowsingDataType kBrowsingDataTypeHostedAppDataTestOnly{ |
| 39 "hosted app data (test only)", true}; |
| 40 |
| 41 //////////////////////////////////////////////////////////////////////////////// |
| 42 // Group datatypes. |
| 43 |
| 44 namespace { |
| 45 |
| 46 class GroupDataTypes { |
| 47 public: |
| 48 GroupDataTypes() { |
| 49 // SiteData |
| 50 site_data = { |
| 51 &kBrowsingDataTypeAppCache, |
| 52 &kBrowsingDataTypeCookies, |
| 53 &kBrowsingDataTypeFileSystems, |
| 54 &kBrowsingDataTypeIndexedDB, |
| 55 &kBrowsingDataTypeLocalStorage, |
| 56 &kBrowsingDataTypePluginData, |
| 57 &kBrowsingDataTypeServiceWorkers, |
| 58 &kBrowsingDataTypeCacheStorage, |
| 59 &kBrowsingDataTypeWebSQL, |
| 60 &kBrowsingDataTypeChannelIDs, |
| 61 #if defined(OS_ANDROID) |
| 62 &kBrowsingDataTypeWebAppData, |
| 63 #endif |
| 64 &kBrowsingDataTypeSiteUsageData, |
| 65 &kBrowsingDataTypeDurablePermission, |
| 66 &kBrowsingDataTypeExternalProtocolData, |
| 67 }; |
| 68 |
| 69 // ImportantSites |
| 70 important_sites = site_data; |
| 71 important_sites.insert(&kBrowsingDataTypeCache); |
| 72 |
| 73 // All |
| 74 all = important_sites; |
| 75 all.insert(&kBrowsingDataTypeDownloads); |
| 76 all.insert(&kBrowsingDataTypeFormData); |
| 77 all.insert(&kBrowsingDataTypeHistory); |
| 78 all.insert(&kBrowsingDataTypePasswords); |
| 79 |
| 80 // WipeProfile |
| 81 wipe_profile = all; |
| 82 wipe_profile.insert(&kBrowsingDataTypeNoChecks); |
| 83 } |
| 84 |
| 85 ~GroupDataTypes() {} |
| 86 |
| 87 std::set<const content::BrowsingDataType*> site_data; |
| 88 std::set<const content::BrowsingDataType*> important_sites; |
| 89 std::set<const content::BrowsingDataType*> all; |
| 90 std::set<const content::BrowsingDataType*> wipe_profile; |
| 91 }; |
| 92 |
| 93 static base::LazyInstance<GroupDataTypes>::Leaky g_group_data_types = |
| 94 LAZY_INSTANCE_INITIALIZER; |
| 95 |
| 96 } // namespace |
| 97 |
| 98 const std::set<const content::BrowsingDataType*>& |
| 99 BrowsingDataTypeSetSiteData() { |
| 100 return g_group_data_types.Get().site_data; |
| 101 } |
| 102 |
| 103 const std::set<const content::BrowsingDataType*>& |
| 104 BrowsingDataTypeSetImportantSites() { |
| 105 return g_group_data_types.Get().important_sites; |
| 106 } |
| 107 |
| 108 const std::set<const content::BrowsingDataType*>& BrowsingDataTypeSetAll() { |
| 109 return g_group_data_types.Get().all; |
| 110 } |
| 111 |
| 112 const std::set<const content::BrowsingDataType*>& |
| 113 BrowsingDataTypeSetWipeProfile() { |
| 114 return g_group_data_types.Get().wipe_profile; |
| 115 } |
OLD | NEW |