Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 862 | 862 |
| 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( |
| 873 const GURL& url, | |
| 874 bool is_server_redirect) { | |
| 873 GURL instant_url(loader_->instant_url()); | 875 GURL instant_url(loader_->instant_url()); |
| 874 | 876 |
| 877 // If the page does not yet support instant, we allow redirects to go through | |
| 878 // since the instant URL can redirect - e.g. to country specific pages. | |
| 879 if (!loader_->supports_instant() && is_server_redirect) | |
| 880 return; | |
|
sreeram
2013/01/08 00:50:03
Put this before the GURL declaration above, so we
Shishir
2013/01/08 01:01:12
Forgot that the instant page had to call show to s
| |
| 881 | |
| 875 // If we are navigating to the instant URL, do nothing. | 882 // If we are navigating to the instant URL, do nothing. |
| 876 if (url == instant_url) | 883 if (url == instant_url) |
| 877 return; | 884 return; |
| 878 | 885 |
| 879 // Commit the navigation if either: | 886 // Commit the navigation if either: |
| 880 // - The page is in NTP mode (so it could only navigate on a user click) or | 887 // - 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 | 888 // - 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 | 889 // different host or path than the instant URL. This enables the instant |
| 883 // page when it is showing search results to change the query parameters | 890 // page when it is showing search results to change the query parameters |
| 884 // and fragments of the URL without it navigating. | 891 // and fragments of the URL without it navigating. |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1199 } | 1206 } |
| 1200 | 1207 |
| 1201 std::map<std::string, int>::const_iterator iter = | 1208 std::map<std::string, int>::const_iterator iter = |
| 1202 blacklisted_urls_.find(*instant_url); | 1209 blacklisted_urls_.find(*instant_url); |
| 1203 if (iter != blacklisted_urls_.end() && | 1210 if (iter != blacklisted_urls_.end() && |
| 1204 iter->second > kMaxInstantSupportFailures) | 1211 iter->second > kMaxInstantSupportFailures) |
| 1205 return false; | 1212 return false; |
| 1206 | 1213 |
| 1207 return true; | 1214 return true; |
| 1208 } | 1215 } |
| OLD | NEW |