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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_MODEL_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_MODEL_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_MODEL_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_MODEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "chrome/browser/autocomplete/autocomplete.h" | 10 #include "chrome/browser/autocomplete/autocomplete.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 size_t selected_line() const { | 64 size_t selected_line() const { |
65 return selected_line_; | 65 return selected_line_; |
66 } | 66 } |
67 | 67 |
68 // Call to change the selected line. This will update all state and repaint | 68 // Call to change the selected line. This will update all state and repaint |
69 // the necessary parts of the window, as well as updating the edit with the | 69 // the necessary parts of the window, as well as updating the edit with the |
70 // new temporary text. |line| will be clamped to the range of valid lines. | 70 // new temporary text. |line| will be clamped to the range of valid lines. |
71 // |reset_to_default| is true when the selection is being reset back to the | 71 // |reset_to_default| is true when the selection is being reset back to the |
72 // default match, and thus there is no temporary text (and no | 72 // default match, and thus there is no temporary text (and no |
73 // |manually_selected_match_|). | 73 // |manually_selected_match_|). If |force| is true then the selected line will |
| 74 // be updated forcibly even if the |line| is same as the current selected |
| 75 // line. |
74 // NOTE: This assumes the popup is open, and thus both old and new values for | 76 // NOTE: This assumes the popup is open, and thus both old and new values for |
75 // the selected line should not be kNoMatch. | 77 // the selected line should not be kNoMatch. |
76 void SetSelectedLine(size_t line, bool reset_to_default); | 78 void SetSelectedLine(size_t line, bool reset_to_default, bool force); |
77 | 79 |
78 // Called when the user hits escape after arrowing around the popup. This | 80 // Called when the user hits escape after arrowing around the popup. This |
79 // will change the selected line back to the default match and redraw. | 81 // will change the selected line back to the default match and redraw. |
80 void ResetToDefaultMatch(); | 82 void ResetToDefaultMatch(); |
81 | 83 |
82 // Copies the selected match into |match|. If an update is in progress, | 84 // Copies the selected match into |match|. If an update is in progress, |
83 // "selected" means "default in the latest matches". If there are no matches, | 85 // "selected" means "default in the latest matches". If there are no matches, |
84 // does not update |match|. | 86 // does not update |match|. |
85 // | 87 // |
86 // If |alternate_nav_url| is non-NULL, it will be set to the alternate | 88 // If |alternate_nav_url| is non-NULL, it will be set to the alternate |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // which should only be true when the popup is closed. | 156 // which should only be true when the popup is closed. |
155 size_t selected_line_; | 157 size_t selected_line_; |
156 | 158 |
157 // The match the user has manually chosen, if any. | 159 // The match the user has manually chosen, if any. |
158 AutocompleteResult::Selection manually_selected_match_; | 160 AutocompleteResult::Selection manually_selected_match_; |
159 | 161 |
160 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupModel); | 162 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupModel); |
161 }; | 163 }; |
162 | 164 |
163 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_MODEL_H_ | 165 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_MODEL_H_ |
OLD | NEW |