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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h" | |
11 #include "components/omnibox/autocomplete_match.h" | 12 #include "components/omnibox/autocomplete_match.h" |
12 #include "third_party/skia/include/core/SkColor.h" | 13 #include "third_party/skia/include/core/SkColor.h" |
13 #include "ui/gfx/animation/animation_delegate.h" | 14 #include "ui/gfx/animation/animation_delegate.h" |
14 #include "ui/gfx/animation/slide_animation.h" | 15 #include "ui/gfx/animation/slide_animation.h" |
15 #include "ui/gfx/font_list.h" | 16 #include "ui/gfx/font_list.h" |
16 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
17 #include "ui/views/controls/image_view.h" | 18 #include "ui/views/controls/image_view.h" |
18 #include "ui/views/view.h" | 19 #include "ui/views/view.h" |
19 | 20 |
20 class LocationBarView; | 21 class LocationBarView; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 | 69 |
69 ResultViewState GetState() const; | 70 ResultViewState GetState() const; |
70 | 71 |
71 // Returns the height of the text portion of the result view. In the base | 72 // Returns the height of the text portion of the result view. In the base |
72 // class, this is the height of one line of text. | 73 // class, this is the height of one line of text. |
73 virtual int GetTextHeight() const; | 74 virtual int GetTextHeight() const; |
74 | 75 |
75 // Returns the display width required for the match contents. | 76 // Returns the display width required for the match contents. |
76 int GetMatchContentsWidth() const; | 77 int GetMatchContentsWidth() const; |
77 | 78 |
79 void SetAnswerImage(gfx::ImageSkia image); | |
Peter Kasting
2015/02/14 00:10:15
Nit: I wonder if this should be private and the ob
| |
80 | |
78 protected: | 81 protected: |
79 // Paints the given |match| using the RenderText instances |contents| and | 82 // Paints the given |match| using the RenderText instances |contents| and |
80 // |description| at offset |x| in the bounds of this view. | 83 // |description| at offset |x| in the bounds of this view. |
81 virtual void PaintMatch(const AutocompleteMatch& match, | 84 virtual void PaintMatch(const AutocompleteMatch& match, |
82 gfx::RenderText* contents, | 85 gfx::RenderText* contents, |
83 gfx::RenderText* description, | 86 gfx::RenderText* description, |
84 gfx::Canvas* canvas, | 87 gfx::Canvas* canvas, |
85 int x) const; | 88 int x) const; |
86 | 89 |
87 // Draws given |render_text| on |canvas| at given location (|x|, |y|). | 90 // Draws given |render_text| on |canvas| at given location (|x|, |y|). |
(...skipping 26 matching lines...) Expand all Loading... | |
114 void set_edge_item_padding(int value) { edge_item_padding_ = value; } | 117 void set_edge_item_padding(int value) { edge_item_padding_ = value; } |
115 void set_item_padding(int value) { item_padding_ = value; } | 118 void set_item_padding(int value) { item_padding_ = value; } |
116 void set_minimum_text_vertical_padding(int value) { | 119 void set_minimum_text_vertical_padding(int value) { |
117 minimum_text_vertical_padding_ = value; | 120 minimum_text_vertical_padding_ = value; |
118 } | 121 } |
119 | 122 |
120 private: | 123 private: |
121 // views::View: | 124 // views::View: |
122 const char* GetClassName() const override; | 125 const char* GetClassName() const override; |
123 | 126 |
127 void GetAnswerIcon(); | |
Peter Kasting
2015/02/14 00:10:15
Nit: FetchAnswerImage(), perhaps, since this no lo
| |
124 gfx::ImageSkia GetIcon() const; | 128 gfx::ImageSkia GetIcon() const; |
125 const gfx::ImageSkia* GetKeywordIcon() const; | 129 const gfx::ImageSkia* GetKeywordIcon() const; |
126 | 130 |
127 // Whether to render only the keyword match. Returns true if |match_| has an | 131 // Whether to render only the keyword match. Returns true if |match_| has an |
128 // associated keyword match that has been animated so close to the start that | 132 // associated keyword match that has been animated so close to the start that |
129 // the keyword match will hide even the icon of the regular match. | 133 // the keyword match will hide even the icon of the regular match. |
130 bool ShowOnlyKeywordMatch() const; | 134 bool ShowOnlyKeywordMatch() const; |
131 | 135 |
132 // Resets all RenderTexts for contents and description of the |match_| and its | 136 // Resets all RenderTexts for contents and description of the |match_| and its |
133 // associated keyword match. | 137 // associated keyword match. |
(...skipping 12 matching lines...) Expand all Loading... | |
146 | 150 |
147 // Returns the offset at which the contents of the |match| should be displayed | 151 // Returns the offset at which the contents of the |match| should be displayed |
148 // within the text bounds. The directionality of UI and match contents is used | 152 // within the text bounds. The directionality of UI and match contents is used |
149 // to determine the offset relative to the correct edge. | 153 // to determine the offset relative to the correct edge. |
150 int GetDisplayOffset(const AutocompleteMatch& match, | 154 int GetDisplayOffset(const AutocompleteMatch& match, |
151 bool is_ui_rtl, | 155 bool is_ui_rtl, |
152 bool is_match_contents_rtl) const; | 156 bool is_match_contents_rtl) const; |
153 | 157 |
154 static int default_icon_size_; | 158 static int default_icon_size_; |
155 | 159 |
160 // If the answer has an icon, these control the fetching and updating | |
161 // of the icon. | |
162 BitmapFetcherService::RequestId request_id_; | |
163 GURL image_url_; | |
164 gfx::ImageSkia answer_image_; | |
165 | |
156 // Default values cached here, may be overridden using the setters above. | 166 // Default values cached here, may be overridden using the setters above. |
157 int edge_item_padding_; | 167 int edge_item_padding_; |
158 int item_padding_; | 168 int item_padding_; |
159 int minimum_text_vertical_padding_; | 169 int minimum_text_vertical_padding_; |
160 | 170 |
161 // This row's model and model index. | 171 // This row's model and model index. |
162 OmniboxPopupContentsView* model_; | 172 OmniboxPopupContentsView* model_; |
163 size_t model_index_; | 173 size_t model_index_; |
164 | 174 |
165 LocationBarView* location_bar_view_; | 175 LocationBarView* location_bar_view_; |
(...skipping 22 matching lines...) Expand all Loading... | |
188 mutable scoped_ptr<gfx::RenderText> separator_rendertext_; | 198 mutable scoped_ptr<gfx::RenderText> separator_rendertext_; |
189 mutable scoped_ptr<gfx::RenderText> keyword_contents_rendertext_; | 199 mutable scoped_ptr<gfx::RenderText> keyword_contents_rendertext_; |
190 mutable scoped_ptr<gfx::RenderText> keyword_description_rendertext_; | 200 mutable scoped_ptr<gfx::RenderText> keyword_description_rendertext_; |
191 | 201 |
192 mutable int separator_width_; | 202 mutable int separator_width_; |
193 | 203 |
194 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView); | 204 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView); |
195 }; | 205 }; |
196 | 206 |
197 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ | 207 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ |
OLD | NEW |