Chromium Code Reviews| 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 // Defines the Chrome Extensions BrowsingData API functions, which entail | 5 // Defines the Chrome Extensions BrowsingData API functions, which entail |
| 6 // clearing browsing data, and clearing the browser's cache (which, let's be | 6 // clearing browsing data, and clearing the browser's cache (which, let's be |
| 7 // honest, are the same thing), as specified in the extension API JSON. | 7 // honest, are the same thing), as specified in the extension API JSON. |
| 8 | 8 |
| 9 #include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h" | 9 #include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h" |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 const char kFileSystemsKey[] = "fileSystems"; | 44 const char kFileSystemsKey[] = "fileSystems"; |
| 45 const char kFormDataKey[] = "formData"; | 45 const char kFormDataKey[] = "formData"; |
| 46 const char kHistoryKey[] = "history"; | 46 const char kHistoryKey[] = "history"; |
| 47 const char kIndexedDBKey[] = "indexedDB"; | 47 const char kIndexedDBKey[] = "indexedDB"; |
| 48 const char kLocalStorageKey[] = "localStorage"; | 48 const char kLocalStorageKey[] = "localStorage"; |
| 49 const char kPasswordsKey[] = "passwords"; | 49 const char kPasswordsKey[] = "passwords"; |
| 50 const char kPluginDataKey[] = "pluginData"; | 50 const char kPluginDataKey[] = "pluginData"; |
| 51 const char kServiceWorkersKey[] = "serviceWorkers"; | 51 const char kServiceWorkersKey[] = "serviceWorkers"; |
| 52 const char kCacheStorageKey[] = "cacheStorage"; | 52 const char kCacheStorageKey[] = "cacheStorage"; |
| 53 const char kWebSQLKey[] = "webSQL"; | 53 const char kWebSQLKey[] = "webSQL"; |
| 54 const char kExternalProtocolDataKey[] = "externalProtocolData"; | |
|
msramek
2017/02/15 20:36:52
Note that it is not a requirement from privacy sid
ramyasharma
2017/02/16 03:29:47
Thank you. This worked, and I reverted the changes
| |
| 54 | 55 |
| 55 // Option keys. | 56 // Option keys. |
| 56 const char kExtensionsKey[] = "extension"; | 57 const char kExtensionsKey[] = "extension"; |
| 57 const char kOriginTypesKey[] = "originTypes"; | 58 const char kOriginTypesKey[] = "originTypes"; |
| 58 const char kProtectedWebKey[] = "protectedWeb"; | 59 const char kProtectedWebKey[] = "protectedWeb"; |
| 59 const char kSinceKey[] = "since"; | 60 const char kSinceKey[] = "since"; |
| 60 const char kUnprotectedWebKey[] = "unprotectedWeb"; | 61 const char kUnprotectedWebKey[] = "unprotectedWeb"; |
| 61 | 62 |
| 62 // Errors! | 63 // Errors! |
| 63 // The placeholder will be filled by the name of the affected data type (e.g., | 64 // The placeholder will be filled by the name of the affected data type (e.g., |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 return BrowsingDataRemover::REMOVE_PASSWORDS; | 97 return BrowsingDataRemover::REMOVE_PASSWORDS; |
| 97 if (strcmp(key, extension_browsing_data_api_constants::kPluginDataKey) == 0) | 98 if (strcmp(key, extension_browsing_data_api_constants::kPluginDataKey) == 0) |
| 98 return BrowsingDataRemover::REMOVE_PLUGIN_DATA; | 99 return BrowsingDataRemover::REMOVE_PLUGIN_DATA; |
| 99 if (strcmp(key, extension_browsing_data_api_constants::kServiceWorkersKey) == | 100 if (strcmp(key, extension_browsing_data_api_constants::kServiceWorkersKey) == |
| 100 0) | 101 0) |
| 101 return BrowsingDataRemover::REMOVE_SERVICE_WORKERS; | 102 return BrowsingDataRemover::REMOVE_SERVICE_WORKERS; |
| 102 if (strcmp(key, extension_browsing_data_api_constants::kCacheStorageKey) == 0) | 103 if (strcmp(key, extension_browsing_data_api_constants::kCacheStorageKey) == 0) |
| 103 return BrowsingDataRemover::REMOVE_CACHE_STORAGE; | 104 return BrowsingDataRemover::REMOVE_CACHE_STORAGE; |
| 104 if (strcmp(key, extension_browsing_data_api_constants::kWebSQLKey) == 0) | 105 if (strcmp(key, extension_browsing_data_api_constants::kWebSQLKey) == 0) |
| 105 return BrowsingDataRemover::REMOVE_WEBSQL; | 106 return BrowsingDataRemover::REMOVE_WEBSQL; |
| 107 if (strcmp(key, | |
| 108 extension_browsing_data_api_constants::kExternalProtocolDataKey) == | |
| 109 0) | |
| 110 return BrowsingDataRemover::REMOVE_EXTERNAL_PROTOCOL_DATA; | |
| 106 | 111 |
| 107 return 0; | 112 return 0; |
| 108 } | 113 } |
| 109 | 114 |
| 110 // Returns false if any of the selected data types are not allowed to be | 115 // Returns false if any of the selected data types are not allowed to be |
| 111 // deleted. | 116 // deleted. |
| 112 bool IsRemovalPermitted(int removal_mask, PrefService* prefs) { | 117 bool IsRemovalPermitted(int removal_mask, PrefService* prefs) { |
| 113 // Enterprise policy or user preference might prohibit deleting browser or | 118 // Enterprise policy or user preference might prohibit deleting browser or |
| 114 // download history. | 119 // download history. |
| 115 if ((removal_mask & BrowsingDataRemover::REMOVE_HISTORY) || | 120 if ((removal_mask & BrowsingDataRemover::REMOVE_HISTORY) || |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 SetDetails(selected.get(), permitted.get(), | 180 SetDetails(selected.get(), permitted.get(), |
| 176 extension_browsing_data_api_constants::kIndexedDBKey, | 181 extension_browsing_data_api_constants::kIndexedDBKey, |
| 177 delete_site_data); | 182 delete_site_data); |
| 178 SetDetails(selected.get(), permitted.get(), | 183 SetDetails(selected.get(), permitted.get(), |
| 179 extension_browsing_data_api_constants::kLocalStorageKey, | 184 extension_browsing_data_api_constants::kLocalStorageKey, |
| 180 delete_site_data); | 185 delete_site_data); |
| 181 SetDetails(selected.get(), permitted.get(), | 186 SetDetails(selected.get(), permitted.get(), |
| 182 extension_browsing_data_api_constants::kWebSQLKey, | 187 extension_browsing_data_api_constants::kWebSQLKey, |
| 183 delete_site_data); | 188 delete_site_data); |
| 184 SetDetails(selected.get(), permitted.get(), | 189 SetDetails(selected.get(), permitted.get(), |
| 185 extension_browsing_data_api_constants::kChannelIDsKey, | 190 extension_browsing_data_api_constants::kExternalProtocolDataKey, |
| 186 delete_site_data); | 191 delete_site_data); |
| 192 SetDetails(selected.get(), permitted.get(), | |
| 193 extension_browsing_data_api_constants::kChannelIDsKey, | |
| 194 delete_site_data); | |
| 187 SetDetails(selected.get(), permitted.get(), | 195 SetDetails(selected.get(), permitted.get(), |
| 188 extension_browsing_data_api_constants::kServiceWorkersKey, | 196 extension_browsing_data_api_constants::kServiceWorkersKey, |
| 189 delete_site_data); | 197 delete_site_data); |
| 190 SetDetails(selected.get(), permitted.get(), | 198 SetDetails(selected.get(), permitted.get(), |
| 191 extension_browsing_data_api_constants::kCacheStorageKey, | 199 extension_browsing_data_api_constants::kCacheStorageKey, |
| 192 delete_site_data); | 200 delete_site_data); |
| 193 | 201 |
| 194 SetDetails(selected.get(), permitted.get(), | 202 SetDetails(selected.get(), permitted.get(), |
| 195 extension_browsing_data_api_constants::kPluginDataKey, | 203 extension_browsing_data_api_constants::kPluginDataKey, |
| 196 delete_site_data && | 204 delete_site_data && |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 461 | 469 |
| 462 bool BrowsingDataRemoveCacheStorageFunction::GetRemovalMask(int* removal_mask) { | 470 bool BrowsingDataRemoveCacheStorageFunction::GetRemovalMask(int* removal_mask) { |
| 463 *removal_mask = BrowsingDataRemover::REMOVE_CACHE_STORAGE; | 471 *removal_mask = BrowsingDataRemover::REMOVE_CACHE_STORAGE; |
| 464 return true; | 472 return true; |
| 465 } | 473 } |
| 466 | 474 |
| 467 bool BrowsingDataRemoveWebSQLFunction::GetRemovalMask(int* removal_mask) { | 475 bool BrowsingDataRemoveWebSQLFunction::GetRemovalMask(int* removal_mask) { |
| 468 *removal_mask = BrowsingDataRemover::REMOVE_WEBSQL; | 476 *removal_mask = BrowsingDataRemover::REMOVE_WEBSQL; |
| 469 return true; | 477 return true; |
| 470 } | 478 } |
| 479 | |
| 480 bool BrowsingDataRemoveExternalProtocolDataFunction::GetRemovalMask( | |
| 481 int* removal_mask) { | |
| 482 *removal_mask = BrowsingDataRemover::REMOVE_EXTERNAL_PROTOCOL_DATA; | |
| 483 return true; | |
| 484 } | |
| OLD | NEW |