| 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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 } | 735 } |
| 736 } | 736 } |
| 737 | 737 |
| 738 void InstantController::ShowInstantPreview(InstantShownReason reason, | 738 void InstantController::ShowInstantPreview(InstantShownReason reason, |
| 739 int height, | 739 int height, |
| 740 InstantSizeUnits units) { | 740 InstantSizeUnits units) { |
| 741 if (extended_enabled_) | 741 if (extended_enabled_) |
| 742 ShowLoader(reason, height, units); | 742 ShowLoader(reason, height, units); |
| 743 } | 743 } |
| 744 | 744 |
| 745 void InstantController::StartCapturingKeyStrokes() { |
| 746 // Ignore unless the loader is active and on the NTP. |
| 747 if (extended_enabled_ && !instant_tab_ && model_.mode().is_ntp()) |
| 748 browser_->FocusOmniboxInvisibly(); |
| 749 } |
| 750 |
| 745 void InstantController::SwappedWebContents() { | 751 void InstantController::SwappedWebContents() { |
| 746 model_.SetPreviewContents(GetPreviewContents()); | 752 model_.SetPreviewContents(GetPreviewContents()); |
| 747 } | 753 } |
| 748 | 754 |
| 749 void InstantController::InstantLoaderContentsFocused() { | 755 void InstantController::InstantLoaderContentsFocused() { |
| 750 #if defined(USE_AURA) | 756 #if defined(USE_AURA) |
| 751 // On aura the omnibox only receives a focus lost if we initiate the focus | 757 // On aura the omnibox only receives a focus lost if we initiate the focus |
| 752 // change. This does that. | 758 // change. This does that. |
| 753 if (!model_.mode().is_default()) | 759 if (!model_.mode().is_default()) |
| 754 browser_->InstantPreviewFocused(); | 760 browser_->InstantPreviewFocused(); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 } | 1000 } |
| 995 | 1001 |
| 996 std::map<std::string, int>::const_iterator iter = | 1002 std::map<std::string, int>::const_iterator iter = |
| 997 blacklisted_urls_.find(*instant_url); | 1003 blacklisted_urls_.find(*instant_url); |
| 998 if (iter != blacklisted_urls_.end() && | 1004 if (iter != blacklisted_urls_.end() && |
| 999 iter->second > kMaxInstantSupportFailures) | 1005 iter->second > kMaxInstantSupportFailures) |
| 1000 return false; | 1006 return false; |
| 1001 | 1007 |
| 1002 return true; | 1008 return true; |
| 1003 } | 1009 } |
| OLD | NEW |