| 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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 // all have IDs above the maximum, and will be automatically lumped | 648 // all have IDs above the maximum, and will be automatically lumped |
| 649 // together in an "overflow" bucket in the histogram. | 649 // together in an "overflow" bucket in the histogram. |
| 650 UMA_HISTOGRAM_ENUMERATION("Omnibox.SearchEngine", | 650 UMA_HISTOGRAM_ENUMERATION("Omnibox.SearchEngine", |
| 651 template_url->prepopulate_id(), | 651 template_url->prepopulate_id(), |
| 652 TemplateURLPrepopulateData::kMaxPrepopulatedEngineID); | 652 TemplateURLPrepopulateData::kMaxPrepopulatedEngineID); |
| 653 } | 653 } |
| 654 | 654 |
| 655 if (disposition != NEW_BACKGROUND_TAB) { | 655 if (disposition != NEW_BACKGROUND_TAB) { |
| 656 base::AutoReset<bool> tmp(&in_revert_, true); | 656 base::AutoReset<bool> tmp(&in_revert_, true); |
| 657 view_->RevertAll(); // Revert the box to its unedited state | 657 view_->RevertAll(); // Revert the box to its unedited state |
| 658 if (controller()->GetInstant() && |
| 659 controller()->GetInstant()->IsInstantExtendedSearch()) { |
| 660 // In the case of an instant-extended search, actually revert to |
| 661 // |last_omnibox_text|, which is what the user is searching for. This |
| 662 // avoids a flash of the previous query. |
| 663 view_->OnTemporaryTextMaybeChanged( |
| 664 controller()->GetInstant()->last_omnibox_text(), |
| 665 true); |
| 666 } |
| 658 } | 667 } |
| 659 | 668 |
| 660 if (match.type == AutocompleteMatch::EXTENSION_APP) { | 669 if (match.type == AutocompleteMatch::EXTENSION_APP) { |
| 661 ExtensionAppProvider::LaunchAppFromOmnibox(match, profile_, disposition); | 670 ExtensionAppProvider::LaunchAppFromOmnibox(match, profile_, disposition); |
| 662 } else { | 671 } else { |
| 663 GURL destination_url(match.destination_url); | 672 GURL destination_url(match.destination_url); |
| 664 // Append the query formulation time (time from when the user first typed a | 673 // Append the query formulation time (time from when the user first typed a |
| 665 // character into the omnibox to when the user selected a query) to the AQS | 674 // character into the omnibox to when the user selected a query) to the AQS |
| 666 // parameter if other AQS parameters were already populated. | 675 // parameter if other AQS parameters were already populated. |
| 667 if (template_url && match.search_terms_args.get() && | 676 if (template_url && match.search_terms_args.get() && |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1339 instant->OmniboxFocusChanged(state, reason, NULL); | 1348 instant->OmniboxFocusChanged(state, reason, NULL); |
| 1340 | 1349 |
| 1341 // Update state and notify view if the omnibox has focus and the caret | 1350 // Update state and notify view if the omnibox has focus and the caret |
| 1342 // visibility changed. | 1351 // visibility changed. |
| 1343 const bool was_caret_visible = is_caret_visible(); | 1352 const bool was_caret_visible = is_caret_visible(); |
| 1344 focus_state_ = state; | 1353 focus_state_ = state; |
| 1345 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1354 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
| 1346 is_caret_visible() != was_caret_visible) | 1355 is_caret_visible() != was_caret_visible) |
| 1347 view_->ApplyCaretVisibility(); | 1356 view_->ApplyCaretVisibility(); |
| 1348 } | 1357 } |
| OLD | NEW |