diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-27 16:15:44 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-27 16:15:44 +0000 |
commit | 0bfc29a5e1dc622ef1ca3601296738112a9a9abf (patch) | |
tree | c2dc97f51a06d57db01cee5e1164cf0b81f9dc2a /chrome/browser/history/history_backend.cc | |
parent | 930709556e52f09d355aaf0c7b00e90d6042d4d9 (diff) | |
download | chromium_src-0bfc29a5e1dc622ef1ca3601296738112a9a9abf.zip chromium_src-0bfc29a5e1dc622ef1ca3601296738112a9a9abf.tar.gz chromium_src-0bfc29a5e1dc622ef1ca3601296738112a9a9abf.tar.bz2 |
Searching by keyword now generates a visit against the site with a
transition type of TAB_TO_SEARCH. This visit increments the typed
count and ensures if you use TAB_TO_SEARCH you still get autocompleted
to the site.
I'll add some tests for this, but want to make sure we're ok with it
before I do that.
BUG=3633
TEST=will be covered by unit tests.
Review URL: http://codereview.chromium.org/93087
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14609 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history/history_backend.cc')
-rw-r--r-- | chrome/browser/history/history_backend.cc | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index d045dc9..066a757 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc @@ -351,6 +351,10 @@ void HistoryBackend::AddPage(scoped_refptr<HistoryAddPageArgs> request) { if (request->time < first_recorded_time_) first_recorded_time_ = request->time; + PageTransition::Type transition = + PageTransition::StripQualifier(request->transition); + bool is_keyword_generated = (transition == PageTransition::KEYWORD_GENERATED); + if (request->redirects.size() <= 1) { // The single entry is both a chain start and end. PageTransition::Type t = request->transition | @@ -360,13 +364,15 @@ void HistoryBackend::AddPage(scoped_refptr<HistoryAddPageArgs> request) { last_ids = AddPageVisit(request->url, last_recorded_time_, last_ids.second, t); - // Update the segment for this visit. - UpdateSegments(request->url, from_visit_id, last_ids.second, t, - last_recorded_time_); + // Update the segment for this visit. KEYWORD_GENERATED visits should not + // result in changing most visited, so we don't update segments (most + // visited db). + if (!is_keyword_generated) { + UpdateSegments(request->url, from_visit_id, last_ids.second, t, + last_recorded_time_); + } } else { // Redirect case. Add the redirect chain. - PageTransition::Type transition = - PageTransition::StripQualifier(request->transition); PageTransition::Type redirect_info = PageTransition::CHAIN_START; @@ -445,10 +451,8 @@ void HistoryBackend::AddPage(scoped_refptr<HistoryAddPageArgs> request) { // TODO(evanm): Due to http://b/1194536 we lose the referrers of a subframe // navigation anyway, so last_visit_id is always zero for them. But adding // them here confuses main frame history, so we skip them for now. - PageTransition::Type transition = - PageTransition::StripQualifier(request->transition); if (transition != PageTransition::AUTO_SUBFRAME && - transition != PageTransition::MANUAL_SUBFRAME) { + transition != PageTransition::MANUAL_SUBFRAME && !is_keyword_generated) { tracker_.AddVisit(request->id_scope, request->page_id, request->url, last_ids.second); } @@ -586,8 +590,11 @@ std::pair<URLID, VisitID> HistoryBackend::AddPageVisit( // TODO(pkasting): http://b/1148304 We shouldn't be marking so many URLs as // typed, which would eliminate the need for this code. int typed_increment = 0; - if (PageTransition::StripQualifier(transition) == PageTransition::TYPED && - !PageTransition::IsRedirect(transition)) + PageTransition::Type transition_type = + PageTransition::StripQualifier(transition); + if ((transition_type == PageTransition::TYPED && + !PageTransition::IsRedirect(transition)) || + transition_type == PageTransition::KEYWORD_GENERATED) typed_increment = 1; // See if this URL is already in the DB. @@ -639,6 +646,7 @@ std::pair<URLID, VisitID> HistoryBackend::AddPageVisit( // Broadcast a notification of the visit. if (visit_id) { URLVisitedDetails* details = new URLVisitedDetails; + details->transition = transition; details->row = url_info; BroadcastNotifications(NotificationType::HISTORY_URL_VISITED, details); } |