Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: chrome/browser/extensions/api/browsing_data/browsing_data_api.cc

Issue 1297093002: Cache Storage API: Hook up to chrome://settings/cookies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase onto https://codereview.chromium.org/1297023004 Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 28 matching lines...) Expand all
39 const char kCookiesKey[] = "cookies"; 39 const char kCookiesKey[] = "cookies";
40 const char kDownloadsKey[] = "downloads"; 40 const char kDownloadsKey[] = "downloads";
41 const char kFileSystemsKey[] = "fileSystems"; 41 const char kFileSystemsKey[] = "fileSystems";
42 const char kFormDataKey[] = "formData"; 42 const char kFormDataKey[] = "formData";
43 const char kHistoryKey[] = "history"; 43 const char kHistoryKey[] = "history";
44 const char kIndexedDBKey[] = "indexedDB"; 44 const char kIndexedDBKey[] = "indexedDB";
45 const char kLocalStorageKey[] = "localStorage"; 45 const char kLocalStorageKey[] = "localStorage";
46 const char kPasswordsKey[] = "passwords"; 46 const char kPasswordsKey[] = "passwords";
47 const char kPluginDataKey[] = "pluginData"; 47 const char kPluginDataKey[] = "pluginData";
48 const char kServiceWorkersKey[] = "serviceWorkers"; 48 const char kServiceWorkersKey[] = "serviceWorkers";
49 const char kCacheStorageKey[] = "cacheStorage";
49 const char kWebSQLKey[] = "webSQL"; 50 const char kWebSQLKey[] = "webSQL";
50 51
51 // Option keys. 52 // Option keys.
52 const char kExtensionsKey[] = "extension"; 53 const char kExtensionsKey[] = "extension";
53 const char kOriginTypesKey[] = "originTypes"; 54 const char kOriginTypesKey[] = "originTypes";
54 const char kProtectedWebKey[] = "protectedWeb"; 55 const char kProtectedWebKey[] = "protectedWeb";
55 const char kSinceKey[] = "since"; 56 const char kSinceKey[] = "since";
56 const char kUnprotectedWebKey[] = "unprotectedWeb"; 57 const char kUnprotectedWebKey[] = "unprotectedWeb";
57 58
58 // Errors! 59 // Errors!
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 if (strcmp(key, 92 if (strcmp(key,
92 extension_browsing_data_api_constants::kChannelIDsKey) == 0) 93 extension_browsing_data_api_constants::kChannelIDsKey) == 0)
93 return BrowsingDataRemover::REMOVE_CHANNEL_IDS; 94 return BrowsingDataRemover::REMOVE_CHANNEL_IDS;
94 if (strcmp(key, extension_browsing_data_api_constants::kPasswordsKey) == 0) 95 if (strcmp(key, extension_browsing_data_api_constants::kPasswordsKey) == 0)
95 return BrowsingDataRemover::REMOVE_PASSWORDS; 96 return BrowsingDataRemover::REMOVE_PASSWORDS;
96 if (strcmp(key, extension_browsing_data_api_constants::kPluginDataKey) == 0) 97 if (strcmp(key, extension_browsing_data_api_constants::kPluginDataKey) == 0)
97 return BrowsingDataRemover::REMOVE_PLUGIN_DATA; 98 return BrowsingDataRemover::REMOVE_PLUGIN_DATA;
98 if (strcmp(key, extension_browsing_data_api_constants::kServiceWorkersKey) == 99 if (strcmp(key, extension_browsing_data_api_constants::kServiceWorkersKey) ==
99 0) 100 0)
100 return BrowsingDataRemover::REMOVE_SERVICE_WORKERS; 101 return BrowsingDataRemover::REMOVE_SERVICE_WORKERS;
102 if (strcmp(key, extension_browsing_data_api_constants::kCacheStorageKey) == 0)
103 return BrowsingDataRemover::REMOVE_CACHE_STORAGE;
101 if (strcmp(key, extension_browsing_data_api_constants::kWebSQLKey) == 0) 104 if (strcmp(key, extension_browsing_data_api_constants::kWebSQLKey) == 0)
102 return BrowsingDataRemover::REMOVE_WEBSQL; 105 return BrowsingDataRemover::REMOVE_WEBSQL;
103 106
104 return 0; 107 return 0;
105 } 108 }
106 109
107 // Returns false if any of the selected data types are not allowed to be 110 // Returns false if any of the selected data types are not allowed to be
108 // deleted. 111 // deleted.
109 bool IsRemovalPermitted(int removal_mask, PrefService* prefs) { 112 bool IsRemovalPermitted(int removal_mask, PrefService* prefs) {
110 // Enterprise policy or user preference might prohibit deleting browser or 113 // Enterprise policy or user preference might prohibit deleting browser or
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 delete_site_data); 178 delete_site_data);
176 SetDetails(selected.get(), permitted.get(), 179 SetDetails(selected.get(), permitted.get(),
177 extension_browsing_data_api_constants::kWebSQLKey, 180 extension_browsing_data_api_constants::kWebSQLKey,
178 delete_site_data); 181 delete_site_data);
179 SetDetails(selected.get(), permitted.get(), 182 SetDetails(selected.get(), permitted.get(),
180 extension_browsing_data_api_constants::kChannelIDsKey, 183 extension_browsing_data_api_constants::kChannelIDsKey,
181 delete_site_data); 184 delete_site_data);
182 SetDetails(selected.get(), permitted.get(), 185 SetDetails(selected.get(), permitted.get(),
183 extension_browsing_data_api_constants::kServiceWorkersKey, 186 extension_browsing_data_api_constants::kServiceWorkersKey,
184 delete_site_data); 187 delete_site_data);
188 SetDetails(selected.get(), permitted.get(),
189 extension_browsing_data_api_constants::kCacheStorageKey,
190 delete_site_data);
185 191
186 SetDetails(selected.get(), permitted.get(), 192 SetDetails(selected.get(), permitted.get(),
187 extension_browsing_data_api_constants::kPluginDataKey, 193 extension_browsing_data_api_constants::kPluginDataKey,
188 delete_site_data && prefs->GetBoolean(prefs::kClearPluginLSODataEnabled)); 194 delete_site_data && prefs->GetBoolean(prefs::kClearPluginLSODataEnabled));
189 195
190 SetDetails(selected.get(), permitted.get(), 196 SetDetails(selected.get(), permitted.get(),
191 extension_browsing_data_api_constants::kHistoryKey, 197 extension_browsing_data_api_constants::kHistoryKey,
192 prefs->GetBoolean(prefs::kDeleteBrowsingHistory)); 198 prefs->GetBoolean(prefs::kDeleteBrowsingHistory));
193 SetDetails(selected.get(), permitted.get(), 199 SetDetails(selected.get(), permitted.get(),
194 extension_browsing_data_api_constants::kDownloadsKey, 200 extension_browsing_data_api_constants::kDownloadsKey,
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 } 432 }
427 433
428 int BrowsingDataRemovePasswordsFunction::GetRemovalMask() { 434 int BrowsingDataRemovePasswordsFunction::GetRemovalMask() {
429 return BrowsingDataRemover::REMOVE_PASSWORDS; 435 return BrowsingDataRemover::REMOVE_PASSWORDS;
430 } 436 }
431 437
432 int BrowsingDataRemoveServiceWorkersFunction::GetRemovalMask() { 438 int BrowsingDataRemoveServiceWorkersFunction::GetRemovalMask() {
433 return BrowsingDataRemover::REMOVE_SERVICE_WORKERS; 439 return BrowsingDataRemover::REMOVE_SERVICE_WORKERS;
434 } 440 }
435 441
442 int BrowsingDataRemoveCacheStorageFunction::GetRemovalMask() {
443 return BrowsingDataRemover::REMOVE_CACHE_STORAGE;
444 }
445
436 int BrowsingDataRemoveWebSQLFunction::GetRemovalMask() { 446 int BrowsingDataRemoveWebSQLFunction::GetRemovalMask() {
437 return BrowsingDataRemover::REMOVE_WEBSQL; 447 return BrowsingDataRemover::REMOVE_WEBSQL;
438 } 448 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698