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/omnibox/omnibox_edit_model.h" | 5 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
653 // all have IDs above the maximum, and will be automatically lumped | 653 // all have IDs above the maximum, and will be automatically lumped |
654 // together in an "overflow" bucket in the histogram. | 654 // together in an "overflow" bucket in the histogram. |
655 UMA_HISTOGRAM_ENUMERATION("Omnibox.SearchEngine", | 655 UMA_HISTOGRAM_ENUMERATION("Omnibox.SearchEngine", |
656 template_url->prepopulate_id(), | 656 template_url->prepopulate_id(), |
657 TemplateURLPrepopulateData::kMaxPrepopulatedEngineID); | 657 TemplateURLPrepopulateData::kMaxPrepopulatedEngineID); |
658 } | 658 } |
659 | 659 |
660 if (disposition != NEW_BACKGROUND_TAB) { | 660 if (disposition != NEW_BACKGROUND_TAB) { |
661 base::AutoReset<bool> tmp(&in_revert_, true); | 661 base::AutoReset<bool> tmp(&in_revert_, true); |
662 view_->RevertAll(); // Revert the box to its unedited state | 662 view_->RevertAll(); // Revert the box to its unedited state |
663 if (controller()->GetInstant() && | |
664 controller()->GetInstant()->IsInstantExtendedSearch()) { | |
665 // In the case of an instant-extended search, actually revert to | |
666 // |last_omnibox_text|, which is what the user is searching for. This | |
667 // avoids a flash of the previous query. | |
668 view_->OnTemporaryTextMaybeChanged( | |
669 controller()->GetInstant()->last_omnibox_text(), | |
670 true); | |
671 } | |
sreeram
2013/01/22 04:34:47
I see what you are trying to do here, but I'd like
| |
663 } | 672 } |
664 | 673 |
665 if (match.type == AutocompleteMatch::EXTENSION_APP) { | 674 if (match.type == AutocompleteMatch::EXTENSION_APP) { |
666 ExtensionAppProvider::LaunchAppFromOmnibox(match, profile_, disposition); | 675 ExtensionAppProvider::LaunchAppFromOmnibox(match, profile_, disposition); |
667 } else { | 676 } else { |
668 GURL destination_url(match.destination_url); | 677 GURL destination_url(match.destination_url); |
669 // Append the query formulation time (time from when the user first typed a | 678 // Append the query formulation time (time from when the user first typed a |
670 // character into the omnibox to when the user selected a query) to the AQS | 679 // character into the omnibox to when the user selected a query) to the AQS |
671 // parameter if other AQS parameters were already populated. | 680 // parameter if other AQS parameters were already populated. |
672 if (template_url && match.search_terms_args.get() && | 681 if (template_url && match.search_terms_args.get() && |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1344 instant->OmniboxFocusChanged(state, reason, NULL); | 1353 instant->OmniboxFocusChanged(state, reason, NULL); |
1345 | 1354 |
1346 // Update state and notify view if the omnibox has focus and the caret | 1355 // Update state and notify view if the omnibox has focus and the caret |
1347 // visibility changed. | 1356 // visibility changed. |
1348 const bool was_caret_visible = is_caret_visible(); | 1357 const bool was_caret_visible = is_caret_visible(); |
1349 focus_state_ = state; | 1358 focus_state_ = state; |
1350 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1359 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
1351 is_caret_visible() != was_caret_visible) | 1360 is_caret_visible() != was_caret_visible) |
1352 view_->ApplyCaretVisibility(); | 1361 view_->ApplyCaretVisibility(); |
1353 } | 1362 } |
OLD | NEW |