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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
785 | 785 |
786 void InstantController::InstantLoaderRenderViewGone() { | 786 void InstantController::InstantLoaderRenderViewGone() { |
787 ++blacklisted_urls_[loader_->instant_url()]; | 787 ++blacklisted_urls_[loader_->instant_url()]; |
788 HideInternal(); | 788 HideInternal(); |
789 delete loader_->ReleaseContents(); | 789 delete loader_->ReleaseContents(); |
790 // Delay deletion as we have gotten here from an InstantLoader method. | 790 // Delay deletion as we have gotten here from an InstantLoader method. |
791 MessageLoop::current()->DeleteSoon(FROM_HERE, loader_.release()); | 791 MessageLoop::current()->DeleteSoon(FROM_HERE, loader_.release()); |
792 CreateDefaultLoader(); | 792 CreateDefaultLoader(); |
793 } | 793 } |
794 | 794 |
795 void InstantController::NavigateToURL(const GURL& url) { | |
796 CommitIfPossible(INSTANT_COMMIT_REQUESTED_NAVIGATION); | |
samarth
2012/12/11 04:42:10
Do we want to commit here? If a URL suggestion wa
Shishir
2012/12/11 20:22:39
Like we discussed, we will keep the committing log
| |
797 browser_->OpenURLInCurrentTab(url); | |
798 } | |
799 | |
795 bool InstantController::ResetLoader(const TemplateURL* template_url, | 800 bool InstantController::ResetLoader(const TemplateURL* template_url, |
796 const content::WebContents* active_tab) { | 801 const content::WebContents* active_tab) { |
797 std::string instant_url; | 802 std::string instant_url; |
798 if (!GetInstantURL(template_url, &instant_url)) | 803 if (!GetInstantURL(template_url, &instant_url)) |
799 return false; | 804 return false; |
800 | 805 |
801 if (loader_ && loader_->instant_url() == instant_url) | 806 if (loader_ && loader_->instant_url() == instant_url) |
802 return true; | 807 return true; |
803 | 808 |
804 HideInternal(); | 809 HideInternal(); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1030 } | 1035 } |
1031 | 1036 |
1032 std::map<std::string, int>::const_iterator iter = | 1037 std::map<std::string, int>::const_iterator iter = |
1033 blacklisted_urls_.find(*instant_url); | 1038 blacklisted_urls_.find(*instant_url); |
1034 if (iter != blacklisted_urls_.end() && | 1039 if (iter != blacklisted_urls_.end() && |
1035 iter->second > kMaxInstantSupportFailures) | 1040 iter->second > kMaxInstantSupportFailures) |
1036 return false; | 1041 return false; |
1037 | 1042 |
1038 return true; | 1043 return true; |
1039 } | 1044 } |
OLD | NEW |