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

Unified 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, 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/omnibox/omnibox_result_view.h
diff --git a/chrome/browser/ui/views/omnibox/omnibox_result_view.h b/chrome/browser/ui/views/omnibox/omnibox_result_view.h
index 4ce5c993b479b5f75f10e3a0526c12e4f9688cae..099027c6c88594f248a8c95723570b1f8d1ff9f1 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_result_view.h
+++ b/chrome/browser/ui/views/omnibox/omnibox_result_view.h
@@ -8,6 +8,7 @@
#include <vector>
#include "base/gtest_prod_util.h"
+#include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h"
#include "components/omnibox/autocomplete_match.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/animation/animation_delegate.h"
@@ -75,6 +76,9 @@ class OmniboxResultView : public views::View,
// Returns the display width required for the match contents.
int GetMatchContentsWidth() const;
+ // Stores the image in a local data member and schedules a repaint.
+ void SetAnswerImage(const gfx::ImageSkia& image);
+
protected:
// Paints the given |match| using the RenderText instances |contents| and
// |description| at offset |x| in the bounds of this view.
@@ -163,6 +167,8 @@ class OmniboxResultView : public views::View,
size_t model_index_;
LocationBarView* location_bar_view_;
+ // Note: image_service_ may be null in some unit tests.
+ BitmapFetcherService* image_service_;
const gfx::FontList font_list_;
int font_height_;
@@ -181,6 +187,11 @@ class OmniboxResultView : public views::View,
scoped_ptr<gfx::SlideAnimation> animation_;
+ // If the answer has an icon, these control the fetching and updating
+ // of the icon.
+ BitmapFetcherService::RequestId request_id_;
+ gfx::ImageSkia answer_image_;
+
// We preserve these RenderTexts so that we won't recreate them on every call
// to GetMatchContentsWidth() or OnPaint().
mutable scoped_ptr<gfx::RenderText> contents_rendertext_;
@@ -191,6 +202,8 @@ class OmniboxResultView : public views::View,
mutable int separator_width_;
+ base::WeakPtrFactory<OmniboxResultView> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(OmniboxResultView);
};
« 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