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

Side by Side Diff: chrome/browser/instant/instant_controller.cc

Issue 11785025: Do not commit InstantLoader server redirects till the page supports instant. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Not committing on any load before InstantSupportDetermined. Created 7 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/instant/instant_controller.h" 5 #include "chrome/browser/instant/instant_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 void InstantController::InstantLoaderRenderViewGone() { 863 void InstantController::InstantLoaderRenderViewGone() {
864 ++blacklisted_urls_[loader_->instant_url()]; 864 ++blacklisted_urls_[loader_->instant_url()];
865 HideInternal(); 865 HideInternal();
866 delete loader_->ReleaseContents(); 866 delete loader_->ReleaseContents();
867 // Delay deletion as we have gotten here from an InstantLoader method. 867 // Delay deletion as we have gotten here from an InstantLoader method.
868 MessageLoop::current()->DeleteSoon(FROM_HERE, loader_.release()); 868 MessageLoop::current()->DeleteSoon(FROM_HERE, loader_.release());
869 CreateDefaultLoader(); 869 CreateDefaultLoader();
870 } 870 }
871 871
872 void InstantController::InstantLoaderAboutToNavigateMainFrame(const GURL& url) { 872 void InstantController::InstantLoaderAboutToNavigateMainFrame(const GURL& url) {
873 // If the page does not yet support instant, we allow redirects and other
874 // navigations to go through since the instant URL can redirect - e.g. to
875 // country specific pages.
876 if (!loader_->supports_instant())
877 return;
878
873 GURL instant_url(loader_->instant_url()); 879 GURL instant_url(loader_->instant_url());
874 880
875 // If we are navigating to the instant URL, do nothing. 881 // If we are navigating to the instant URL, do nothing.
876 if (url == instant_url) 882 if (url == instant_url)
877 return; 883 return;
878 884
879 // Commit the navigation if either: 885 // Commit the navigation if either:
880 // - The page is in NTP mode (so it could only navigate on a user click) or 886 // - The page is in NTP mode (so it could only navigate on a user click) or
881 // - The page is not in NTP mode and we are navigating to a URL with a 887 // - The page is not in NTP mode and we are navigating to a URL with a
882 // different host or path than the instant URL. This enables the instant 888 // different host or path than the instant URL. This enables the instant
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 } 1205 }
1200 1206
1201 std::map<std::string, int>::const_iterator iter = 1207 std::map<std::string, int>::const_iterator iter =
1202 blacklisted_urls_.find(*instant_url); 1208 blacklisted_urls_.find(*instant_url);
1203 if (iter != blacklisted_urls_.end() && 1209 if (iter != blacklisted_urls_.end() &&
1204 iter->second > kMaxInstantSupportFailures) 1210 iter->second > kMaxInstantSupportFailures)
1205 return false; 1211 return false;
1206 1212
1207 return true; 1213 return true;
1208 } 1214 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698