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

Unified Diff: chrome/browser/browsing_data_helper.cc

Issue 9958111: Adding a BrowsingDataHelper class to hold some useful methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase onto trunk. Created 8 years, 9 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
« no previous file with comments | « chrome/browser/browsing_data_helper.h ('k') | chrome/browser/browsing_data_helper_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browsing_data_helper.cc
diff --git a/chrome/browser/browsing_data_helper.cc b/chrome/browser/browsing_data_helper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..88d0b372009273ac264a19b2237928eed891a795
--- /dev/null
+++ b/chrome/browser/browsing_data_helper.cc
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/browsing_data_helper.h"
+
+#include "base/utf_string_conversions.h"
+#include "chrome/common/url_constants.h"
+#include "content/public/browser/child_process_security_policy.h"
+#include "googleurl/src/gurl.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
+
+// Static
+bool BrowsingDataHelper::IsValidScheme(const std::string& scheme) {
+ content::ChildProcessSecurityPolicy* policy =
+ content::ChildProcessSecurityPolicy::GetInstance();
+ return (policy->IsWebSafeScheme(scheme) &&
+ scheme != chrome::kChromeDevToolsScheme &&
+ scheme != chrome::kExtensionScheme);
+}
+
+// Static
+bool BrowsingDataHelper::IsValidScheme(const WebKit::WebString& scheme) {
+ return BrowsingDataHelper::IsValidScheme(UTF16ToUTF8(scheme));
+}
+
+// Static
+bool BrowsingDataHelper::HasValidScheme(const GURL& origin) {
+ return BrowsingDataHelper::IsValidScheme(origin.scheme());
+}
« no previous file with comments | « chrome/browser/browsing_data_helper.h ('k') | chrome/browser/browsing_data_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698