Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_result_view.h

Issue 917333004: Answers in Suggest icon downloading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed some {} Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
78 protected: 79 protected:
79 // Paints the given |match| using the RenderText instances |contents| and 80 // Paints the given |match| using the RenderText instances |contents| and
80 // |description| at offset |x| in the bounds of this view. 81 // |description| at offset |x| in the bounds of this view.
81 virtual void PaintMatch(const AutocompleteMatch& match, 82 virtual void PaintMatch(const AutocompleteMatch& match,
82 gfx::RenderText* contents, 83 gfx::RenderText* contents,
83 gfx::RenderText* description, 84 gfx::RenderText* description,
84 gfx::Canvas* canvas, 85 gfx::Canvas* canvas,
85 int x) const; 86 int x);
86 87
87 // Draws given |render_text| on |canvas| at given location (|x|, |y|). 88 // Draws given |render_text| on |canvas| at given location (|x|, |y|).
88 // |contents| indicates whether the |render_text| is for the match contents 89 // |contents| indicates whether the |render_text| is for the match contents
89 // (rather than the separator or the description). Additional properties from 90 // (rather than the separator or the description). Additional properties from
90 // |match| are used to render Infinite suggestions correctly. If |max_width| 91 // |match| are used to render Infinite suggestions correctly. If |max_width|
91 // is a non-negative number, the text will be elided to fit within 92 // is a non-negative number, the text will be elided to fit within
92 // |max_width|. Returns the x position to the right of the string. 93 // |max_width|. Returns the x position to the right of the string.
93 int DrawRenderText(const AutocompleteMatch& match, 94 int DrawRenderText(const AutocompleteMatch& match,
94 gfx::RenderText* render_text, 95 gfx::RenderText* render_text,
95 bool contents, 96 bool contents,
(...skipping 18 matching lines...) Expand all
114 void set_edge_item_padding(int value) { edge_item_padding_ = value; } 115 void set_edge_item_padding(int value) { edge_item_padding_ = value; }
115 void set_item_padding(int value) { item_padding_ = value; } 116 void set_item_padding(int value) { item_padding_ = value; }
116 void set_minimum_text_vertical_padding(int value) { 117 void set_minimum_text_vertical_padding(int value) {
117 minimum_text_vertical_padding_ = value; 118 minimum_text_vertical_padding_ = value;
118 } 119 }
119 120
120 private: 121 private:
121 // views::View: 122 // views::View:
122 const char* GetClassName() const override; 123 const char* GetClassName() const override;
123 124
125 gfx::ImageSkia GetAnswerIcon();
124 gfx::ImageSkia GetIcon() const; 126 gfx::ImageSkia GetIcon() const;
125 const gfx::ImageSkia* GetKeywordIcon() const; 127 const gfx::ImageSkia* GetKeywordIcon() const;
126 128
127 // Whether to render only the keyword match. Returns true if |match_| has an 129 // 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 130 // 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. 131 // the keyword match will hide even the icon of the regular match.
130 bool ShowOnlyKeywordMatch() const; 132 bool ShowOnlyKeywordMatch() const;
131 133
132 // Resets all RenderTexts for contents and description of the |match_| and its 134 // Resets all RenderTexts for contents and description of the |match_| and its
133 // associated keyword match. 135 // associated keyword match.
(...skipping 12 matching lines...) Expand all
146 148
147 // Returns the offset at which the contents of the |match| should be displayed 149 // 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 150 // within the text bounds. The directionality of UI and match contents is used
149 // to determine the offset relative to the correct edge. 151 // to determine the offset relative to the correct edge.
150 int GetDisplayOffset(const AutocompleteMatch& match, 152 int GetDisplayOffset(const AutocompleteMatch& match,
151 bool is_ui_rtl, 153 bool is_ui_rtl,
152 bool is_match_contents_rtl) const; 154 bool is_match_contents_rtl) const;
153 155
154 static int default_icon_size_; 156 static int default_icon_size_;
155 157
158 // If the answer has an icon, these control the fetching and updating
159 // of the icon.
160 BitmapFetcherService::RequestId request_id_;
Peter Kasting 2015/02/13 03:01:07 I would consider making the members here mutable a
161 GURL image_url_;
groby-ooo-7-16 2015/02/13 02:30:56 I don't think you need |image_url_|.
162 gfx::ImageSkia answer_image_;
163
156 // Default values cached here, may be overridden using the setters above. 164 // Default values cached here, may be overridden using the setters above.
157 int edge_item_padding_; 165 int edge_item_padding_;
158 int item_padding_; 166 int item_padding_;
159 int minimum_text_vertical_padding_; 167 int minimum_text_vertical_padding_;
160 168
161 // This row's model and model index. 169 // This row's model and model index.
162 OmniboxPopupContentsView* model_; 170 OmniboxPopupContentsView* model_;
163 size_t model_index_; 171 size_t model_index_;
164 172
165 LocationBarView* location_bar_view_; 173 LocationBarView* location_bar_view_;
(...skipping 22 matching lines...) Expand all
188 mutable scoped_ptr<gfx::RenderText> separator_rendertext_; 196 mutable scoped_ptr<gfx::RenderText> separator_rendertext_;
189 mutable scoped_ptr<gfx::RenderText> keyword_contents_rendertext_; 197 mutable scoped_ptr<gfx::RenderText> keyword_contents_rendertext_;
190 mutable scoped_ptr<gfx::RenderText> keyword_description_rendertext_; 198 mutable scoped_ptr<gfx::RenderText> keyword_description_rendertext_;
191 199
192 mutable int separator_width_; 200 mutable int separator_width_;
193 201
194 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView); 202 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView);
195 }; 203 };
196 204
197 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ 205 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698