| 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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 } | 652 } |
| 653 | 653 |
| 654 void InstantController::ShowInstantPreview(InstantLoader* loader, | 654 void InstantController::ShowInstantPreview(InstantLoader* loader, |
| 655 InstantShownReason reason, | 655 InstantShownReason reason, |
| 656 int height, | 656 int height, |
| 657 InstantSizeUnits units) { | 657 InstantSizeUnits units) { |
| 658 if (loader_ == loader && extended_enabled_) | 658 if (loader_ == loader && extended_enabled_) |
| 659 Show(reason, height, units); | 659 Show(reason, height, units); |
| 660 } | 660 } |
| 661 | 661 |
| 662 void InstantController::StartCapturingKeyStrokes(InstantLoader* loader) { |
| 663 if (loader_ == loader && extended_enabled_ && model_.mode().is_ntp()) |
| 664 browser_->SetInvisibleFocus(); |
| 665 } |
| 666 |
| 662 void InstantController::InstantSupportDetermined(InstantLoader* loader, | 667 void InstantController::InstantSupportDetermined(InstantLoader* loader, |
| 663 bool supports_instant) { | 668 bool supports_instant) { |
| 664 if (supports_instant) { | 669 if (supports_instant) { |
| 665 blacklisted_urls_.erase(loader->instant_url()); | 670 blacklisted_urls_.erase(loader->instant_url()); |
| 666 } else { | 671 } else { |
| 667 ++blacklisted_urls_[loader->instant_url()]; | 672 ++blacklisted_urls_[loader->instant_url()]; |
| 668 if (loader_ == loader) | 673 if (loader_ == loader) |
| 669 DeleteLoader(); | 674 DeleteLoader(); |
| 670 } | 675 } |
| 671 | 676 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 } | 906 } |
| 902 | 907 |
| 903 std::map<std::string, int>::const_iterator iter = | 908 std::map<std::string, int>::const_iterator iter = |
| 904 blacklisted_urls_.find(*instant_url); | 909 blacklisted_urls_.find(*instant_url); |
| 905 if (iter != blacklisted_urls_.end() && | 910 if (iter != blacklisted_urls_.end() && |
| 906 iter->second > kMaxInstantSupportFailures) | 911 iter->second > kMaxInstantSupportFailures) |
| 907 return false; | 912 return false; |
| 908 | 913 |
| 909 return true; | 914 return true; |
| 910 } | 915 } |
| OLD | NEW |