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 const content::WebContents* contents) { | |
747 // Ignore unless the loader is active and on the NTP. | |
748 if (extended_enabled_ && !instant_tab_ && loader_->contents() == contents && | |
sreeram
2012/12/04 21:54:58
You can drop the "loader_->contents() == contents"
samarth
2012/12/04 22:13:43
Done.
| |
749 model_.mode().is_ntp()) | |
750 browser_->FocusOmniboxInvisibly(); | |
751 } | |
752 | |
745 void InstantController::SwappedWebContents() { | 753 void InstantController::SwappedWebContents() { |
746 model_.SetPreviewContents(GetPreviewContents()); | 754 model_.SetPreviewContents(GetPreviewContents()); |
747 } | 755 } |
748 | 756 |
749 void InstantController::InstantLoaderContentsFocused() { | 757 void InstantController::InstantLoaderContentsFocused() { |
750 #if defined(USE_AURA) | 758 #if defined(USE_AURA) |
751 // On aura the omnibox only receives a focus lost if we initiate the focus | 759 // On aura the omnibox only receives a focus lost if we initiate the focus |
752 // change. This does that. | 760 // change. This does that. |
753 if (!model_.mode().is_default()) | 761 if (!model_.mode().is_default()) |
754 browser_->InstantPreviewFocused(); | 762 browser_->InstantPreviewFocused(); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
994 } | 1002 } |
995 | 1003 |
996 std::map<std::string, int>::const_iterator iter = | 1004 std::map<std::string, int>::const_iterator iter = |
997 blacklisted_urls_.find(*instant_url); | 1005 blacklisted_urls_.find(*instant_url); |
998 if (iter != blacklisted_urls_.end() && | 1006 if (iter != blacklisted_urls_.end() && |
999 iter->second > kMaxInstantSupportFailures) | 1007 iter->second > kMaxInstantSupportFailures) |
1000 return false; | 1008 return false; |
1001 | 1009 |
1002 return true; | 1010 return true; |
1003 } | 1011 } |
OLD | NEW |