OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/autocomplete/autocomplete_edit.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // NOTE: Be sure and set keyword-related state BEFORE invoking | 122 // NOTE: Be sure and set keyword-related state BEFORE invoking |
123 // DisplayTextFromUserText(), as its result depends upon this state. | 123 // DisplayTextFromUserText(), as its result depends upon this state. |
124 keyword_ = state.keyword; | 124 keyword_ = state.keyword; |
125 is_keyword_hint_ = state.is_keyword_hint; | 125 is_keyword_hint_ = state.is_keyword_hint; |
126 keyword_ui_state_ = state.keyword_ui_state; | 126 keyword_ui_state_ = state.keyword_ui_state; |
127 view_->SetUserText(state.user_text, | 127 view_->SetUserText(state.user_text, |
128 DisplayTextFromUserText(state.user_text), false); | 128 DisplayTextFromUserText(state.user_text), false); |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 GURL AutocompleteEditModel::CurrentURL(PageTransition::Type* transition_type) { | 132 AutocompleteMatch AutocompleteEditModel::CurrentMatch() { |
133 AutocompleteMatch match; | 133 AutocompleteMatch match; |
134 GetInfoForCurrentText(&match, NULL); | 134 GetInfoForCurrentText(&match, NULL); |
135 *transition_type = match.transition; | 135 return match; |
136 return match.destination_url; | |
137 } | 136 } |
138 | 137 |
139 bool AutocompleteEditModel::UpdatePermanentText( | 138 bool AutocompleteEditModel::UpdatePermanentText( |
140 const std::wstring& new_permanent_text) { | 139 const std::wstring& new_permanent_text) { |
141 // When there's a new URL, and the user is not editing anything or the edit | 140 // When there's a new URL, and the user is not editing anything or the edit |
142 // doesn't have focus, we want to revert the edit to show the new URL. (The | 141 // doesn't have focus, we want to revert the edit to show the new URL. (The |
143 // common case where the edit doesn't have focus is when the user has started | 142 // common case where the edit doesn't have focus is when the user has started |
144 // an edit and then abandoned it and clicked a link on the page.) | 143 // an edit and then abandoned it and clicked a link on the page.) |
145 const bool visibly_changed_permanent_text = | 144 const bool visibly_changed_permanent_text = |
146 (permanent_text_ != new_permanent_text) && | 145 (permanent_text_ != new_permanent_text) && |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 AutocompleteMatch* match, | 744 AutocompleteMatch* match, |
746 GURL* alternate_nav_url) const { | 745 GURL* alternate_nav_url) const { |
747 if (popup_->IsOpen() || query_in_progress()) { | 746 if (popup_->IsOpen() || query_in_progress()) { |
748 popup_->InfoForCurrentSelection(match, alternate_nav_url); | 747 popup_->InfoForCurrentSelection(match, alternate_nav_url); |
749 } else { | 748 } else { |
750 profile_->GetAutocompleteClassifier()->Classify( | 749 profile_->GetAutocompleteClassifier()->Classify( |
751 UserTextFromDisplayText(view_->GetText()), GetDesiredTLD(), match, | 750 UserTextFromDisplayText(view_->GetText()), GetDesiredTLD(), match, |
752 alternate_nav_url); | 751 alternate_nav_url); |
753 } | 752 } |
754 } | 753 } |
OLD | NEW |