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

Unified Diff: chrome/browser/history/history_utils.cc

Issue 971423002: Abstract code filtering URLs added to the history (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@keyed-service
Patch Set: Created 5 years, 10 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/history/history_utils.cc
diff --git a/chrome/browser/history/history_utils.cc b/chrome/browser/history/history_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1bc5e8d69a122dcbdd040f73be09a8c964d3a207
--- /dev/null
+++ b/chrome/browser/history/history_utils.cc
@@ -0,0 +1,33 @@
+// Copyright 2015 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/history/history_utils.h"
+
+#include "chrome/common/url_constants.h"
+#include "components/dom_distiller/core/url_constants.h"
+#include "url/gurl.h"
+
+bool CanAddURLToHistory(const GURL& url) {
+ if (!url.is_valid())
+ return false;
+
+ // TODO: We should allow kChromeUIScheme URLs if they have been explicitly
+ // typed. Right now, however, these are marked as typed even when triggered
+ // by a shortcut or menu action.
+ if (url.SchemeIs(url::kJavaScriptScheme) ||
+ url.SchemeIs(content::kChromeDevToolsScheme) ||
+ url.SchemeIs(content::kChromeUIScheme) ||
+ url.SchemeIs(content::kViewSourceScheme) ||
+ url.SchemeIs(chrome::kChromeNativeScheme) ||
+ url.SchemeIs(chrome::kChromeSearchScheme) ||
+ url.SchemeIs(dom_distiller::kDomDistillerScheme))
+ return false;
+
+ // Allow all about: and chrome: URLs except about:blank, since the user may
+ // like to see "chrome://memory/", etc. in their history and autocomplete.
+ if (url == GURL(url::kAboutBlankURL))
+ return false;
+
+ return true;
+}

Powered by Google App Engine
This is Rietveld 408576698