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

Unified Diff: chrome/browser/browsing_data_helper.cc

Issue 10413072: Teaching BrowsingDataRemover how to delete application data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: How's this direction? Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/browsing_data_helper.cc
diff --git a/chrome/browser/browsing_data_helper.cc b/chrome/browser/browsing_data_helper.cc
index e5d59d37afad0464f94868ac31959fa53edaed88..be58eb5860f4cc02446d21d9e47991f1c861a0c2 100644
--- a/chrome/browser/browsing_data_helper.cc
+++ b/chrome/browser/browsing_data_helper.cc
@@ -6,6 +6,7 @@
#include "base/command_line.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/extensions/extension_special_storage_policy.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/child_process_security_policy.h"
@@ -40,3 +41,26 @@ bool BrowsingDataHelper::IsValidScheme(const WebKit::WebString& scheme) {
bool BrowsingDataHelper::HasValidScheme(const GURL& origin) {
return BrowsingDataHelper::IsValidScheme(origin.scheme());
}
+
+// Static
+bool BrowsingDataHelper::DoesOriginMatchMask(const GURL& origin,
+ int origin_set_mask, ExtensionSpecialStoragePolicy* policy) {
+ // If a websafe origin is unprotected, it matches iff UNPROTECTED_WEB.
+ if (!policy->IsStorageProtected(origin.GetOrigin()) &&
+ BrowsingDataHelper::HasValidScheme(origin.GetOrigin()) &&
+ origin_set_mask & UNPROTECTED_WEB)
+ return true;
+
+ // Packaged apps and extensions match iff EXTENSION.
+ if (!BrowsingDataHelper::HasValidScheme(origin.GetOrigin()) &&
Bernhard Bauer 2012/05/31 15:57:31 Could you change this check to just `origin.scheme
Mike West 2012/06/01 13:35:17 Running with `isWebScheme` and `isExtensionScheme`
+ origin_set_mask & EXTENSION)
+ return true;
+
+ // Hosted applications (protected and websafe origins) iff PROTECTED_WEB.
+ if (policy->IsStorageProtected(origin.GetOrigin()) &&
+ BrowsingDataHelper::HasValidScheme(origin.GetOrigin()) &&
+ origin_set_mask & PROTECTED_WEB)
+ return true;
+
+ return false;
+}

Powered by Google App Engine
This is Rietveld 408576698