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_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 enum ColorKind { | 43 enum ColorKind { |
44 BACKGROUND = 0, | 44 BACKGROUND = 0, |
45 TEXT, | 45 TEXT, |
46 DIMMED_TEXT, | 46 DIMMED_TEXT, |
47 URL, | 47 URL, |
48 NUM_KINDS | 48 NUM_KINDS |
49 }; | 49 }; |
50 | 50 |
51 OmniboxResultView(OmniboxPopupContentsView* model, | 51 OmniboxResultView(OmniboxPopupContentsView* model, |
52 int model_index, | 52 int model_index, |
| 53 LocationBarView* location_bar_view, |
53 const gfx::FontList& font_list); | 54 const gfx::FontList& font_list); |
54 ~OmniboxResultView() override; | 55 ~OmniboxResultView() override; |
55 | 56 |
56 SkColor GetColor(ResultViewState state, ColorKind kind) const; | 57 SkColor GetColor(ResultViewState state, ColorKind kind) const; |
57 | 58 |
58 // Updates the match used to paint the contents of this result view. We copy | 59 // Updates the match used to paint the contents of this result view. We copy |
59 // the match so that we can continue to paint the last result even after the | 60 // the match so that we can continue to paint the last result even after the |
60 // model has changed. | 61 // model has changed. |
61 void SetMatch(const AutocompleteMatch& match); | 62 void SetMatch(const AutocompleteMatch& match); |
62 | 63 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 bool force_dim) const; | 126 bool force_dim) const; |
126 | 127 |
127 const gfx::Rect& text_bounds() const { return text_bounds_; } | 128 const gfx::Rect& text_bounds() const { return text_bounds_; } |
128 | 129 |
129 private: | 130 private: |
130 // views::View: | 131 // views::View: |
131 const char* GetClassName() const override; | 132 const char* GetClassName() const override; |
132 | 133 |
133 gfx::ImageSkia GetIcon() const; | 134 gfx::ImageSkia GetIcon() const; |
134 | 135 |
| 136 gfx::ImageSkia GetKeywordIcon() const; |
| 137 |
135 // Utility function for creating vector icons. | 138 // Utility function for creating vector icons. |
136 gfx::ImageSkia GetVectorIcon(gfx::VectorIconId icon_id) const; | 139 gfx::ImageSkia GetVectorIcon(gfx::VectorIconId icon_id) const; |
137 | 140 |
138 // Whether to render only the keyword match. Returns true if |match_| has an | 141 // Whether to render only the keyword match. Returns true if |match_| has an |
139 // associated keyword match that has been animated so close to the start that | 142 // associated keyword match that has been animated so close to the start that |
140 // the keyword match will hide even the icon of the regular match. | 143 // the keyword match will hide even the icon of the regular match. |
141 bool ShowOnlyKeywordMatch() const; | 144 bool ShowOnlyKeywordMatch() const; |
142 | 145 |
143 // Initializes |contents_rendertext_| if it is NULL. | 146 // Initializes |contents_rendertext_| if it is NULL. |
144 void InitContentsRenderTextIfNecessary() const; | 147 void InitContentsRenderTextIfNecessary() const; |
(...skipping 29 matching lines...) Expand all Loading... |
174 const base::string16& text, | 177 const base::string16& text, |
175 int text_type) const; | 178 int text_type) const; |
176 | 179 |
177 // AppendAnswerText will break up the |text| into bold and non-bold pieces | 180 // AppendAnswerText will break up the |text| into bold and non-bold pieces |
178 // and pass each to this helper with the correct |is_bold| value. | 181 // and pass each to this helper with the correct |is_bold| value. |
179 void AppendAnswerTextHelper(gfx::RenderText* destination, | 182 void AppendAnswerTextHelper(gfx::RenderText* destination, |
180 const base::string16& text, | 183 const base::string16& text, |
181 int text_type, | 184 int text_type, |
182 bool is_bold) const; | 185 bool is_bold) const; |
183 | 186 |
| 187 static int default_icon_size_; |
| 188 |
184 // This row's model and model index. | 189 // This row's model and model index. |
185 OmniboxPopupContentsView* model_; | 190 OmniboxPopupContentsView* model_; |
186 size_t model_index_; | 191 size_t model_index_; |
187 | 192 |
| 193 LocationBarView* location_bar_view_; |
| 194 |
188 const gfx::FontList font_list_; | 195 const gfx::FontList font_list_; |
189 int font_height_; | 196 int font_height_; |
190 | 197 |
191 // A context used for mirroring regions. | 198 // A context used for mirroring regions. |
192 class MirroringContext; | 199 class MirroringContext; |
193 std::unique_ptr<MirroringContext> mirroring_context_; | 200 std::unique_ptr<MirroringContext> mirroring_context_; |
194 | 201 |
195 AutocompleteMatch match_; | 202 AutocompleteMatch match_; |
196 | 203 |
197 gfx::Rect text_bounds_; | 204 gfx::Rect text_bounds_; |
(...skipping 14 matching lines...) Expand all Loading... |
212 mutable std::unique_ptr<gfx::RenderText> separator_rendertext_; | 219 mutable std::unique_ptr<gfx::RenderText> separator_rendertext_; |
213 mutable std::unique_ptr<gfx::RenderText> keyword_contents_rendertext_; | 220 mutable std::unique_ptr<gfx::RenderText> keyword_contents_rendertext_; |
214 mutable std::unique_ptr<gfx::RenderText> keyword_description_rendertext_; | 221 mutable std::unique_ptr<gfx::RenderText> keyword_description_rendertext_; |
215 | 222 |
216 mutable int separator_width_; | 223 mutable int separator_width_; |
217 | 224 |
218 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView); | 225 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView); |
219 }; | 226 }; |
220 | 227 |
221 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ | 228 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ |
OLD | NEW |