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. Note that only the user- | |
714 // entered content, not the full match should be sent down to avoid leaking | |
715 // autocompleted content. | |
716 if (match.transition == content::PAGE_TRANSITION_TYPED) { | |
sreeram
2013/03/26 20:05:42
Surprisingly, this works. :)
I thought perhaps it
robertshield
2013/03/27 21:44:05
Afaict, this is true. I cannot find any code path
Peter Kasting
2013/03/27 21:51:47
TYPED always indicates a URL, but not all URLs are
| |
717 InstantController* instant = controller_->GetInstant(); | |
718 if (instant) | |
719 instant->OnNavigateToURL(autocomplete_controller_->input().text()); | |
sreeram
2013/03/26 20:05:42
Why do we need to send any text down to the page a
robertshield
2013/03/27 21:44:05
Ok, removed the text and now send down the empty s
| |
720 } | |
721 | |
710 // This calls RevertAll again. | 722 // This calls RevertAll again. |
711 base::AutoReset<bool> tmp(&in_revert_, true); | 723 base::AutoReset<bool> tmp(&in_revert_, true); |
712 controller_->OnAutocompleteAccept(destination_url, disposition, | 724 controller_->OnAutocompleteAccept(destination_url, disposition, |
713 match.transition, alternate_nav_url); | 725 match.transition, alternate_nav_url); |
714 } | 726 } |
715 | 727 |
716 if (match.starred) | 728 if (match.starred) |
717 bookmark_utils::RecordBookmarkLaunch(bookmark_utils::LAUNCH_OMNIBOX); | 729 bookmark_utils::RecordBookmarkLaunch(bookmark_utils::LAUNCH_OMNIBOX); |
718 } | 730 } |
719 | 731 |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1379 instant->OmniboxFocusChanged(state, reason, NULL); | 1391 instant->OmniboxFocusChanged(state, reason, NULL); |
1380 | 1392 |
1381 // Update state and notify view if the omnibox has focus and the caret | 1393 // Update state and notify view if the omnibox has focus and the caret |
1382 // visibility changed. | 1394 // visibility changed. |
1383 const bool was_caret_visible = is_caret_visible(); | 1395 const bool was_caret_visible = is_caret_visible(); |
1384 focus_state_ = state; | 1396 focus_state_ = state; |
1385 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1397 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
1386 is_caret_visible() != was_caret_visible) | 1398 is_caret_visible() != was_caret_visible) |
1387 view_->ApplyCaretVisibility(); | 1399 view_->ApplyCaretVisibility(); |
1388 } | 1400 } |
OLD | NEW |