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

Unified Diff: chrome/browser/history/history_service.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/history_service.cc
diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc
index d3c78c672c7fd3f364f44a946bdc4f23deec08ff..9c26170afe51ede69c1b73aebe1e8df5d0f822e3 100644
--- a/chrome/browser/history/history_service.cc
+++ b/chrome/browser/history/history_service.cc
@@ -37,12 +37,12 @@
#include "chrome/browser/history/in_memory_history_backend.h"
#include "chrome/browser/history/in_memory_url_index.h"
#include "chrome/browser/history/top_sites.h"
+#include "chrome/browser/history/url_utils.h"
#include "chrome/browser/history/visit_database.h"
#include "chrome/browser/history/visit_filter.h"
#include "chrome/browser/history/web_history_service.h"
#include "chrome/browser/history/web_history_service_factory.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/importer/imported_favicon_usage.h"
#include "chrome/common/pref_names.h"
@@ -424,7 +424,7 @@ void HistoryService::AddPage(const history::HistoryAddPageArgs& add_page_args) {
// large part of history (think iframes for ads) and we never display them in
// history UI. We will still add manual subframes, which are ones the user
// has clicked on to get.
- if (!CanAddURL(add_page_args.url))
+ if (!history::CanAddURL(add_page_args.url))
return;
// Add link & all redirects to visited link list.
@@ -450,7 +450,7 @@ void HistoryService::AddPageNoVisitForBookmark(const GURL& url,
const base::string16& title) {
DCHECK(thread_) << "History service being called after cleanup";
DCHECK(thread_checker_.CalledOnValidThread());
- if (!CanAddURL(url))
+ if (!history::CanAddURL(url))
return;
ScheduleAndForget(PRIORITY_NORMAL,
@@ -484,7 +484,7 @@ void HistoryService::AddPageWithDetails(const GURL& url,
DCHECK(thread_) << "History service being called after cleanup";
DCHECK(thread_checker_.CalledOnValidThread());
// Filter out unwanted URLs.
- if (!CanAddURL(url))
+ if (!history::CanAddURL(url))
return;
// Add to the visited links system.
@@ -643,7 +643,7 @@ void HistoryService::MergeFavicon(
const gfx::Size& pixel_size) {
DCHECK(thread_) << "History service being called after cleanup";
DCHECK(thread_checker_.CalledOnValidThread());
- if (!CanAddURL(page_url))
+ if (!history::CanAddURL(page_url))
return;
ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::MergeFavicon, page_url,
@@ -657,7 +657,7 @@ void HistoryService::SetFavicons(
const std::vector<SkBitmap>& bitmaps) {
DCHECK(thread_) << "History service being called after cleanup";
DCHECK(thread_checker_.CalledOnValidThread());
- if (!CanAddURL(page_url))
+ if (!history::CanAddURL(page_url))
return;
ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetFavicons, page_url,
@@ -1044,31 +1044,6 @@ void HistoryService::ScheduleTask(SchedulePriority priority,
thread_->message_loop()->PostTask(FROM_HERE, task);
}
-// static
-bool HistoryService::CanAddURL(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;
-}
-
base::WeakPtr<HistoryService> HistoryService::AsWeakPtr() {
DCHECK(thread_checker_.CalledOnValidThread());
return weak_ptr_factory_.GetWeakPtr();

Powered by Google App Engine
This is Rietveld 408576698