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 (for some value | |
714 // of ensure) that this is only done on Enter key press, check that the | |
715 // disposition is CURRENT_TAB. This is the same heuristic used by | |
716 // BrowserInstantController::OpenInstant | |
sreeram
2013/04/01 16:22:01
You can remove the cagey wording here. I believe c
robertshield
2013/04/01 18:14:49
Done.
| |
717 if (match.transition == content::PAGE_TRANSITION_TYPED && | |
718 disposition == CURRENT_TAB) { | |
719 InstantController* instant = controller_->GetInstant(); | |
720 if (instant) | |
721 instant->OnNavigateToURL(); | |
722 } | |
723 | |
710 // This calls RevertAll again. | 724 // This calls RevertAll again. |
711 base::AutoReset<bool> tmp(&in_revert_, true); | 725 base::AutoReset<bool> tmp(&in_revert_, true); |
712 controller_->OnAutocompleteAccept(destination_url, disposition, | 726 controller_->OnAutocompleteAccept(destination_url, disposition, |
713 match.transition, alternate_nav_url); | 727 match.transition, alternate_nav_url); |
714 } | 728 } |
715 | 729 |
716 if (match.starred) | 730 if (match.starred) |
717 bookmark_utils::RecordBookmarkLaunch(bookmark_utils::LAUNCH_OMNIBOX); | 731 bookmark_utils::RecordBookmarkLaunch(bookmark_utils::LAUNCH_OMNIBOX); |
718 } | 732 } |
719 | 733 |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1379 instant->OmniboxFocusChanged(state, reason, NULL); | 1393 instant->OmniboxFocusChanged(state, reason, NULL); |
1380 | 1394 |
1381 // Update state and notify view if the omnibox has focus and the caret | 1395 // Update state and notify view if the omnibox has focus and the caret |
1382 // visibility changed. | 1396 // visibility changed. |
1383 const bool was_caret_visible = is_caret_visible(); | 1397 const bool was_caret_visible = is_caret_visible(); |
1384 focus_state_ = state; | 1398 focus_state_ = state; |
1385 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1399 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
1386 is_caret_visible() != was_caret_visible) | 1400 is_caret_visible() != was_caret_visible) |
1387 view_->ApplyCaretVisibility(); | 1401 view_->ApplyCaretVisibility(); |
1388 } | 1402 } |
OLD | NEW |