| 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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 } | 660 } |
| 661 | 661 |
| 662 void InstantController::ShowInstantPreview(InstantLoader* loader, | 662 void InstantController::ShowInstantPreview(InstantLoader* loader, |
| 663 InstantShownReason reason, | 663 InstantShownReason reason, |
| 664 int height, | 664 int height, |
| 665 InstantSizeUnits units) { | 665 InstantSizeUnits units) { |
| 666 if (loader_ == loader && extended_enabled_) | 666 if (loader_ == loader && extended_enabled_) |
| 667 Show(reason, height, units); | 667 Show(reason, height, units); |
| 668 } | 668 } |
| 669 | 669 |
| 670 void InstantController::StartCapturingKeyStrokes(InstantLoader* loader) { |
| 671 if (loader_ == loader && extended_enabled_ && model_.mode().is_ntp()) |
| 672 browser_->SetInvisibleFocus(); |
| 673 } |
| 674 |
| 670 void InstantController::InstantSupportDetermined(InstantLoader* loader, | 675 void InstantController::InstantSupportDetermined(InstantLoader* loader, |
| 671 bool supports_instant) { | 676 bool supports_instant) { |
| 672 if (supports_instant) { | 677 if (supports_instant) { |
| 673 blacklisted_urls_.erase(loader->instant_url()); | 678 blacklisted_urls_.erase(loader->instant_url()); |
| 674 } else { | 679 } else { |
| 675 ++blacklisted_urls_[loader->instant_url()]; | 680 ++blacklisted_urls_[loader->instant_url()]; |
| 676 if (loader_ == loader) | 681 if (loader_ == loader) |
| 677 DeleteLoader(); | 682 DeleteLoader(); |
| 678 } | 683 } |
| 679 | 684 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 } | 917 } |
| 913 | 918 |
| 914 std::map<std::string, int>::const_iterator iter = | 919 std::map<std::string, int>::const_iterator iter = |
| 915 blacklisted_urls_.find(*instant_url); | 920 blacklisted_urls_.find(*instant_url); |
| 916 if (iter != blacklisted_urls_.end() && | 921 if (iter != blacklisted_urls_.end() && |
| 917 iter->second > kMaxInstantSupportFailures) | 922 iter->second > kMaxInstantSupportFailures) |
| 918 return false; | 923 return false; |
| 919 | 924 |
| 920 return true; | 925 return true; |
| 921 } | 926 } |
| OLD | NEW |