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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
803 void InstantController::InstantLoaderAboutToNavigateMainFrame(const GURL& url) { | 803 void InstantController::InstantLoaderAboutToNavigateMainFrame(const GURL& url) { |
804 GURL instant_url(loader_->instant_url()); | 804 GURL instant_url(loader_->instant_url()); |
805 | 805 |
806 // Don't commit if the URL being navigated to has the same host and path as | 806 // Don't commit if the URL being navigated to has the same host and path as |
807 // the instant URL. This enables the instant page to change the query | 807 // the instant URL. This enables the instant page to change the query |
808 // parameters and fragments of the URL without it navigating. | 808 // parameters and fragments of the URL without it navigating. |
809 if (url.host() != instant_url.host() || url.path() != instant_url.path()) | 809 if (url.host() != instant_url.host() || url.path() != instant_url.path()) |
810 CommitIfPossible(INSTANT_COMMIT_NAVIGATED); | 810 CommitIfPossible(INSTANT_COMMIT_NAVIGATED); |
811 } | 811 } |
812 | 812 |
813 void InstantController::NavigateToURL(const GURL& url) { | |
samarth
2012/12/12 16:32:27
Let's check for extended_enabled_ here to be safe.
Shishir
2012/12/12 20:04:47
Done.
| |
814 HideLoader(); | |
samarth
2012/12/12 16:32:27
If (loader_)
Shishir
2012/12/12 20:04:47
This can come from the instant_tab also. Also to r
samarth
2012/12/12 22:05:36
When it's coming from InstantTab, there's nothing
Shishir
2012/12/12 22:21:08
Done.
| |
815 browser_->OpenURLInCurrentTab(url); | |
816 } | |
817 | |
813 bool InstantController::ResetLoader(const TemplateURL* template_url, | 818 bool InstantController::ResetLoader(const TemplateURL* template_url, |
814 const content::WebContents* active_tab) { | 819 const content::WebContents* active_tab) { |
815 std::string instant_url; | 820 std::string instant_url; |
816 if (!GetInstantURL(template_url, &instant_url)) | 821 if (!GetInstantURL(template_url, &instant_url)) |
817 return false; | 822 return false; |
818 | 823 |
819 if (loader_ && loader_->instant_url() == instant_url) | 824 if (loader_ && loader_->instant_url() == instant_url) |
820 return true; | 825 return true; |
821 | 826 |
822 HideInternal(); | 827 HideInternal(); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1048 } | 1053 } |
1049 | 1054 |
1050 std::map<std::string, int>::const_iterator iter = | 1055 std::map<std::string, int>::const_iterator iter = |
1051 blacklisted_urls_.find(*instant_url); | 1056 blacklisted_urls_.find(*instant_url); |
1052 if (iter != blacklisted_urls_.end() && | 1057 if (iter != blacklisted_urls_.end() && |
1053 iter->second > kMaxInstantSupportFailures) | 1058 iter->second > kMaxInstantSupportFailures) |
1054 return false; | 1059 return false; |
1055 | 1060 |
1056 return true; | 1061 return true; |
1057 } | 1062 } |
OLD | NEW |