Index: chrome/browser/history/history_backend.cc |
=================================================================== |
--- chrome/browser/history/history_backend.cc (revision 105368) |
+++ chrome/browser/history/history_backend.cc (working copy) |
@@ -92,7 +92,7 @@ |
// Converts from PageUsageData to MostVisitedURL. |redirects| is a |
// list of redirects for this URL. Empty list means no redirects. |
MostVisitedURL MakeMostVisitedURL(const PageUsageData& page_data, |
- const RedirectList& redirects) { |
+ const RedirectList& redirects) { |
MostVisitedURL mv; |
mv.url = page_data.GetURL(); |
mv.title = page_data.GetTitle(); |
@@ -406,7 +406,26 @@ |
bool is_keyword_generated = |
(transition == content::PAGE_TRANSITION_KEYWORD_GENERATED); |
- if (request->redirects.size() <= 1) { |
+ // If the user is navigating to a not-previously-typed intranet hostname, |
+ // change the transition to TYPED so that the omnibox will learn that this is |
+ // a known host. |
+ bool has_redirects = request->redirects.size() > 1; |
+ if (content::PageTransitionIsMainFrame(request->transition) && |
+ (transition != content::PAGE_TRANSITION_TYPED) && !is_keyword_generated) { |
+ const GURL& origin_url(has_redirects ? |
+ request->redirects[0] : request->url); |
+ if (origin_url.SchemeIs(chrome::kHttpScheme)) { |
+ std::string host(origin_url.host()); |
+ if ((net::RegistryControlledDomainService::GetRegistryLength( |
+ host, false) == 0) && !db_->IsTypedHost(host)) { |
+ transition = content::PAGE_TRANSITION_TYPED; |
+ request->transition = content::PageTransitionFromInt(transition | |
+ content::PageTransitionGetQualifier(request->transition)); |
+ } |
+ } |
+ } |
+ |
+ if (!has_redirects) { |
// The single entry is both a chain start and end. |
content::PageTransition t = content::PageTransitionFromInt( |
request->transition | |