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

Side by Side Diff: chrome/browser/search/thumbnail_source.h

Issue 1974013002: Replace SkBitmap with gfx::Image in the ImageFetcher API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix iOS build errors. Created 4 years, 7 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_SEARCH_THUMBNAIL_SOURCE_H_ 5 #ifndef CHROME_BROWSER_SEARCH_THUMBNAIL_SOURCE_H_
6 #define CHROME_BROWSER_SEARCH_THUMBNAIL_SOURCE_H_ 6 #define CHROME_BROWSER_SEARCH_THUMBNAIL_SOURCE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "content/public/browser/url_data_source.h" 14 #include "content/public/browser/url_data_source.h"
15 #include "ui/gfx/image/image.h"
Marc Treib 2016/05/13 15:53:59 nit: You can forward-declare this, no need to incl
markusheintz_ 2016/05/17 13:08:22 Done.
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 17
17 class Profile; 18 class Profile;
18 class SkBitmap; 19 class SkBitmap;
19 20
20 namespace base { 21 namespace base {
21 class RefCountedMemory; 22 class RefCountedMemory;
22 } 23 }
23 24
24 namespace image_fetcher { 25 namespace image_fetcher {
(...skipping 29 matching lines...) Expand all
54 void ExtractPageAndThumbnailUrls(const std::string& path, 55 void ExtractPageAndThumbnailUrls(const std::string& path,
55 GURL* page_url, 56 GURL* page_url,
56 GURL* fallback_thumbnail_url); 57 GURL* fallback_thumbnail_url);
57 58
58 private: 59 private:
59 // Returns a JPEG-encoded |bitmap| to the |callback| if valid, or the default 60 // Returns a JPEG-encoded |bitmap| to the |callback| if valid, or the default
60 // thumbnail. 61 // thumbnail.
61 void SendFetchedUrlImage( 62 void SendFetchedUrlImage(
62 const content::URLDataSource::GotDataCallback& callback, 63 const content::URLDataSource::GotDataCallback& callback,
63 const GURL& url, 64 const GURL& url,
64 const SkBitmap* bitmap); 65 const gfx::Image& image);
65 66
66 // Raw PNG representation of the thumbnail to show when the thumbnail 67 // Raw PNG representation of the thumbnail to show when the thumbnail
67 // database doesn't have a thumbnail for a webpage. 68 // database doesn't have a thumbnail for a webpage.
68 scoped_refptr<base::RefCountedMemory> default_thumbnail_; 69 scoped_refptr<base::RefCountedMemory> default_thumbnail_;
69 70
70 // ThumbnailService. 71 // ThumbnailService.
71 scoped_refptr<thumbnails::ThumbnailService> thumbnail_service_; 72 scoped_refptr<thumbnails::ThumbnailService> thumbnail_service_;
72 73
73 // ImageFetcher. 74 // ImageFetcher.
74 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher_; 75 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher_;
75 76
76 // Indicate that, when a URL for which we don't have a thumbnail is requested 77 // Indicate that, when a URL for which we don't have a thumbnail is requested
77 // from this source, then Chrome should capture a thumbnail next time it 78 // from this source, then Chrome should capture a thumbnail next time it
78 // navigates to this URL. This is useful when the thumbnail URLs are generated 79 // navigates to this URL. This is useful when the thumbnail URLs are generated
79 // by an external service rather than TopSites, so Chrome can learn about the 80 // by an external service rather than TopSites, so Chrome can learn about the
80 // URLs for which it should get thumbnails. Sources that capture thumbnails 81 // URLs for which it should get thumbnails. Sources that capture thumbnails
81 // are also be more lenient when matching thumbnail URLs by checking for 82 // are also be more lenient when matching thumbnail URLs by checking for
82 // existing thumbnails in the database that contain a URL matching the prefix 83 // existing thumbnails in the database that contain a URL matching the prefix
83 // of the requested URL. 84 // of the requested URL.
84 const bool capture_thumbnails_; 85 const bool capture_thumbnails_;
85 86
86 base::WeakPtrFactory<ThumbnailSource> weak_ptr_factory_; 87 base::WeakPtrFactory<ThumbnailSource> weak_ptr_factory_;
87 88
88 DISALLOW_COPY_AND_ASSIGN(ThumbnailSource); 89 DISALLOW_COPY_AND_ASSIGN(ThumbnailSource);
89 }; 90 };
90 91
91 #endif // CHROME_BROWSER_SEARCH_THUMBNAIL_SOURCE_H_ 92 #endif // CHROME_BROWSER_SEARCH_THUMBNAIL_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698