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

Unified Diff: components/history/core/browser/url_database.cc

Issue 339433007: Componentize URLDatabase (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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: components/history/core/browser/url_database.cc
diff --git a/chrome/browser/history/url_database.cc b/components/history/core/browser/url_database.cc
similarity index 96%
rename from chrome/browser/history/url_database.cc
rename to components/history/core/browser/url_database.cc
index 3e8c8e509c9790f846c5a765a2f920eb73409840..469cb085a700d8d855c0183618bb1a1b6b725bf1 100644
--- a/chrome/browser/history/url_database.cc
+++ b/components/history/core/browser/url_database.cc
@@ -2,19 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/history/url_database.h"
+#include "components/history/core/browser/url_database.h"
-#include <algorithm>
#include <limits>
#include <string>
#include <vector>
#include "base/i18n/case_conversion.h"
+#include "base/memory/scoped_vector.h"
#include "base/strings/utf_string_conversions.h"
-#include "chrome/common/url_constants.h"
+#include "components/history/core/browser/keyword_search_term.h"
#include "net/base/net_util.h"
#include "sql/statement.h"
-#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
namespace history {
@@ -616,4 +615,22 @@ bool URLDatabase::CreateMainURLIndex() {
"CREATE INDEX IF NOT EXISTS urls_url_index ON urls (url)");
}
+const int kLowQualityMatchTypedLimit = 1;
+const int kLowQualityMatchVisitLimit = 4;
+const int kLowQualityMatchAgeLimitInDays = 3;
+
+base::Time AutocompleteAgeThreshold() {
+ return (base::Time::Now() -
+ base::TimeDelta::FromDays(kLowQualityMatchAgeLimitInDays));
+}
+
+bool RowQualifiesAsSignificant(const URLRow& row,
+ const base::Time& threshold) {
+ const base::Time& real_threshold =
+ threshold.is_null() ? AutocompleteAgeThreshold() : threshold;
+ return (row.typed_count() >= kLowQualityMatchTypedLimit) ||
+ (row.visit_count() >= kLowQualityMatchVisitLimit) ||
+ (row.last_visit() >= real_threshold);
+}
+
} // namespace history
« no previous file with comments | « components/history/core/browser/url_database.h ('k') | components/history/core/browser/url_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698