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

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: nit changes Created 5 years, 9 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Stores the image in a local data member and schedules a repaint.
80 void SetAnswerImage(const gfx::ImageSkia& image);
81
78 protected: 82 protected:
79 // Paints the given |match| using the RenderText instances |contents| and 83 // Paints the given |match| using the RenderText instances |contents| and
80 // |description| at offset |x| in the bounds of this view. 84 // |description| at offset |x| in the bounds of this view.
81 virtual void PaintMatch(const AutocompleteMatch& match, 85 virtual void PaintMatch(const AutocompleteMatch& match,
82 gfx::RenderText* contents, 86 gfx::RenderText* contents,
83 gfx::RenderText* description, 87 gfx::RenderText* description,
84 gfx::Canvas* canvas, 88 gfx::Canvas* canvas,
85 int x) const; 89 int x) const;
86 90
87 // Draws given |render_text| on |canvas| at given location (|x|, |y|). 91 // Draws given |render_text| on |canvas| at given location (|x|, |y|).
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // Default values cached here, may be overridden using the setters above. 160 // Default values cached here, may be overridden using the setters above.
157 int edge_item_padding_; 161 int edge_item_padding_;
158 int item_padding_; 162 int item_padding_;
159 int minimum_text_vertical_padding_; 163 int minimum_text_vertical_padding_;
160 164
161 // This row's model and model index. 165 // This row's model and model index.
162 OmniboxPopupContentsView* model_; 166 OmniboxPopupContentsView* model_;
163 size_t model_index_; 167 size_t model_index_;
164 168
165 LocationBarView* location_bar_view_; 169 LocationBarView* location_bar_view_;
170 // Note: image_service_ may be null in some unit tests.
171 BitmapFetcherService* image_service_;
166 172
167 const gfx::FontList font_list_; 173 const gfx::FontList font_list_;
168 int font_height_; 174 int font_height_;
169 175
170 // A context used for mirroring regions. 176 // A context used for mirroring regions.
171 class MirroringContext; 177 class MirroringContext;
172 scoped_ptr<MirroringContext> mirroring_context_; 178 scoped_ptr<MirroringContext> mirroring_context_;
173 179
174 AutocompleteMatch match_; 180 AutocompleteMatch match_;
175 181
176 gfx::Rect text_bounds_; 182 gfx::Rect text_bounds_;
177 gfx::Rect icon_bounds_; 183 gfx::Rect icon_bounds_;
178 184
179 gfx::Rect keyword_text_bounds_; 185 gfx::Rect keyword_text_bounds_;
180 scoped_ptr<views::ImageView> keyword_icon_; 186 scoped_ptr<views::ImageView> keyword_icon_;
181 187
182 scoped_ptr<gfx::SlideAnimation> animation_; 188 scoped_ptr<gfx::SlideAnimation> animation_;
183 189
190 // If the answer has an icon, these control the fetching and updating
191 // of the icon.
192 BitmapFetcherService::RequestId request_id_;
193 gfx::ImageSkia answer_image_;
194
184 // We preserve these RenderTexts so that we won't recreate them on every call 195 // We preserve these RenderTexts so that we won't recreate them on every call
185 // to GetMatchContentsWidth() or OnPaint(). 196 // to GetMatchContentsWidth() or OnPaint().
186 mutable scoped_ptr<gfx::RenderText> contents_rendertext_; 197 mutable scoped_ptr<gfx::RenderText> contents_rendertext_;
187 mutable scoped_ptr<gfx::RenderText> description_rendertext_; 198 mutable scoped_ptr<gfx::RenderText> description_rendertext_;
188 mutable scoped_ptr<gfx::RenderText> separator_rendertext_; 199 mutable scoped_ptr<gfx::RenderText> separator_rendertext_;
189 mutable scoped_ptr<gfx::RenderText> keyword_contents_rendertext_; 200 mutable scoped_ptr<gfx::RenderText> keyword_contents_rendertext_;
190 mutable scoped_ptr<gfx::RenderText> keyword_description_rendertext_; 201 mutable scoped_ptr<gfx::RenderText> keyword_description_rendertext_;
191 202
192 mutable int separator_width_; 203 mutable int separator_width_;
193 204
205 base::WeakPtrFactory<OmniboxResultView> weak_ptr_factory_;
206
194 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView); 207 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView);
195 }; 208 };
196 209
197 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ 210 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h ('k') | chrome/browser/ui/views/omnibox/omnibox_result_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698