| 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/ui/search/instant_controller.h" | 5 #include "chrome/browser/ui/search/instant_controller.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 // because the caret is at the end of |user_text|, not |full_text|. | 630 // because the caret is at the end of |user_text|, not |full_text|. |
| 631 if (UseInstantTabToShowSuggestions()) { | 631 if (UseInstantTabToShowSuggestions()) { |
| 632 instant_tab_->CancelSelection(user_text, full_text.size(), user_text.size(), | 632 instant_tab_->CancelSelection(user_text, full_text.size(), user_text.size(), |
| 633 last_verbatim_); | 633 last_verbatim_); |
| 634 } else { | 634 } else { |
| 635 overlay_->CancelSelection(user_text, full_text.size(), user_text.size(), | 635 overlay_->CancelSelection(user_text, full_text.size(), user_text.size(), |
| 636 last_verbatim_); | 636 last_verbatim_); |
| 637 } | 637 } |
| 638 } | 638 } |
| 639 | 639 |
| 640 void InstantController::OmniboxNavigateToURL() { |
| 641 if (!extended_enabled_) |
| 642 return; |
| 643 |
| 644 if (instant_tab_) |
| 645 instant_tab_->Submit(string16()); |
| 646 } |
| 647 |
| 640 content::WebContents* InstantController::GetOverlayContents() const { | 648 content::WebContents* InstantController::GetOverlayContents() const { |
| 641 return overlay_ ? overlay_->contents() : NULL; | 649 return overlay_ ? overlay_->contents() : NULL; |
| 642 } | 650 } |
| 643 | 651 |
| 644 bool InstantController::IsOverlayingSearchResults() const { | 652 bool InstantController::IsOverlayingSearchResults() const { |
| 645 return model_.mode().is_search_suggestions() && IsFullHeight(model_) && | 653 return model_.mode().is_search_suggestions() && IsFullHeight(model_) && |
| 646 (last_match_was_search_ || | 654 (last_match_was_search_ || |
| 647 last_suggestion_.behavior == INSTANT_COMPLETE_NEVER); | 655 last_suggestion_.behavior == INSTANT_COMPLETE_NEVER); |
| 648 } | 656 } |
| 649 | 657 |
| (...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 | 1632 |
| 1625 // If this is not window startup, switch. | 1633 // If this is not window startup, switch. |
| 1626 // TODO(shishir): This is not completely reliable. Find a better way to detect | 1634 // TODO(shishir): This is not completely reliable. Find a better way to detect |
| 1627 // startup time. | 1635 // startup time. |
| 1628 if (browser_->GetActiveWebContents()) | 1636 if (browser_->GetActiveWebContents()) |
| 1629 return true; | 1637 return true; |
| 1630 | 1638 |
| 1631 return chrome::IsAggressiveLocalNTPFallbackEnabled(); | 1639 return chrome::IsAggressiveLocalNTPFallbackEnabled(); |
| 1632 } | 1640 } |
| 1633 | 1641 |
| OLD | NEW |