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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // position to the right of the string. | 108 // position to the right of the string. |
109 int DrawRenderText(const AutocompleteMatch& match, | 109 int DrawRenderText(const AutocompleteMatch& match, |
110 gfx::RenderText* render_text, | 110 gfx::RenderText* render_text, |
111 RenderTextType render_text_type, | 111 RenderTextType render_text_type, |
112 gfx::Canvas* canvas, | 112 gfx::Canvas* canvas, |
113 int x, | 113 int x, |
114 int y, | 114 int y, |
115 int max_width) const; | 115 int max_width) const; |
116 | 116 |
117 // Creates a RenderText with given |text| and rendering defaults. | 117 // Creates a RenderText with given |text| and rendering defaults. |
118 scoped_ptr<gfx::RenderText> CreateRenderText( | 118 std::unique_ptr<gfx::RenderText> CreateRenderText( |
119 const base::string16& text) const; | 119 const base::string16& text) const; |
120 | 120 |
121 // Creates a RenderText with default rendering for the given |text|. The | 121 // Creates a RenderText with default rendering for the given |text|. The |
122 // |classifications| and |force_dim| are used to style the text. | 122 // |classifications| and |force_dim| are used to style the text. |
123 scoped_ptr<gfx::RenderText> CreateClassifiedRenderText( | 123 std::unique_ptr<gfx::RenderText> CreateClassifiedRenderText( |
124 const base::string16& text, | 124 const base::string16& text, |
125 const ACMatchClassifications& classifications, | 125 const ACMatchClassifications& classifications, |
126 bool force_dim) const; | 126 bool force_dim) const; |
127 | 127 |
128 const gfx::Rect& text_bounds() const { return text_bounds_; } | 128 const gfx::Rect& text_bounds() const { return text_bounds_; } |
129 | 129 |
130 private: | 130 private: |
131 // views::View: | 131 // views::View: |
132 const char* GetClassName() const override; | 132 const char* GetClassName() const override; |
133 | 133 |
(...skipping 28 matching lines...) Expand all Loading... |
162 // within the text bounds. The directionality of UI and match contents is used | 162 // within the text bounds. The directionality of UI and match contents is used |
163 // to determine the offset relative to the correct edge. | 163 // to determine the offset relative to the correct edge. |
164 int GetDisplayOffset(const AutocompleteMatch& match, | 164 int GetDisplayOffset(const AutocompleteMatch& match, |
165 bool is_ui_rtl, | 165 bool is_ui_rtl, |
166 bool is_match_contents_rtl) const; | 166 bool is_match_contents_rtl) const; |
167 | 167 |
168 int GetAnswerLineHeight() const; | 168 int GetAnswerLineHeight() const; |
169 int GetContentLineHeight() const; | 169 int GetContentLineHeight() const; |
170 | 170 |
171 // Creates a RenderText with text and styling from the image line. | 171 // Creates a RenderText with text and styling from the image line. |
172 scoped_ptr<gfx::RenderText> CreateAnswerLine( | 172 std::unique_ptr<gfx::RenderText> CreateAnswerLine( |
173 const SuggestionAnswer::ImageLine& line, | 173 const SuggestionAnswer::ImageLine& line, |
174 gfx::FontList font_list); | 174 gfx::FontList font_list); |
175 | 175 |
176 // Adds |text| to |destination|. |text_type| is an index into the | 176 // Adds |text| to |destination|. |text_type| is an index into the |
177 // kTextStyles constant defined in the .cc file and is used to style the text, | 177 // kTextStyles constant defined in the .cc file and is used to style the text, |
178 // including setting the font size, color, and baseline style. See the | 178 // including setting the font size, color, and baseline style. See the |
179 // TextStyle struct in the .cc file for more. | 179 // TextStyle struct in the .cc file for more. |
180 void AppendAnswerText(gfx::RenderText* destination, | 180 void AppendAnswerText(gfx::RenderText* destination, |
181 const base::string16& text, | 181 const base::string16& text, |
182 int text_type); | 182 int text_type); |
(...skipping 18 matching lines...) Expand all Loading... |
201 OmniboxPopupContentsView* model_; | 201 OmniboxPopupContentsView* model_; |
202 size_t model_index_; | 202 size_t model_index_; |
203 | 203 |
204 LocationBarView* location_bar_view_; | 204 LocationBarView* location_bar_view_; |
205 | 205 |
206 const gfx::FontList font_list_; | 206 const gfx::FontList font_list_; |
207 int font_height_; | 207 int font_height_; |
208 | 208 |
209 // A context used for mirroring regions. | 209 // A context used for mirroring regions. |
210 class MirroringContext; | 210 class MirroringContext; |
211 scoped_ptr<MirroringContext> mirroring_context_; | 211 std::unique_ptr<MirroringContext> mirroring_context_; |
212 | 212 |
213 AutocompleteMatch match_; | 213 AutocompleteMatch match_; |
214 | 214 |
215 gfx::Rect text_bounds_; | 215 gfx::Rect text_bounds_; |
216 gfx::Rect icon_bounds_; | 216 gfx::Rect icon_bounds_; |
217 | 217 |
218 gfx::Rect keyword_text_bounds_; | 218 gfx::Rect keyword_text_bounds_; |
219 scoped_ptr<views::ImageView> keyword_icon_; | 219 std::unique_ptr<views::ImageView> keyword_icon_; |
220 | 220 |
221 scoped_ptr<gfx::SlideAnimation> animation_; | 221 std::unique_ptr<gfx::SlideAnimation> animation_; |
222 | 222 |
223 // If the answer has an icon, cache the image. | 223 // If the answer has an icon, cache the image. |
224 gfx::ImageSkia answer_image_; | 224 gfx::ImageSkia answer_image_; |
225 | 225 |
226 // We preserve these RenderTexts so that we won't recreate them on every call | 226 // We preserve these RenderTexts so that we won't recreate them on every call |
227 // to GetMatchContentsWidth() or OnPaint(). | 227 // to GetMatchContentsWidth() or OnPaint(). |
228 mutable scoped_ptr<gfx::RenderText> contents_rendertext_; | 228 mutable std::unique_ptr<gfx::RenderText> contents_rendertext_; |
229 mutable scoped_ptr<gfx::RenderText> description_rendertext_; | 229 mutable std::unique_ptr<gfx::RenderText> description_rendertext_; |
230 mutable scoped_ptr<gfx::RenderText> separator_rendertext_; | 230 mutable std::unique_ptr<gfx::RenderText> separator_rendertext_; |
231 mutable scoped_ptr<gfx::RenderText> keyword_contents_rendertext_; | 231 mutable std::unique_ptr<gfx::RenderText> keyword_contents_rendertext_; |
232 mutable scoped_ptr<gfx::RenderText> keyword_description_rendertext_; | 232 mutable std::unique_ptr<gfx::RenderText> keyword_description_rendertext_; |
233 | 233 |
234 mutable int separator_width_; | 234 mutable int separator_width_; |
235 | 235 |
236 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView); | 236 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView); |
237 }; | 237 }; |
238 | 238 |
239 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ | 239 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ |
OLD | NEW |