| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 } | 894 } |
| 890 | 895 |
| 891 std::map<std::string, int>::const_iterator iter = | 896 std::map<std::string, int>::const_iterator iter = |
| 892 blacklisted_urls_.find(*instant_url); | 897 blacklisted_urls_.find(*instant_url); |
| 893 if (iter != blacklisted_urls_.end() && | 898 if (iter != blacklisted_urls_.end() && |
| 894 iter->second > kMaxInstantSupportFailures) | 899 iter->second > kMaxInstantSupportFailures) |
| 895 return false; | 900 return false; |
| 896 | 901 |
| 897 return true; | 902 return true; |
| 898 } | 903 } |
| OLD | NEW |