| 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 #ifndef CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_MODEL_H_ |
| 6 #define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_MODEL_H_ | 6 #define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_MODEL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 9 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_result.h" | 10 #include "chrome/browser/autocomplete/autocomplete_result.h" |
| 11 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" | 11 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
| 12 | 12 |
| 13 class OmniboxPopupView; | 13 class OmniboxPopupView; |
| 14 class SkBitmap; | 14 |
| 15 namespace gfx { |
| 16 class Image; |
| 17 } |
| 15 | 18 |
| 16 class OmniboxPopupModel { | 19 class OmniboxPopupModel { |
| 17 public: | 20 public: |
| 18 // See selected_line_state_ for details. | 21 // See selected_line_state_ for details. |
| 19 enum LineState { | 22 enum LineState { |
| 20 NORMAL = 0, | 23 NORMAL = 0, |
| 21 KEYWORD | 24 KEYWORD |
| 22 }; | 25 }; |
| 23 | 26 |
| 24 OmniboxPopupModel(OmniboxPopupView* popup_view, OmniboxEditModel* edit_model); | 27 OmniboxPopupModel(OmniboxPopupView* popup_view, OmniboxEditModel* edit_model); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // If the selected line has both a normal match and a keyword match, this can | 77 // If the selected line has both a normal match and a keyword match, this can |
| 75 // be used to choose which to select. It is an error to call this when the | 78 // be used to choose which to select. It is an error to call this when the |
| 76 // selected line does not have both matches (or there is no selection). | 79 // selected line does not have both matches (or there is no selection). |
| 77 void SetSelectedLineState(LineState state); | 80 void SetSelectedLineState(LineState state); |
| 78 | 81 |
| 79 // Called when the user hits shift-delete. This should determine if the item | 82 // Called when the user hits shift-delete. This should determine if the item |
| 80 // can be removed from history, and if so, remove it and update the popup. | 83 // can be removed from history, and if so, remove it and update the popup. |
| 81 void TryDeletingCurrentItem(); | 84 void TryDeletingCurrentItem(); |
| 82 | 85 |
| 83 // If |match| is from an extension, returns the extension icon; otherwise | 86 // If |match| is from an extension, returns the extension icon; otherwise |
| 84 // returns NULL. | 87 // returns an empty Image. |
| 85 const SkBitmap* GetIconIfExtensionMatch(const AutocompleteMatch& match) const; | 88 gfx::Image GetIconIfExtensionMatch(const AutocompleteMatch& match) const; |
| 86 | 89 |
| 87 // The match the user has manually chosen, if any. | 90 // The match the user has manually chosen, if any. |
| 88 const AutocompleteResult::Selection& manually_selected_match() const { | 91 const AutocompleteResult::Selection& manually_selected_match() const { |
| 89 return manually_selected_match_; | 92 return manually_selected_match_; |
| 90 } | 93 } |
| 91 | 94 |
| 92 // Invoked from the edit model any time the result set of the controller | 95 // Invoked from the edit model any time the result set of the controller |
| 93 // changes. | 96 // changes. |
| 94 void OnResultChanged(); | 97 void OnResultChanged(); |
| 95 | 98 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 115 // (if KEYWORD) is selected. | 118 // (if KEYWORD) is selected. |
| 116 LineState selected_line_state_; | 119 LineState selected_line_state_; |
| 117 | 120 |
| 118 // The match the user has manually chosen, if any. | 121 // The match the user has manually chosen, if any. |
| 119 AutocompleteResult::Selection manually_selected_match_; | 122 AutocompleteResult::Selection manually_selected_match_; |
| 120 | 123 |
| 121 DISALLOW_COPY_AND_ASSIGN(OmniboxPopupModel); | 124 DISALLOW_COPY_AND_ASSIGN(OmniboxPopupModel); |
| 122 }; | 125 }; |
| 123 | 126 |
| 124 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_MODEL_H_ | 127 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_MODEL_H_ |
| OLD | NEW |