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/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
718 // that we avoid PermanentURL() here because it's not guaranteed to give us | 718 // that we avoid PermanentURL() here because it's not guaranteed to give us |
719 // the actual underlying current URL, e.g. if we're on the NTP and the | 719 // the actual underlying current URL, e.g. if we're on the NTP and the |
720 // |permanent_text_| is empty. | 720 // |permanent_text_| is empty. |
721 autocomplete_controller_->StartZeroSuggest(web_contents->GetURL(), | 721 autocomplete_controller_->StartZeroSuggest(web_contents->GetURL(), |
722 user_text_); | 722 user_text_); |
723 } | 723 } |
724 | 724 |
725 NotifySearchTabHelper(); | 725 NotifySearchTabHelper(); |
726 } | 726 } |
727 | 727 |
728 void OmniboxEditModel::OnFocusVisibilityChange(bool is_focus_visible) { | |
729 is_focus_visible_ = is_focus_visible; | |
dhollowa
2012/11/20 23:50:17
Question: is there an invariant here that is_focus
samarth
2012/11/21 00:40:15
My preference was to completely decouple focus "vi
dhollowa
2012/11/21 00:55:19
That's fine if we can get away with it. Thanks fo
| |
730 // TODO(samarth): communicate this state to InstantController. | |
731 } | |
732 | |
728 void OmniboxEditModel::OnWillKillFocus(gfx::NativeView view_gaining_focus) { | 733 void OmniboxEditModel::OnWillKillFocus(gfx::NativeView view_gaining_focus) { |
729 SetInstantSuggestion(InstantSuggestion()); | 734 SetInstantSuggestion(InstantSuggestion()); |
730 | 735 |
731 if (InstantController* instant = controller_->GetInstant()) | 736 if (InstantController* instant = controller_->GetInstant()) |
732 instant->OmniboxLostFocus(view_gaining_focus); | 737 instant->OmniboxLostFocus(view_gaining_focus); |
733 | 738 |
734 // TODO(jered): Rip this out along with StartZeroSuggest. | 739 // TODO(jered): Rip this out along with StartZeroSuggest. |
735 autocomplete_controller_->StopZeroSuggest(); | 740 autocomplete_controller_->StopZeroSuggest(); |
736 NotifySearchTabHelper(); | 741 NotifySearchTabHelper(); |
737 } | 742 } |
738 | 743 |
739 void OmniboxEditModel::OnKillFocus() { | 744 void OmniboxEditModel::OnKillFocus() { |
740 has_focus_ = false; | 745 has_focus_ = false; |
746 is_focus_visible_ = false; | |
741 control_key_state_ = UP; | 747 control_key_state_ = UP; |
742 paste_state_ = NONE; | 748 paste_state_ = NONE; |
743 } | 749 } |
744 | 750 |
745 bool OmniboxEditModel::OnEscapeKeyPressed() { | 751 bool OmniboxEditModel::OnEscapeKeyPressed() { |
746 if (has_temporary_text_) { | 752 if (has_temporary_text_) { |
747 AutocompleteMatch match; | 753 AutocompleteMatch match; |
748 InfoForCurrentSelection(&match, NULL); | 754 InfoForCurrentSelection(&match, NULL); |
749 if (match.destination_url != original_url_) { | 755 if (match.destination_url != original_url_) { |
750 RevertTemporaryText(true); | 756 RevertTemporaryText(true); |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1264 } | 1270 } |
1265 | 1271 |
1266 void OmniboxEditModel::ClassifyStringForPasteAndGo( | 1272 void OmniboxEditModel::ClassifyStringForPasteAndGo( |
1267 const string16& text, | 1273 const string16& text, |
1268 AutocompleteMatch* match, | 1274 AutocompleteMatch* match, |
1269 GURL* alternate_nav_url) const { | 1275 GURL* alternate_nav_url) const { |
1270 DCHECK(match); | 1276 DCHECK(match); |
1271 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, | 1277 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, |
1272 string16(), false, false, match, alternate_nav_url); | 1278 string16(), false, false, match, alternate_nav_url); |
1273 } | 1279 } |
OLD | NEW |