| 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 | 7 |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "chrome/browser/autocomplete/autocomplete.h" | 9 #include "chrome/browser/autocomplete/autocomplete.h" |
| 10 #include "chrome/common/notification_registrar.h" | 10 #include "chrome/common/notification_registrar.h" |
| 11 | 11 |
| 12 class AutocompleteEditModel; | 12 class AutocompleteEditModel; |
| 13 class AutocompleteEditView; | 13 class AutocompleteEditView; |
| 14 class Profile; | 14 class Profile; |
| 15 class SkBitmap; |
| 15 | 16 |
| 16 class AutocompletePopupView; | 17 class AutocompletePopupView; |
| 17 | 18 |
| 18 class AutocompletePopupModel : public NotificationObserver { | 19 class AutocompletePopupModel : public NotificationObserver { |
| 19 public: | 20 public: |
| 20 AutocompletePopupModel(AutocompletePopupView* popup_view, | 21 AutocompletePopupModel(AutocompletePopupView* popup_view, |
| 21 AutocompleteEditModel* edit_model, | 22 AutocompleteEditModel* edit_model, |
| 22 Profile* profile); | 23 Profile* profile); |
| 23 ~AutocompletePopupModel(); | 24 ~AutocompletePopupModel(); |
| 24 | 25 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // current selection down (|count| > 0) or up (|count| < 0), clamping to the | 104 // current selection down (|count| > 0) or up (|count| < 0), clamping to the |
| 104 // first or last result if necessary. If |count| == 0, the selection will be | 105 // first or last result if necessary. If |count| == 0, the selection will be |
| 105 // unchanged, but the popup will still redraw and modify the text in the | 106 // unchanged, but the popup will still redraw and modify the text in the |
| 106 // AutocompleteEditModel. | 107 // AutocompleteEditModel. |
| 107 void Move(int count); | 108 void Move(int count); |
| 108 | 109 |
| 109 // Called when the user hits shift-delete. This should determine if the item | 110 // Called when the user hits shift-delete. This should determine if the item |
| 110 // can be removed from history, and if so, remove it and update the popup. | 111 // can be removed from history, and if so, remove it and update the popup. |
| 111 void TryDeletingCurrentItem(); | 112 void TryDeletingCurrentItem(); |
| 112 | 113 |
| 114 // Returns the special icon to use for a given match, or NULL if we should |
| 115 // use a standard style icon. |
| 116 const SkBitmap* GetSpecialIconForMatch(const AutocompleteMatch& match) const; |
| 117 |
| 113 // The token value for selected_line_, hover_line_ and functions dealing with | 118 // The token value for selected_line_, hover_line_ and functions dealing with |
| 114 // a "line number" that indicates "no line". | 119 // a "line number" that indicates "no line". |
| 115 static const size_t kNoMatch = -1; | 120 static const size_t kNoMatch = -1; |
| 116 | 121 |
| 117 private: | 122 private: |
| 118 // NotificationObserver | 123 // NotificationObserver |
| 119 virtual void Observe(NotificationType type, | 124 virtual void Observe(NotificationType type, |
| 120 const NotificationSource& source, | 125 const NotificationSource& source, |
| 121 const NotificationDetails& details); | 126 const NotificationDetails& details); |
| 122 | 127 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 138 // which should only be true when the popup is closed. | 143 // which should only be true when the popup is closed. |
| 139 size_t selected_line_; | 144 size_t selected_line_; |
| 140 | 145 |
| 141 // The match the user has manually chosen, if any. | 146 // The match the user has manually chosen, if any. |
| 142 AutocompleteResult::Selection manually_selected_match_; | 147 AutocompleteResult::Selection manually_selected_match_; |
| 143 | 148 |
| 144 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupModel); | 149 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupModel); |
| 145 }; | 150 }; |
| 146 | 151 |
| 147 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_MODEL_H_ | 152 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_MODEL_H_ |
| OLD | NEW |