OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ |
6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <queue> | 10 #include <queue> |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 REMOVE_PASSWORDS = 1 << 10, | 87 REMOVE_PASSWORDS = 1 << 10, |
88 REMOVE_WEBSQL = 1 << 11, | 88 REMOVE_WEBSQL = 1 << 11, |
89 REMOVE_CHANNEL_IDS = 1 << 12, | 89 REMOVE_CHANNEL_IDS = 1 << 12, |
90 REMOVE_MEDIA_LICENSES = 1 << 13, | 90 REMOVE_MEDIA_LICENSES = 1 << 13, |
91 REMOVE_SERVICE_WORKERS = 1 << 14, | 91 REMOVE_SERVICE_WORKERS = 1 << 14, |
92 REMOVE_SITE_USAGE_DATA = 1 << 15, | 92 REMOVE_SITE_USAGE_DATA = 1 << 15, |
93 // REMOVE_NOCHECKS intentionally does not check if the browser context is | 93 // REMOVE_NOCHECKS intentionally does not check if the browser context is |
94 // prohibited from deleting history or downloads. | 94 // prohibited from deleting history or downloads. |
95 REMOVE_NOCHECKS = 1 << 16, | 95 REMOVE_NOCHECKS = 1 << 16, |
96 REMOVE_CACHE_STORAGE = 1 << 17, | 96 REMOVE_CACHE_STORAGE = 1 << 17, |
97 #if BUILDFLAG(ANDROID_JAVA_UI) | 97 #if defined(OS_ANDROID) |
98 REMOVE_WEBAPP_DATA = 1 << 18, | 98 REMOVE_WEBAPP_DATA = 1 << 18, |
99 #endif | 99 #endif |
100 REMOVE_DURABLE_PERMISSION = 1 << 19, | 100 REMOVE_DURABLE_PERMISSION = 1 << 19, |
101 | 101 |
102 // The following flag is used only in tests. In normal usage, hosted app | 102 // The following flag is used only in tests. In normal usage, hosted app |
103 // data is controlled by the REMOVE_COOKIES flag, applied to the | 103 // data is controlled by the REMOVE_COOKIES flag, applied to the |
104 // protected-web origin. | 104 // protected-web origin. |
105 REMOVE_HOSTED_APP_DATA_TESTONLY = 1 << 31, | 105 REMOVE_HOSTED_APP_DATA_TESTONLY = 1 << 31, |
106 | 106 |
107 // "Site data" includes cookies, appcache, file systems, indexedDBs, local | 107 // "Site data" includes cookies, appcache, file systems, indexedDBs, local |
108 // storage, webSQL, service workers, cache storage, plugin data, web app | 108 // storage, webSQL, service workers, cache storage, plugin data, web app |
109 // data (on Android) and statistics about passwords. | 109 // data (on Android) and statistics about passwords. |
110 REMOVE_SITE_DATA = REMOVE_APPCACHE | REMOVE_COOKIES | REMOVE_FILE_SYSTEMS | | 110 REMOVE_SITE_DATA = REMOVE_APPCACHE | REMOVE_COOKIES | REMOVE_FILE_SYSTEMS | |
111 REMOVE_INDEXEDDB | | 111 REMOVE_INDEXEDDB | |
112 REMOVE_LOCAL_STORAGE | | 112 REMOVE_LOCAL_STORAGE | |
113 REMOVE_PLUGIN_DATA | | 113 REMOVE_PLUGIN_DATA | |
114 REMOVE_SERVICE_WORKERS | | 114 REMOVE_SERVICE_WORKERS | |
115 REMOVE_CACHE_STORAGE | | 115 REMOVE_CACHE_STORAGE | |
116 REMOVE_WEBSQL | | 116 REMOVE_WEBSQL | |
117 REMOVE_CHANNEL_IDS | | 117 REMOVE_CHANNEL_IDS | |
118 #if BUILDFLAG(ANDROID_JAVA_UI) | 118 #if defined(OS_ANDROID) |
119 REMOVE_WEBAPP_DATA | | 119 REMOVE_WEBAPP_DATA | |
120 #endif | 120 #endif |
121 REMOVE_SITE_USAGE_DATA | | 121 REMOVE_SITE_USAGE_DATA | |
122 REMOVE_DURABLE_PERMISSION, | 122 REMOVE_DURABLE_PERMISSION, |
123 | 123 |
124 // Datatypes protected by Important Sites. | 124 // Datatypes protected by Important Sites. |
125 IMPORTANT_SITES_DATATYPES = REMOVE_SITE_DATA | | 125 IMPORTANT_SITES_DATATYPES = REMOVE_SITE_DATA | REMOVE_CACHE, |
126 REMOVE_CACHE, | |
127 | 126 |
128 // Datatypes that can be deleted partially per URL / origin / domain, | 127 // Datatypes that can be deleted partially per URL / origin / domain, |
129 // whichever makes sense. | 128 // whichever makes sense. |
130 FILTERABLE_DATATYPES = REMOVE_SITE_DATA | | 129 FILTERABLE_DATATYPES = REMOVE_SITE_DATA | REMOVE_CACHE | REMOVE_DOWNLOADS, |
131 REMOVE_CACHE | | |
132 REMOVE_DOWNLOADS, | |
133 | 130 |
134 // Includes all the available remove options. Meant to be used by clients | 131 // Includes all the available remove options. Meant to be used by clients |
135 // that wish to wipe as much data as possible from a Profile, to make it | 132 // that wish to wipe as much data as possible from a Profile, to make it |
136 // look like a new Profile. | 133 // look like a new Profile. |
137 REMOVE_ALL = REMOVE_SITE_DATA | REMOVE_CACHE | REMOVE_DOWNLOADS | | 134 REMOVE_ALL = REMOVE_SITE_DATA | REMOVE_CACHE | REMOVE_DOWNLOADS | |
138 REMOVE_FORM_DATA | | 135 REMOVE_FORM_DATA | |
139 REMOVE_HISTORY | | 136 REMOVE_HISTORY | |
140 REMOVE_PASSWORDS | | 137 REMOVE_PASSWORDS | |
141 REMOVE_MEDIA_LICENSES, | 138 REMOVE_MEDIA_LICENSES, |
142 | 139 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 // TODO(msramek): If other consumers than tests are interested in this, | 287 // TODO(msramek): If other consumers than tests are interested in this, |
291 // consider returning them in OnBrowsingDataRemoverDone() callback. | 288 // consider returning them in OnBrowsingDataRemoverDone() callback. |
292 const base::Time& GetLastUsedBeginTime(); | 289 const base::Time& GetLastUsedBeginTime(); |
293 const base::Time& GetLastUsedEndTime(); | 290 const base::Time& GetLastUsedEndTime(); |
294 int GetLastUsedRemovalMask(); | 291 int GetLastUsedRemovalMask(); |
295 int GetLastUsedOriginTypeMask(); | 292 int GetLastUsedOriginTypeMask(); |
296 | 293 |
297 protected: | 294 protected: |
298 // Use BrowsingDataRemoverFactory::GetForBrowserContext to get an instance of | 295 // Use BrowsingDataRemoverFactory::GetForBrowserContext to get an instance of |
299 // this class. The constructor is protected so that the class is mockable. | 296 // this class. The constructor is protected so that the class is mockable. |
300 BrowsingDataRemover(content::BrowserContext* browser_context); | 297 explicit BrowsingDataRemover(content::BrowserContext* browser_context); |
301 ~BrowsingDataRemover() override; | 298 ~BrowsingDataRemover() override; |
302 | 299 |
303 // A common reduction of all public Remove[WithFilter][AndReply] methods. | 300 // A common reduction of all public Remove[WithFilter][AndReply] methods. |
304 virtual void RemoveInternal( | 301 virtual void RemoveInternal( |
305 const base::Time& delete_begin, | 302 const base::Time& delete_begin, |
306 const base::Time& delete_end, | 303 const base::Time& delete_end, |
307 int remove_mask, | 304 int remove_mask, |
308 int origin_type_mask, | 305 int origin_type_mask, |
309 std::unique_ptr<BrowsingDataFilterBuilder> filter_builder, | 306 std::unique_ptr<BrowsingDataFilterBuilder> filter_builder, |
310 Observer* observer); | 307 Observer* observer); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 | 443 |
447 // We do not own this. | 444 // We do not own this. |
448 content::StoragePartition* storage_partition_for_testing_ = nullptr; | 445 content::StoragePartition* storage_partition_for_testing_ = nullptr; |
449 | 446 |
450 base::WeakPtrFactory<BrowsingDataRemover> weak_ptr_factory_; | 447 base::WeakPtrFactory<BrowsingDataRemover> weak_ptr_factory_; |
451 | 448 |
452 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); | 449 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); |
453 }; | 450 }; |
454 | 451 |
455 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ | 452 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ |
OLD | NEW |