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