OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_popup_model.h" | 5 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 134 |
135 line = std::min(line, result.size() - 1); | 135 line = std::min(line, result.size() - 1); |
136 const AutocompleteMatch& match = result.match_at(line); | 136 const AutocompleteMatch& match = result.match_at(line); |
137 if (reset_to_default) { | 137 if (reset_to_default) { |
138 manually_selected_match_.Clear(); | 138 manually_selected_match_.Clear(); |
139 } else { | 139 } else { |
140 // Track the user's selection until they cancel it. | 140 // Track the user's selection until they cancel it. |
141 manually_selected_match_.destination_url = match.destination_url; | 141 manually_selected_match_.destination_url = match.destination_url; |
142 manually_selected_match_.provider_affinity = match.provider; | 142 manually_selected_match_.provider_affinity = match.provider; |
143 manually_selected_match_.is_history_what_you_typed_match = | 143 manually_selected_match_.is_history_what_you_typed_match = |
144 match.is_history_what_you_typed_match; | 144 match.type == AutocompleteMatchType::URL_WHAT_YOU_TYPED; |
145 } | 145 } |
146 | 146 |
147 if (line == selected_line_ && !force) | 147 if (line == selected_line_ && !force) |
148 return; // Nothing else to do. | 148 return; // Nothing else to do. |
149 | 149 |
150 // We need to update |selected_line_state_| and |selected_line_| before | 150 // We need to update |selected_line_state_| and |selected_line_| before |
151 // calling InvalidateLine(), since it will check them to determine how to | 151 // calling InvalidateLine(), since it will check them to determine how to |
152 // draw. We also need to update |selected_line_| before calling | 152 // draw. We also need to update |selected_line_| before calling |
153 // OnPopupDataChanged(), so that when the edit notifies its controller that | 153 // OnPopupDataChanged(), so that when the edit notifies its controller that |
154 // something has changed, the controller can get the correct updated data. | 154 // something has changed, the controller can get the correct updated data. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 } | 294 } |
295 } | 295 } |
296 | 296 |
297 void OmniboxPopupModel::AddObserver(OmniboxPopupModelObserver* observer) { | 297 void OmniboxPopupModel::AddObserver(OmniboxPopupModelObserver* observer) { |
298 observers_.AddObserver(observer); | 298 observers_.AddObserver(observer); |
299 } | 299 } |
300 | 300 |
301 void OmniboxPopupModel::RemoveObserver(OmniboxPopupModelObserver* observer) { | 301 void OmniboxPopupModel::RemoveObserver(OmniboxPopupModelObserver* observer) { |
302 observers_.RemoveObserver(observer); | 302 observers_.RemoveObserver(observer); |
303 } | 303 } |
OLD | NEW |