| 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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 | 422 |
| 423 content::WebContents* InstantController::GetPreviewContents() const { | 423 content::WebContents* InstantController::GetPreviewContents() const { |
| 424 return loader_ ? loader_->contents() : NULL; | 424 return loader_ ? loader_->contents() : NULL; |
| 425 } | 425 } |
| 426 | 426 |
| 427 bool InstantController::IsPreviewingSearchResults() const { | 427 bool InstantController::IsPreviewingSearchResults() const { |
| 428 return model_.mode().is_search_suggestions() && last_match_was_search_ && | 428 return model_.mode().is_search_suggestions() && last_match_was_search_ && |
| 429 IsFullHeight(model_); | 429 IsFullHeight(model_); |
| 430 } | 430 } |
| 431 | 431 |
| 432 bool InstantController::IsInstantExtendedSearch() const { |
| 433 return extended_enabled_ && instant_enabled_ && last_match_was_search_; |
| 434 } |
| 435 |
| 432 bool InstantController::CommitIfPossible(InstantCommitType type) { | 436 bool InstantController::CommitIfPossible(InstantCommitType type) { |
| 433 if (!extended_enabled_ && !instant_enabled_) | 437 if (!extended_enabled_ && !instant_enabled_) |
| 434 return false; | 438 return false; |
| 435 | 439 |
| 436 DVLOG(1) << "CommitIfPossible: type=" << type << " last_omnibox_text_='" | 440 DVLOG(1) << "CommitIfPossible: type=" << type << " last_omnibox_text_='" |
| 437 << last_omnibox_text_ << "' last_match_was_search_=" | 441 << last_omnibox_text_ << "' last_match_was_search_=" |
| 438 << last_match_was_search_ << " instant_tab_=" << instant_tab_; | 442 << last_match_was_search_ << " instant_tab_=" << instant_tab_; |
| 439 | 443 |
| 440 // If we are on an already committed search results page, send a submit event | 444 // If we are on an already committed search results page, send a submit event |
| 441 // to the page, but otherwise, nothing else to do. | 445 // to the page, but otherwise, nothing else to do. |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 } | 1092 } |
| 1089 | 1093 |
| 1090 std::map<std::string, int>::const_iterator iter = | 1094 std::map<std::string, int>::const_iterator iter = |
| 1091 blacklisted_urls_.find(*instant_url); | 1095 blacklisted_urls_.find(*instant_url); |
| 1092 if (iter != blacklisted_urls_.end() && | 1096 if (iter != blacklisted_urls_.end() && |
| 1093 iter->second > kMaxInstantSupportFailures) | 1097 iter->second > kMaxInstantSupportFailures) |
| 1094 return false; | 1098 return false; |
| 1095 | 1099 |
| 1096 return true; | 1100 return true; |
| 1097 } | 1101 } |
| OLD | NEW |