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