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_ || !overlay_) | |
David Black
2013/03/21 21:36:10
Either overlay_ or instant_tab_ might exist. Send
samarth
2013/03/21 21:39:59
Actually if the overlay exists, there's nothing to
robertshield
2013/03/22 03:12:55
Done.
robertshield
2013/03/22 03:12:55
Done.
| |
615 return; | |
616 | |
617 overlay_->Submit(user_text); | |
618 } | |
619 | |
613 content::WebContents* InstantController::GetOverlayContents() const { | 620 content::WebContents* InstantController::GetOverlayContents() const { |
614 return overlay_ ? overlay_->contents() : NULL; | 621 return overlay_ ? overlay_->contents() : NULL; |
615 } | 622 } |
616 | 623 |
617 bool InstantController::IsOverlayingSearchResults() const { | 624 bool InstantController::IsOverlayingSearchResults() const { |
618 return model_.mode().is_search_suggestions() && IsFullHeight(model_) && | 625 return model_.mode().is_search_suggestions() && IsFullHeight(model_) && |
619 (last_match_was_search_ || | 626 (last_match_was_search_ || |
620 last_suggestion_.behavior == INSTANT_COMPLETE_NEVER); | 627 last_suggestion_.behavior == INSTANT_COMPLETE_NEVER); |
621 } | 628 } |
622 | 629 |
(...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', | 1586 // 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 | 1587 // suggest 'nstant'. Otherwise, the user text really isn't a prefix, so |
1581 // suggest nothing. | 1588 // suggest nothing. |
1582 // TODO(samarth|jered): revisit this logic. http://crbug.com/196572. | 1589 // TODO(samarth|jered): revisit this logic. http://crbug.com/196572. |
1583 return true; | 1590 return true; |
1584 } | 1591 } |
1585 } | 1592 } |
1586 | 1593 |
1587 return false; | 1594 return false; |
1588 } | 1595 } |
OLD | NEW |