| 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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 view_->RevertAll(); // Revert the box to its unedited state | 706 view_->RevertAll(); // Revert the box to its unedited state |
| 707 } | 707 } |
| 708 | 708 |
| 709 if (match.type == AutocompleteMatch::EXTENSION_APP) { | 709 if (match.type == AutocompleteMatch::EXTENSION_APP) { |
| 710 ExtensionAppProvider::LaunchAppFromOmnibox(match, profile_, disposition); | 710 ExtensionAppProvider::LaunchAppFromOmnibox(match, profile_, disposition); |
| 711 } else { | 711 } else { |
| 712 base::TimeDelta query_formulation_time = | 712 base::TimeDelta query_formulation_time = |
| 713 base::TimeTicks::Now() - time_user_first_modified_omnibox_; | 713 base::TimeTicks::Now() - time_user_first_modified_omnibox_; |
| 714 const GURL destination_url = autocomplete_controller_-> | 714 const GURL destination_url = autocomplete_controller_-> |
| 715 GetDestinationURL(match, query_formulation_time); | 715 GetDestinationURL(match, query_formulation_time); |
| 716 |
| 717 // If running with instant, notify the instant controller that a navigation |
| 718 // is about to take place if we are navigating to a URL. This can be |
| 719 // determined by inspecting the transition type. To ensure that this is only |
| 720 // done on Enter key press, check that the disposition is CURRENT_TAB. This |
| 721 // is the same heuristic used by BrowserInstantController::OpenInstant |
| 722 if (match.transition == content::PAGE_TRANSITION_TYPED && |
| 723 disposition == CURRENT_TAB) { |
| 724 InstantController* instant = controller_->GetInstant(); |
| 725 if (instant) |
| 726 instant->OmniboxNavigateToURL(); |
| 727 } |
| 728 |
| 716 // This calls RevertAll again. | 729 // This calls RevertAll again. |
| 717 base::AutoReset<bool> tmp(&in_revert_, true); | 730 base::AutoReset<bool> tmp(&in_revert_, true); |
| 718 controller_->OnAutocompleteAccept(destination_url, disposition, | 731 controller_->OnAutocompleteAccept(destination_url, disposition, |
| 719 match.transition, alternate_nav_url); | 732 match.transition, alternate_nav_url); |
| 720 } | 733 } |
| 721 | 734 |
| 722 if (match.starred) | 735 if (match.starred) |
| 723 bookmark_utils::RecordBookmarkLaunch(bookmark_utils::LAUNCH_OMNIBOX); | 736 bookmark_utils::RecordBookmarkLaunch(bookmark_utils::LAUNCH_OMNIBOX); |
| 724 } | 737 } |
| 725 | 738 |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 instant->OmniboxFocusChanged(state, reason, NULL); | 1398 instant->OmniboxFocusChanged(state, reason, NULL); |
| 1386 | 1399 |
| 1387 // Update state and notify view if the omnibox has focus and the caret | 1400 // Update state and notify view if the omnibox has focus and the caret |
| 1388 // visibility changed. | 1401 // visibility changed. |
| 1389 const bool was_caret_visible = is_caret_visible(); | 1402 const bool was_caret_visible = is_caret_visible(); |
| 1390 focus_state_ = state; | 1403 focus_state_ = state; |
| 1391 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1404 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
| 1392 is_caret_visible() != was_caret_visible) | 1405 is_caret_visible() != was_caret_visible) |
| 1393 view_->ApplyCaretVisibility(); | 1406 view_->ApplyCaretVisibility(); |
| 1394 } | 1407 } |
| OLD | NEW |