| 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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 last_omnibox_text_ = full_text; | 603 last_omnibox_text_ = full_text; |
| 604 last_user_text_ = user_text; | 604 last_user_text_ = user_text; |
| 605 last_suggestion_ = InstantSuggestion(); | 605 last_suggestion_ = InstantSuggestion(); |
| 606 | 606 |
| 607 if (instant_tab_) | 607 if (instant_tab_) |
| 608 instant_tab_->CancelSelection(full_text); | 608 instant_tab_->CancelSelection(full_text); |
| 609 else | 609 else |
| 610 overlay_->CancelSelection(full_text); | 610 overlay_->CancelSelection(full_text); |
| 611 } | 611 } |
| 612 | 612 |
| 613 void InstantController::OnNavigate(const string16& user_text) { |
| 614 if (!extended_enabled_) |
| 615 return; |
| 616 |
| 617 if (instant_tab_) |
| 618 instant_tab_->Submit(user_text); |
| 619 |
| 620 if (overlay_) |
| 621 overlay_->Submit(user_text); |
| 622 } |
| 623 |
| 613 content::WebContents* InstantController::GetOverlayContents() const { | 624 content::WebContents* InstantController::GetOverlayContents() const { |
| 614 return overlay_ ? overlay_->contents() : NULL; | 625 return overlay_ ? overlay_->contents() : NULL; |
| 615 } | 626 } |
| 616 | 627 |
| 617 bool InstantController::IsOverlayingSearchResults() const { | 628 bool InstantController::IsOverlayingSearchResults() const { |
| 618 return model_.mode().is_search_suggestions() && IsFullHeight(model_) && | 629 return model_.mode().is_search_suggestions() && IsFullHeight(model_) && |
| 619 (last_match_was_search_ || | 630 (last_match_was_search_ || |
| 620 last_suggestion_.behavior == INSTANT_COMPLETE_NEVER); | 631 last_suggestion_.behavior == INSTANT_COMPLETE_NEVER); |
| 621 } | 632 } |
| 622 | 633 |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 // for instance, if the user types 'i' and the suggestion is 'INSTANT', | 1590 // for instance, if the user types 'i' and the suggestion is 'INSTANT', |
| 1580 // suggest 'nstant'. Otherwise, the user text really isn't a prefix, so | 1591 // suggest 'nstant'. Otherwise, the user text really isn't a prefix, so |
| 1581 // suggest nothing. | 1592 // suggest nothing. |
| 1582 // TODO(samarth|jered): revisit this logic. http://crbug.com/196572. | 1593 // TODO(samarth|jered): revisit this logic. http://crbug.com/196572. |
| 1583 return true; | 1594 return true; |
| 1584 } | 1595 } |
| 1585 } | 1596 } |
| 1586 | 1597 |
| 1587 return false; | 1598 return false; |
| 1588 } | 1599 } |
| OLD | NEW |