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

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

Issue 722723005: Move constants used by history component to history namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initial patchset Created 6 years, 1 month 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/url_utils.cc
diff --git a/chrome/browser/history/url_utils.cc b/chrome/browser/history/url_utils.cc
index 0c7369a2e0a7496bac80b4e941c6042045d4d30c..4be8768848ed43eb53a9eb241d30d5050014982b 100644
--- a/chrome/browser/history/url_utils.cc
+++ b/chrome/browser/history/url_utils.cc
@@ -6,6 +6,8 @@
#include <algorithm>
+#include "chrome/common/url_constants.h"
+#include "components/dom_distiller/core/url_constants.h"
#include "url/gurl.h"
namespace history {
@@ -85,4 +87,28 @@ GURL ToggleHTTPAndHTTPS(const GURL& url) {
return url.ReplaceComponents(replacement);
}
+bool CanAddURL(const GURL& url) {
sdefresne 2014/11/21 14:11:41 We won't be able to move this function into the co
nshaik 2014/11/25 22:21:14 Will do it in the other CL.
+ 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;
+}
+
} // namespace history
« no previous file with comments | « chrome/browser/history/url_utils.h ('k') | chrome/browser/safe_browsing/incident_reporting/last_download_finder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698