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

Side by Side Diff: chrome/browser/image_holder.h

Issue 648653003: Standardize usage of virtual/override/final in chrome/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « chrome/browser/image_decoder.h ('k') | chrome/browser/image_holder_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_IMAGE_HOLDER_H_ 5 #ifndef CHROME_BROWSER_IMAGE_HOLDER_H_
6 #define CHROME_BROWSER_IMAGE_HOLDER_H_ 6 #define CHROME_BROWSER_IMAGE_HOLDER_H_
7 7
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" 9 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h"
10 #include "ui/gfx/image/image.h" 10 #include "ui/gfx/image/image.h"
(...skipping 12 matching lines...) Expand all
23 }; 23 };
24 24
25 // This class encapsulates the action of fetching a bitmap, reporting when it is 25 // This class encapsulates the action of fetching a bitmap, reporting when it is
26 // fetched, and holding onto the bitmap until no longer needed. 26 // fetched, and holding onto the bitmap until no longer needed.
27 class ImageHolder : public chrome::BitmapFetcherDelegate { 27 class ImageHolder : public chrome::BitmapFetcherDelegate {
28 public: 28 public:
29 ImageHolder(const GURL& low_dpi_url, 29 ImageHolder(const GURL& low_dpi_url,
30 const GURL& high_dpi_url, 30 const GURL& high_dpi_url,
31 Profile* profile, 31 Profile* profile,
32 ImageHolderDelegate* delegate); 32 ImageHolderDelegate* delegate);
33 virtual ~ImageHolder(); 33 ~ImageHolder() override;
34 34
35 // Begin fetching of the URLs we have. 35 // Begin fetching of the URLs we have.
36 void StartFetch(); 36 void StartFetch();
37 37
38 // Check whether we have a response from the server for these resources, 38 // Check whether we have a response from the server for these resources,
39 // even if the response is a failed fetch. 39 // even if the response is a failed fetch.
40 bool IsFetchingDone() const; 40 bool IsFetchingDone() const;
41 41
42 // Inherited from BitmapFetcherDelegate 42 // Inherited from BitmapFetcherDelegate
43 virtual void OnFetchComplete(const GURL url, const SkBitmap* bitmap) override; 43 void OnFetchComplete(const GURL url, const SkBitmap* bitmap) override;
44 44
45 // Accessors: 45 // Accessors:
46 GURL low_dpi_url() const { return low_dpi_url_; } 46 GURL low_dpi_url() const { return low_dpi_url_; }
47 GURL high_dpi_url() const { return high_dpi_url_; } 47 GURL high_dpi_url() const { return high_dpi_url_; }
48 gfx::Image low_dpi_image() { return gfx::Image(image_); } 48 gfx::Image low_dpi_image() { return gfx::Image(image_); }
49 49
50 private: 50 private:
51 // Helper function to create a bitmap fetcher (but not start the fetch). 51 // Helper function to create a bitmap fetcher (but not start the fetch).
52 void CreateBitmapFetcher(const GURL& url); 52 void CreateBitmapFetcher(const GURL& url);
53 53
54 GURL low_dpi_url_; 54 GURL low_dpi_url_;
55 GURL high_dpi_url_; 55 GURL high_dpi_url_;
56 bool low_dpi_fetched_; 56 bool low_dpi_fetched_;
57 bool high_dpi_fetched_; 57 bool high_dpi_fetched_;
58 gfx::ImageSkia image_; 58 gfx::ImageSkia image_;
59 ImageHolderDelegate* delegate_; 59 ImageHolderDelegate* delegate_;
60 ScopedVector<chrome::BitmapFetcher> fetchers_; 60 ScopedVector<chrome::BitmapFetcher> fetchers_;
61 Profile* profile_; 61 Profile* profile_;
62 62
63 FRIEND_TEST_ALL_PREFIXES(ImageHolderTest, CreateBitmapFetcherTest); 63 FRIEND_TEST_ALL_PREFIXES(ImageHolderTest, CreateBitmapFetcherTest);
64 FRIEND_TEST_ALL_PREFIXES(ImageHolderTest, OnFetchCompleteTest); 64 FRIEND_TEST_ALL_PREFIXES(ImageHolderTest, OnFetchCompleteTest);
65 FRIEND_TEST_ALL_PREFIXES(ImageHolderTest, IsFetchingDoneTest); 65 FRIEND_TEST_ALL_PREFIXES(ImageHolderTest, IsFetchingDoneTest);
66 66
67 DISALLOW_COPY_AND_ASSIGN(ImageHolder); 67 DISALLOW_COPY_AND_ASSIGN(ImageHolder);
68 }; 68 };
69 69
70 } // namespace chrome. 70 } // namespace chrome.
71 71
72 #endif // CHROME_BROWSER_IMAGE_HOLDER_H_ 72 #endif // CHROME_BROWSER_IMAGE_HOLDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/image_decoder.h ('k') | chrome/browser/image_holder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698