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 page that a navigation | |
712 // is about to take place. Note that only the user-entered content, not the | |
713 // full match should be sent down to avoid leaking autocompleted content. | |
714 InstantController* instant = controller_->GetInstant(); | |
715 if (instant) | |
716 instant->OnNavigate(autocomplete_controller_->input().text()); | |
sreeram
2013/03/26 17:43:46
Instant may be showing a search results preview, i
robertshield
2013/03/26 19:19:24
I noticed that I can also call this code only when
| |
717 | |
710 // This calls RevertAll again. | 718 // This calls RevertAll again. |
711 base::AutoReset<bool> tmp(&in_revert_, true); | 719 base::AutoReset<bool> tmp(&in_revert_, true); |
712 controller_->OnAutocompleteAccept(destination_url, disposition, | 720 controller_->OnAutocompleteAccept(destination_url, disposition, |
713 match.transition, alternate_nav_url); | 721 match.transition, alternate_nav_url); |
714 } | 722 } |
715 | 723 |
716 if (match.starred) | 724 if (match.starred) |
717 bookmark_utils::RecordBookmarkLaunch(bookmark_utils::LAUNCH_OMNIBOX); | 725 bookmark_utils::RecordBookmarkLaunch(bookmark_utils::LAUNCH_OMNIBOX); |
718 } | 726 } |
719 | 727 |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1379 instant->OmniboxFocusChanged(state, reason, NULL); | 1387 instant->OmniboxFocusChanged(state, reason, NULL); |
1380 | 1388 |
1381 // Update state and notify view if the omnibox has focus and the caret | 1389 // Update state and notify view if the omnibox has focus and the caret |
1382 // visibility changed. | 1390 // visibility changed. |
1383 const bool was_caret_visible = is_caret_visible(); | 1391 const bool was_caret_visible = is_caret_visible(); |
1384 focus_state_ = state; | 1392 focus_state_ = state; |
1385 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1393 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
1386 is_caret_visible() != was_caret_visible) | 1394 is_caret_visible() != was_caret_visible) |
1387 view_->ApplyCaretVisibility(); | 1395 view_->ApplyCaretVisibility(); |
1388 } | 1396 } |
OLD | NEW |