summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-23 23:54:21 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-23 23:54:21 +0000
commit078d0f72f9f8b518b8b44a6b1e489458ce4fafdf (patch)
tree2efddfa153dd2ac59c415ffa5633a6050fada0a0
parentb37ea77f80650f9bf88aeedfb0650463e0df6253 (diff)
downloadchromium_src-078d0f72f9f8b518b8b44a6b1e489458ce4fafdf.zip
chromium_src-078d0f72f9f8b518b8b44a6b1e489458ce4fafdf.tar.gz
chromium_src-078d0f72f9f8b518b8b44a6b1e489458ce4fafdf.tar.bz2
Stop depending on search_engines from history
TemplateURLService under search_engines is depending on HistoryService. history should not depend on search_engines. Add history::KeywordID. Typedef TemplateURLID as KeywordID. BUG=371823 TEST=build TBR=newt@chromium.org for chrome/browser/android/chrome_browser_provider.cc Review URL: https://codereview.chromium.org/343303002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279234 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/android/provider/chrome_browser_provider.cc4
-rw-r--r--chrome/browser/history/DEPS1
-rw-r--r--chrome/browser/history/android/android_history_provider_service_unittest.cc2
-rw-r--r--chrome/browser/history/android/android_history_types.cc2
-rw-r--r--chrome/browser/history/android/android_history_types.h16
-rw-r--r--chrome/browser/history/android/android_provider_backend.cc6
-rw-r--r--chrome/browser/history/android/android_provider_backend_unittest.cc4
-rw-r--r--chrome/browser/history/history_backend.cc9
-rw-r--r--chrome/browser/history/history_backend.h10
-rw-r--r--chrome/browser/history/history_backend_unittest.cc12
-rw-r--r--chrome/browser/history/history_notifications.cc2
-rw-r--r--chrome/browser/history/history_notifications.h6
-rw-r--r--chrome/browser/history/history_service.cc12
-rw-r--r--chrome/browser/history/history_service.h10
-rw-r--r--chrome/browser/history/history_types.h8
-rw-r--r--chrome/browser/history/in_memory_history_backend.cc2
-rw-r--r--chrome/browser/history/url_database.cc6
-rw-r--r--chrome/browser/history/url_database.h8
-rw-r--r--chrome/browser/history/url_database_unittest.cc4
-rw-r--r--components/history.gypi1
-rw-r--r--components/history/core/browser/keyword_id.h18
-rw-r--r--components/search_engines/DEPS1
-rw-r--r--components/search_engines/template_url_id.h4
23 files changed, 84 insertions, 64 deletions
diff --git a/chrome/browser/android/provider/chrome_browser_provider.cc b/chrome/browser/android/provider/chrome_browser_provider.cc
index d93db03..62b8864 100644
--- a/chrome/browser/android/provider/chrome_browser_provider.cc
+++ b/chrome/browser/android/provider/chrome_browser_provider.cc
@@ -893,7 +893,7 @@ class SearchTermTask : public HistoryProviderTask {
: HistoryProviderTask(service, cancelable_consumer),
profile_(profile) {}
- // Fill SearchRow's template_url_id and url fields according the given
+ // Fill SearchRow's keyword_id and url fields according the given
// search_term. Return true if succeeded.
void BuildSearchRow(history::SearchRow* row) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -912,7 +912,7 @@ class SearchTermTask : public HistoryProviderTask {
search_terms_args, template_service->search_terms_data());
if (!url.empty()) {
row->set_url(GURL(url));
- row->set_template_url_id(search_engine->id());
+ row->set_keyword_id(search_engine->id());
}
}
}
diff --git a/chrome/browser/history/DEPS b/chrome/browser/history/DEPS
index be5e1ff..3b7427f 100644
--- a/chrome/browser/history/DEPS
+++ b/chrome/browser/history/DEPS
@@ -3,6 +3,7 @@ include_rules = [
# basic rules followed by temporary exceptions. Please don't
# add to the list of exceptions!
"-chrome/browser",
+ "-components/search_engines",
"+chrome/browser/chrome_notification_types.h",
"+chrome/browser/common",
"+chrome/browser/favicon",
diff --git a/chrome/browser/history/android/android_history_provider_service_unittest.cc b/chrome/browser/history/android/android_history_provider_service_unittest.cc
index 11b32f9..5e43493 100644
--- a/chrome/browser/history/android/android_history_provider_service_unittest.cc
+++ b/chrome/browser/history/android/android_history_provider_service_unittest.cc
@@ -211,7 +211,7 @@ TEST_F(AndroidHistoryProviderServiceTest, TestSearchTerm) {
SearchRow search_row;
search_row.set_search_term(base::UTF8ToUTF16("google"));
search_row.set_url(GURL("http://google.com"));
- search_row.set_template_url_id(1);
+ search_row.set_keyword_id(1);
search_row.set_search_time(Time::Now());
scoped_refptr<CallbackHelper> callback(new CallbackHelper());
diff --git a/chrome/browser/history/android/android_history_types.cc b/chrome/browser/history/android/android_history_types.cc
index 653e532..b587249 100644
--- a/chrome/browser/history/android/android_history_types.cc
+++ b/chrome/browser/history/android/android_history_types.cc
@@ -95,7 +95,7 @@ HistoryAndBookmarkRow::ColumnID HistoryAndBookmarkRow::GetColumnID(
SearchRow::SearchRow()
: id_(0),
- template_url_id_(0) {
+ keyword_id_(0) {
}
SearchRow::~SearchRow() {
diff --git a/chrome/browser/history/android/android_history_types.h b/chrome/browser/history/android/android_history_types.h
index 2f92316..a27b99e 100644
--- a/chrome/browser/history/android/android_history_types.h
+++ b/chrome/browser/history/android/android_history_types.h
@@ -9,7 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/history/history_types.h"
-#include "components/search_engines/template_url_id.h"
+#include "components/history/core/browser/keyword_id.h"
#include "sql/statement.h"
namespace sql {
@@ -199,7 +199,7 @@ class SearchRow {
SEARCH_TERM,
SEARCH_TIME,
URL,
- TEMPLATE_URL,
+ KEYWORD_ID,
COLUMN_END
};
@@ -243,12 +243,12 @@ class SearchRow {
url_ = url;
}
- TemplateURLID template_url_id() const {
- return template_url_id_;
+ KeywordID keyword_id() const {
+ return keyword_id_;
}
- void set_template_url_id(TemplateURLID template_url_id) {
- set_value_explicitly(SearchRow::TEMPLATE_URL);
- template_url_id_ = template_url_id;
+ void set_keyword_id(KeywordID keyword_id) {
+ set_value_explicitly(SearchRow::KEYWORD_ID);
+ keyword_id_ = keyword_id;
}
// Returns true if the given |id| has been set explicitly.
@@ -265,7 +265,7 @@ class SearchRow {
base::string16 search_term_;
base::Time search_time_;
GURL url_;
- TemplateURLID template_url_id_;
+ KeywordID keyword_id_;
// Used to find whether a column has been set a value.
std::set<ColumnID> values_set_;
diff --git a/chrome/browser/history/android/android_provider_backend.cc b/chrome/browser/history/android/android_provider_backend.cc
index fb1cb38..7f2e80a 100644
--- a/chrome/browser/history/android/android_provider_backend.cc
+++ b/chrome/browser/history/android/android_provider_backend.cc
@@ -1177,7 +1177,7 @@ void AndroidProviderBackend::BroadcastNotifications(
bool AndroidProviderBackend::AddSearchTerm(const SearchRow& values) {
DCHECK(values.is_value_set_explicitly(SearchRow::SEARCH_TERM));
- DCHECK(values.is_value_set_explicitly(SearchRow::TEMPLATE_URL));
+ DCHECK(values.is_value_set_explicitly(SearchRow::KEYWORD_ID));
DCHECK(values.is_value_set_explicitly(SearchRow::URL));
URLRow url_row;
@@ -1202,7 +1202,7 @@ bool AndroidProviderBackend::AddSearchTerm(const SearchRow& values) {
if (!history_db_->GetKeywordSearchTermRow(url_row.id(), NULL))
if (!history_db_->SetKeywordSearchTermsForURL(url_row.id(),
- values.template_url_id(), values.search_term()))
+ values.keyword_id(), values.search_term()))
return false;
} else {
bookmark_row.set_raw_url(values.url().spec());
@@ -1220,7 +1220,7 @@ bool AndroidProviderBackend::AddSearchTerm(const SearchRow& values) {
return false;
if (!history_db_->SetKeywordSearchTermsForURL(bookmark_row.url_id(),
- values.template_url_id(), values.search_term()))
+ values.keyword_id(), values.search_term()))
return false;
}
return true;
diff --git a/chrome/browser/history/android/android_provider_backend_unittest.cc b/chrome/browser/history/android/android_provider_backend_unittest.cc
index 05e39c9..daa72de 100644
--- a/chrome/browser/history/android/android_provider_backend_unittest.cc
+++ b/chrome/browser/history/android/android_provider_backend_unittest.cc
@@ -1379,7 +1379,7 @@ TEST_F(AndroidProviderBackendTest, UpdateSearchTerms) {
SearchRow search_row;
search_row.set_search_term(update_term);
search_row.set_url(GURL("http://google.com"));
- search_row.set_template_url_id(1);
+ search_row.set_keyword_id(1);
search_row.set_search_time(Time::Now() - TimeDelta::FromHours(1));
int update_count = 0;
ASSERT_TRUE(backend->UpdateSearchTerms(search_row, "search = ?", args,
@@ -1564,7 +1564,7 @@ TEST_F(AndroidProviderBackendTest, InsertSearchTerm) {
SearchRow search_row;
search_row.set_search_term(UTF8ToUTF16("google"));
search_row.set_url(GURL("http://google.com"));
- search_row.set_template_url_id(1);
+ search_row.set_keyword_id(1);
search_row.set_search_time(Time::Now() - TimeDelta::FromHours(1));
SearchTermID id = backend->InsertSearchTerm(search_row);
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc
index bc8a328..030446c 100644
--- a/chrome/browser/history/history_backend.cc
+++ b/chrome/browser/history/history_backend.cc
@@ -1044,7 +1044,7 @@ void HistoryBackend::QuerySegmentUsage(
// Keyword visits --------------------------------------------------------------
void HistoryBackend::SetKeywordSearchTermsForURL(const GURL& url,
- TemplateURLID keyword_id,
+ KeywordID keyword_id,
const base::string16& term) {
if (!db_)
return;
@@ -1066,8 +1066,7 @@ void HistoryBackend::SetKeywordSearchTermsForURL(const GURL& url,
ScheduleCommit();
}
-void HistoryBackend::DeleteAllSearchTermsForKeyword(
- TemplateURLID keyword_id) {
+void HistoryBackend::DeleteAllSearchTermsForKeyword(KeywordID keyword_id) {
if (!db_)
return;
@@ -1077,7 +1076,7 @@ void HistoryBackend::DeleteAllSearchTermsForKeyword(
void HistoryBackend::GetMostRecentKeywordSearchTerms(
scoped_refptr<GetMostRecentKeywordSearchTermsRequest> request,
- TemplateURLID keyword_id,
+ KeywordID keyword_id,
const base::string16& prefix,
int max_count) {
if (request->canceled())
@@ -1105,7 +1104,7 @@ void HistoryBackend::DeleteKeywordSearchTermForURL(const GURL& url) {
ScheduleCommit();
}
-void HistoryBackend::DeleteMatchingURLsForKeyword(TemplateURLID keyword_id,
+void HistoryBackend::DeleteMatchingURLsForKeyword(KeywordID keyword_id,
const base::string16& term) {
if (!db_)
return;
diff --git a/chrome/browser/history/history_backend.h b/chrome/browser/history/history_backend.h
index 82552eb..054fc20 100644
--- a/chrome/browser/history/history_backend.h
+++ b/chrome/browser/history/history_backend.h
@@ -21,7 +21,7 @@
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/history/thumbnail_database.h"
#include "chrome/browser/history/visit_tracker.h"
-#include "components/search_engines/template_url_id.h"
+#include "components/history/core/browser/keyword_id.h"
#include "sql/init_status.h"
class TestingProfile;
@@ -286,20 +286,20 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
// Keyword search terms ------------------------------------------------------
void SetKeywordSearchTermsForURL(const GURL& url,
- TemplateURLID keyword_id,
+ KeywordID keyword_id,
const base::string16& term);
- void DeleteAllSearchTermsForKeyword(TemplateURLID keyword_id);
+ void DeleteAllSearchTermsForKeyword(KeywordID keyword_id);
void GetMostRecentKeywordSearchTerms(
scoped_refptr<GetMostRecentKeywordSearchTermsRequest> request,
- TemplateURLID keyword_id,
+ KeywordID keyword_id,
const base::string16& prefix,
int max_count);
void DeleteKeywordSearchTermForURL(const GURL& url);
- void DeleteMatchingURLsForKeyword(TemplateURLID keyword_id,
+ void DeleteMatchingURLsForKeyword(KeywordID keyword_id,
const base::string16& term);
#if defined(OS_ANDROID)
diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc
index 64a2c63..387a2d0 100644
--- a/chrome/browser/history/history_backend_unittest.cc
+++ b/chrome/browser/history/history_backend_unittest.cc
@@ -520,7 +520,7 @@ class InMemoryHistoryBackendTest : public HistoryBackendTestBase {
void TestAddingAndChangingURLRows(int notification_type);
- static const TemplateURLID kTestKeywordId;
+ static const KeywordID kTestKeywordId;
static const char kTestSearchTerm1[];
static const char kTestSearchTerm2[];
@@ -528,7 +528,7 @@ class InMemoryHistoryBackendTest : public HistoryBackendTestBase {
DISALLOW_COPY_AND_ASSIGN(InMemoryHistoryBackendTest);
};
-const TemplateURLID InMemoryHistoryBackendTest::kTestKeywordId = 42;
+const KeywordID InMemoryHistoryBackendTest::kTestKeywordId = 42;
const char InMemoryHistoryBackendTest::kTestSearchTerm1[] = "banana";
const char InMemoryHistoryBackendTest::kTestSearchTerm2[] = "orange";
@@ -3037,7 +3037,7 @@ TEST_F(HistoryBackendTest, DeleteMatchingUrlsForKeyword) {
const URLID url1_id = backend_->db()->AddURL(url_info1);
EXPECT_NE(0, url1_id);
- TemplateURLID keyword_id = 1;
+ KeywordID keyword_id = 1;
base::string16 keyword = base::UTF8ToUTF16("bar");
ASSERT_TRUE(backend_->db()->SetKeywordSearchTermsForURL(
url1_id, keyword_id, keyword));
@@ -3051,7 +3051,7 @@ TEST_F(HistoryBackendTest, DeleteMatchingUrlsForKeyword) {
const URLID url2_id = backend_->db()->AddURL(url_info2);
EXPECT_NE(0, url2_id);
- TemplateURLID keyword_id2 = 2;
+ KeywordID keyword_id2 = 2;
ASSERT_TRUE(backend_->db()->SetKeywordSearchTermsForURL(
url2_id, keyword_id2, keyword));
@@ -3312,10 +3312,10 @@ TEST_F(InMemoryHistoryBackendTest, DeleteAllSearchTermsForKeyword) {
// Removing a keyword should cause all corresponding search terms to be
// deleted from the in-memory database (and also the main database).
- TemplateURLID id = kTestKeywordId;
+ KeywordID id = kTestKeywordId;
mem_backend_->Observe(chrome::NOTIFICATION_TEMPLATE_URL_REMOVED,
content::Source<HistoryBackendTestBase>(NULL),
- content::Details<TemplateURLID>(&id));
+ content::Details<KeywordID>(&id));
// The typed URL should remain intact.
// Note: we do not need to guarantee anything about the non-typed URL.
diff --git a/chrome/browser/history/history_notifications.cc b/chrome/browser/history/history_notifications.cc
index bd9e85f..86c859f 100644
--- a/chrome/browser/history/history_notifications.cc
+++ b/chrome/browser/history/history_notifications.cc
@@ -24,7 +24,7 @@ URLsDeletedDetails::~URLsDeletedDetails() {}
KeywordSearchUpdatedDetails::KeywordSearchUpdatedDetails(
const URLRow& url_row,
- TemplateURLID keyword_id,
+ KeywordID keyword_id,
const base::string16& term)
: url_row(url_row),
keyword_id(keyword_id),
diff --git a/chrome/browser/history/history_notifications.h b/chrome/browser/history/history_notifications.h
index 465b9b2..2eb4fa7 100644
--- a/chrome/browser/history/history_notifications.h
+++ b/chrome/browser/history/history_notifications.h
@@ -11,7 +11,7 @@
#include "chrome/browser/history/history_details.h"
#include "chrome/browser/history/history_types.h"
-#include "components/search_engines/template_url_id.h"
+#include "components/history/core/browser/keyword_id.h"
#include "url/gurl.h"
namespace history {
@@ -72,14 +72,14 @@ struct URLsDeletedDetails : public HistoryDetails {
// Details for HISTORY_KEYWORD_SEARCH_TERM_UPDATED.
struct KeywordSearchUpdatedDetails : public HistoryDetails {
KeywordSearchUpdatedDetails(const URLRow& url_row,
- TemplateURLID keyword_id,
+ KeywordID keyword_id,
const base::string16& term);
virtual ~KeywordSearchUpdatedDetails();
// The affected URLRow. The ID will be set to the value that is currently in
// effect in the main history database.
URLRow url_row;
- TemplateURLID keyword_id;
+ KeywordID keyword_id;
base::string16 term;
};
diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc
index 80803bb..6d2a3c4 100644
--- a/chrome/browser/history/history_service.cc
+++ b/chrome/browser/history/history_service.cc
@@ -64,6 +64,7 @@
using base::Time;
using history::HistoryBackend;
+using history::KeywordID;
namespace {
@@ -335,7 +336,7 @@ void HistoryService::Shutdown() {
}
void HistoryService::SetKeywordSearchTermsForURL(const GURL& url,
- TemplateURLID keyword_id,
+ KeywordID keyword_id,
const base::string16& term) {
DCHECK(thread_checker_.CalledOnValidThread());
ScheduleAndForget(PRIORITY_UI,
@@ -343,8 +344,7 @@ void HistoryService::SetKeywordSearchTermsForURL(const GURL& url,
url, keyword_id, term);
}
-void HistoryService::DeleteAllSearchTermsForKeyword(
- TemplateURLID keyword_id) {
+void HistoryService::DeleteAllSearchTermsForKeyword(KeywordID keyword_id) {
DCHECK(thread_checker_.CalledOnValidThread());
ScheduleAndForget(PRIORITY_UI,
&HistoryBackend::DeleteAllSearchTermsForKeyword,
@@ -352,7 +352,7 @@ void HistoryService::DeleteAllSearchTermsForKeyword(
}
HistoryService::Handle HistoryService::GetMostRecentKeywordSearchTerms(
- TemplateURLID keyword_id,
+ KeywordID keyword_id,
const base::string16& prefix,
int max_count,
CancelableRequestConsumerBase* consumer,
@@ -370,7 +370,7 @@ void HistoryService::DeleteKeywordSearchTermForURL(const GURL& url) {
url);
}
-void HistoryService::DeleteMatchingURLsForKeyword(TemplateURLID keyword_id,
+void HistoryService::DeleteMatchingURLsForKeyword(KeywordID keyword_id,
const base::string16& term) {
DCHECK(thread_checker_.CalledOnValidThread());
ScheduleAndForget(PRIORITY_UI, &HistoryBackend::DeleteMatchingURLsForKeyword,
@@ -887,7 +887,7 @@ void HistoryService::Observe(int type,
case chrome::NOTIFICATION_TEMPLATE_URL_REMOVED:
DeleteAllSearchTermsForKeyword(
- *(content::Details<TemplateURLID>(details).ptr()));
+ *(content::Details<KeywordID>(details).ptr()));
break;
default:
diff --git a/chrome/browser/history/history_service.h b/chrome/browser/history/history_service.h
index c986ce8..1bc53f4 100644
--- a/chrome/browser/history/history_service.h
+++ b/chrome/browser/history/history_service.h
@@ -28,8 +28,8 @@
#include "chrome/common/ref_counted_util.h"
#include "components/favicon_base/favicon_callback.h"
#include "components/history/core/browser/history_client.h"
+#include "components/history/core/browser/keyword_id.h"
#include "components/keyed_service/core/keyed_service.h"
-#include "components/search_engines/template_url_id.h"
#include "components/visitedlink/browser/visitedlink_delegate.h"
#include "content/public/browser/download_manager_delegate.h"
#include "content/public/browser/notification_observer.h"
@@ -466,11 +466,11 @@ class HistoryService : public CancelableRequestProvider,
// Sets the search terms for the specified url and keyword. url_id gives the
// id of the url, keyword_id the id of the keyword and term the search term.
void SetKeywordSearchTermsForURL(const GURL& url,
- TemplateURLID keyword_id,
+ history::KeywordID keyword_id,
const base::string16& term);
// Deletes all search terms for the specified keyword.
- void DeleteAllSearchTermsForKeyword(TemplateURLID keyword_id);
+ void DeleteAllSearchTermsForKeyword(history::KeywordID keyword_id);
typedef base::Callback<
void(Handle, std::vector<history::KeywordSearchTermVisit>*)>
@@ -481,7 +481,7 @@ class HistoryService : public CancelableRequestProvider,
// in descending order up to |max_count| with the most recent search term
// first.
Handle GetMostRecentKeywordSearchTerms(
- TemplateURLID keyword_id,
+ history::KeywordID keyword_id,
const base::string16& prefix,
int max_count,
CancelableRequestConsumerBase* consumer,
@@ -492,7 +492,7 @@ class HistoryService : public CancelableRequestProvider,
// Deletes all URL and search term entries matching the given |term| and
// |keyword_id|.
- void DeleteMatchingURLsForKeyword(TemplateURLID keyword_id,
+ void DeleteMatchingURLsForKeyword(history::KeywordID keyword_id,
const base::string16& term);
// Bookmarks -----------------------------------------------------------------
diff --git a/chrome/browser/history/history_types.h b/chrome/browser/history/history_types.h
index 2a392bc..8d5e8f6 100644
--- a/chrome/browser/history/history_types.h
+++ b/chrome/browser/history/history_types.h
@@ -19,9 +19,9 @@
#include "base/time/time.h"
#include "chrome/common/ref_counted_util.h"
#include "components/favicon_base/favicon_types.h"
+#include "components/history/core/browser/keyword_id.h"
#include "components/history/core/common/thumbnail_score.h"
#include "components/query_parser/snippet.h"
-#include "components/search_engines/template_url_id.h"
#include "content/public/common/page_transition_types.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/size.h"
@@ -501,9 +501,9 @@ struct KeywordSearchTermRow {
KeywordSearchTermRow();
~KeywordSearchTermRow();
- TemplateURLID keyword_id; // ID of the keyword.
- URLID url_id; // ID of the url.
- base::string16 term; // The search term that was used.
+ KeywordID keyword_id; // ID of the keyword.
+ URLID url_id; // ID of the url.
+ base::string16 term; // The search term that was used.
};
// MostVisitedURL --------------------------------------------------------------
diff --git a/chrome/browser/history/in_memory_history_backend.cc b/chrome/browser/history/in_memory_history_backend.cc
index 97d27df..dae504a 100644
--- a/chrome/browser/history/in_memory_history_backend.cc
+++ b/chrome/browser/history/in_memory_history_backend.cc
@@ -93,7 +93,7 @@ void InMemoryHistoryBackend::Observe(
// For simplicity, this will not remove the corresponding URLRows, but
// this is okay, as the main database does not do so either.
db_->DeleteAllSearchTermsForKeyword(
- *(content::Details<TemplateURLID>(details).ptr()));
+ *(content::Details<KeywordID>(details).ptr()));
break;
default:
// For simplicity, the unit tests send us all notifications, even when
diff --git a/chrome/browser/history/url_database.cc b/chrome/browser/history/url_database.cc
index 7be3787..f09e61b 100644
--- a/chrome/browser/history/url_database.cc
+++ b/chrome/browser/history/url_database.cc
@@ -434,7 +434,7 @@ bool URLDatabase::DropKeywordSearchTermsTable() {
}
bool URLDatabase::SetKeywordSearchTermsForURL(URLID url_id,
- TemplateURLID keyword_id,
+ KeywordID keyword_id,
const base::string16& term) {
DCHECK(url_id && keyword_id && !term.empty());
@@ -499,7 +499,7 @@ bool URLDatabase::GetKeywordSearchTermRows(
}
void URLDatabase::DeleteAllSearchTermsForKeyword(
- TemplateURLID keyword_id) {
+ KeywordID keyword_id) {
DCHECK(keyword_id);
sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
"DELETE FROM keyword_search_terms WHERE keyword_id=?"));
@@ -509,7 +509,7 @@ void URLDatabase::DeleteAllSearchTermsForKeyword(
}
void URLDatabase::GetMostRecentKeywordSearchTerms(
- TemplateURLID keyword_id,
+ KeywordID keyword_id,
const base::string16& prefix,
int max_count,
std::vector<KeywordSearchTermVisit>* matches) {
diff --git a/chrome/browser/history/url_database.h b/chrome/browser/history/url_database.h
index 06db0b0..ea04c2f 100644
--- a/chrome/browser/history/url_database.h
+++ b/chrome/browser/history/url_database.h
@@ -7,8 +7,8 @@
#include "base/basictypes.h"
#include "chrome/browser/history/history_types.h"
+#include "components/history/core/browser/keyword_id.h"
#include "components/query_parser/query_parser.h"
-#include "components/search_engines/template_url_id.h"
#include "sql/statement.h"
class GURL;
@@ -191,7 +191,7 @@ class URLDatabase {
// Sets the search terms for the specified url/keyword pair.
bool SetKeywordSearchTermsForURL(URLID url_id,
- TemplateURLID keyword_id,
+ KeywordID keyword_id,
const base::string16& term);
// Looks up a keyword search term given a url id. Returns all the search terms
@@ -205,12 +205,12 @@ class URLDatabase {
// Deletes all search terms for the specified keyword that have been added by
// way of SetKeywordSearchTermsForURL.
- void DeleteAllSearchTermsForKeyword(TemplateURLID keyword_id);
+ void DeleteAllSearchTermsForKeyword(KeywordID keyword_id);
// Returns up to max_count of the most recent search terms for the specified
// keyword.
void GetMostRecentKeywordSearchTerms(
- TemplateURLID keyword_id,
+ KeywordID keyword_id,
const base::string16& prefix,
int max_count,
std::vector<KeywordSearchTermVisit>* matches);
diff --git a/chrome/browser/history/url_database_unittest.cc b/chrome/browser/history/url_database_unittest.cc
index e52ed49..d3d9cdd 100644
--- a/chrome/browser/history/url_database_unittest.cc
+++ b/chrome/browser/history/url_database_unittest.cc
@@ -161,7 +161,7 @@ TEST_F(URLDatabaseTest, KeywordSearchTermVisit) {
ASSERT_NE(0, url_id);
// Add a keyword visit.
- TemplateURLID keyword_id = 100;
+ KeywordID keyword_id = 100;
base::string16 keyword = base::UTF8ToUTF16("visit");
ASSERT_TRUE(SetKeywordSearchTermsForURL(url_id, keyword_id, keyword));
@@ -261,7 +261,7 @@ TEST_F(URLDatabaseTest, GetAndDeleteKeywordSearchTermByTerm) {
ASSERT_NE(0, url_id1);
// Add a keyword visit.
- TemplateURLID keyword_id = 100;
+ KeywordID keyword_id = 100;
base::string16 keyword = base::UTF8ToUTF16("visit");
ASSERT_TRUE(SetKeywordSearchTermsForURL(url_id1, keyword_id, keyword));
diff --git a/components/history.gypi b/components/history.gypi
index 3c1d3a8..a0c4d83 100644
--- a/components/history.gypi
+++ b/components/history.gypi
@@ -18,6 +18,7 @@
'sources': [
'history/core/browser/history_client.h',
'history/core/browser/history_client.cc',
+ 'history/core/browser/keyword_id.h',
],
},
{
diff --git a/components/history/core/browser/keyword_id.h b/components/history/core/browser/keyword_id.h
new file mode 100644
index 0000000..9dda5e1
--- /dev/null
+++ b/components/history/core/browser/keyword_id.h
@@ -0,0 +1,18 @@
+// Copyright 2014 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.
+
+#ifndef COMPONENTS_HISTORY_CORE_BROWSER_KEYWORD_ID_H_
+#define COMPONENTS_HISTORY_CORE_BROWSER_KEYWORD_ID_H_
+
+#include "base/basictypes.h"
+
+namespace history {
+
+// ID of a keyword associated with a URL and a search term.
+// 0 is the invalid value.
+typedef int64 KeywordID;
+
+} // namespace history
+
+#endif // COMPONENTS_HISTORY_CORE_BROWSER_KEYWORD_ID_H_
diff --git a/components/search_engines/DEPS b/components/search_engines/DEPS
index 3a52994..6e779c9 100644
--- a/components/search_engines/DEPS
+++ b/components/search_engines/DEPS
@@ -1,3 +1,4 @@
include_rules = [
"+components/google/core",
+ "+components/history/core",
]
diff --git a/components/search_engines/template_url_id.h b/components/search_engines/template_url_id.h
index d16f5b8..f2737c2 100644
--- a/components/search_engines/template_url_id.h
+++ b/components/search_engines/template_url_id.h
@@ -5,9 +5,9 @@
#ifndef COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_ID_H_
#define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_ID_H_
-#include "base/basictypes.h"
+#include "components/history/core/browser/keyword_id.h"
-typedef int64 TemplateURLID;
+typedef history::KeywordID TemplateURLID;
const TemplateURLID kInvalidTemplateURLID = 0;