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

Unified Diff: chrome/browser/history/history_backend.cc

Issue 8286011: When users navigate to an intranet host that has not been previously typed, treat it as a typed n... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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
« no previous file with comments | « chrome/browser/autocomplete/history_url_provider.cc ('k') | chrome/browser/history/history_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 |
« no previous file with comments | « chrome/browser/autocomplete/history_url_provider.cc ('k') | chrome/browser/history/history_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698