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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 | 759 |
760 void InstantController::InstantLoaderContentsFocused() { | 760 void InstantController::InstantLoaderContentsFocused() { |
761 #if defined(USE_AURA) | 761 #if defined(USE_AURA) |
762 // On aura the omnibox only receives a focus lost if we initiate the focus | 762 // On aura the omnibox only receives a focus lost if we initiate the focus |
763 // change. This does that. | 763 // change. This does that. |
764 if (!model_.mode().is_default()) | 764 if (!model_.mode().is_default()) |
765 browser_->InstantPreviewFocused(); | 765 browser_->InstantPreviewFocused(); |
766 #endif | 766 #endif |
767 } | 767 } |
768 | 768 |
| 769 void InstantController::NavigateToURL(const GURL& url) { |
| 770 CommitIfCurrent(INSTANT_COMMIT_CLICKED_RESULT); |
| 771 browser_->OpenURLInCurrentTab(url); |
| 772 } |
| 773 |
769 bool InstantController::ResetLoader(const TemplateURL* template_url, | 774 bool InstantController::ResetLoader(const TemplateURL* template_url, |
770 const content::WebContents* active_tab) { | 775 const content::WebContents* active_tab) { |
771 std::string instant_url; | 776 std::string instant_url; |
772 if (!GetInstantURL(template_url, &instant_url)) | 777 if (!GetInstantURL(template_url, &instant_url)) |
773 return false; | 778 return false; |
774 | 779 |
775 if (loader_ && loader_->instant_url() == instant_url) | 780 if (loader_ && loader_->instant_url() == instant_url) |
776 return true; | 781 return true; |
777 | 782 |
778 HideInternal(); | 783 HideInternal(); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 } | 1010 } |
1006 | 1011 |
1007 std::map<std::string, int>::const_iterator iter = | 1012 std::map<std::string, int>::const_iterator iter = |
1008 blacklisted_urls_.find(*instant_url); | 1013 blacklisted_urls_.find(*instant_url); |
1009 if (iter != blacklisted_urls_.end() && | 1014 if (iter != blacklisted_urls_.end() && |
1010 iter->second > kMaxInstantSupportFailures) | 1015 iter->second > kMaxInstantSupportFailures) |
1011 return false; | 1016 return false; |
1012 | 1017 |
1013 return true; | 1018 return true; |
1014 } | 1019 } |
OLD | NEW |