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

Side by Side Diff: chrome/browser/favicon/favicon_handler.h

Issue 285293005: Replace content's faviconURL with components/favicon's (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 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
« no previous file with comments | « no previous file | chrome/browser/favicon/favicon_handler.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 (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_FAVICON_FAVICON_HANDLER_H_ 5 #ifndef CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_
6 #define CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ 6 #define CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/task/cancelable_task_tracker.h" 15 #include "base/task/cancelable_task_tracker.h"
16 #include "chrome/browser/favicon/favicon_service.h" 16 #include "chrome/browser/favicon/favicon_service.h"
17 #include "chrome/browser/favicon/favicon_tab_helper.h" 17 #include "chrome/browser/favicon/favicon_tab_helper.h"
18 #include "content/public/common/favicon_url.h" 18 #include "components/favicon/core/favicon_url.h"
19 #include "ui/gfx/favicon_size.h" 19 #include "ui/gfx/favicon_size.h"
20 #include "ui/gfx/image/image.h" 20 #include "ui/gfx/image/image.h"
21 #include "url/gurl.h" 21 #include "url/gurl.h"
22 22
23 class FaviconClient; 23 class FaviconClient;
24 class FaviconDriver; 24 class FaviconDriver;
25 class SkBitmap; 25 class SkBitmap;
26 26
27 namespace base { 27 namespace base {
28 class RefCountedMemory; 28 class RefCountedMemory;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 FaviconDriver* driver, 85 FaviconDriver* driver,
86 Type icon_type, 86 Type icon_type,
87 bool download_largest_icon); 87 bool download_largest_icon);
88 virtual ~FaviconHandler(); 88 virtual ~FaviconHandler();
89 89
90 // Initiates loading the favicon for the specified url. 90 // Initiates loading the favicon for the specified url.
91 void FetchFavicon(const GURL& url); 91 void FetchFavicon(const GURL& url);
92 92
93 // Message Handler. Must be public, because also called from 93 // Message Handler. Must be public, because also called from
94 // PrerenderContents. Collects the |image_urls| list. 94 // PrerenderContents. Collects the |image_urls| list.
95 void OnUpdateFaviconURL(const std::vector<content::FaviconURL>& candidates); 95 void OnUpdateFaviconURL(const std::vector<favicon::FaviconURL>& candidates);
96 96
97 // Processes the current image_irls_ entry, requesting the image from the 97 // Processes the current image_irls_ entry, requesting the image from the
98 // history / download service. 98 // history / download service.
99 void ProcessCurrentUrl(); 99 void ProcessCurrentUrl();
100 100
101 // Message handler for ImageHostMsg_DidDownloadImage. Called when the image 101 // Message handler for ImageHostMsg_DidDownloadImage. Called when the image
102 // at |image_url| has been downloaded. 102 // at |image_url| has been downloaded.
103 // |bitmaps| is a list of all the frames of the image at |image_url|. 103 // |bitmaps| is a list of all the frames of the image at |image_url|.
104 // |original_bitmap_sizes| are the sizes of |bitmaps| before they were resized 104 // |original_bitmap_sizes| are the sizes of |bitmaps| before they were resized
105 // to the maximum bitmap size passed to DownloadFavicon(). 105 // to the maximum bitmap size passed to DownloadFavicon().
106 void OnDidDownloadFavicon( 106 void OnDidDownloadFavicon(
107 int id, 107 int id,
108 const GURL& image_url, 108 const GURL& image_url,
109 const std::vector<SkBitmap>& bitmaps, 109 const std::vector<SkBitmap>& bitmaps,
110 const std::vector<gfx::Size>& original_bitmap_sizes); 110 const std::vector<gfx::Size>& original_bitmap_sizes);
111 111
112 // For testing. 112 // For testing.
113 const std::vector<content::FaviconURL>& image_urls() const { 113 const std::vector<favicon::FaviconURL>& image_urls() const {
114 return image_urls_; 114 return image_urls_;
115 } 115 }
116 116
117 protected: 117 protected:
118 // These virtual methods make FaviconHandler testable and are overridden by 118 // These virtual methods make FaviconHandler testable and are overridden by
119 // TestFaviconHandler. 119 // TestFaviconHandler.
120 120
121 // Asks the render to download favicon, returns the request id. 121 // Asks the render to download favicon, returns the request id.
122 virtual int DownloadFavicon(const GURL& image_url, int max_bitmap_size); 122 virtual int DownloadFavicon(const GURL& image_url, int max_bitmap_size);
123 123
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 const GURL& icon_url, 222 const GURL& icon_url,
223 const gfx::Image& image, 223 const gfx::Image& image,
224 favicon_base::IconType icon_type); 224 favicon_base::IconType icon_type);
225 225
226 // Sets the favicon's data. 226 // Sets the favicon's data.
227 void SetFaviconOnActivePage(const std::vector< 227 void SetFaviconOnActivePage(const std::vector<
228 favicon_base::FaviconBitmapResult>& favicon_bitmap_results); 228 favicon_base::FaviconBitmapResult>& favicon_bitmap_results);
229 void SetFaviconOnActivePage(const GURL& icon_url, const gfx::Image& image); 229 void SetFaviconOnActivePage(const GURL& icon_url, const gfx::Image& image);
230 230
231 // Return the current candidate if any. 231 // Return the current candidate if any.
232 content::FaviconURL* current_candidate() { 232 favicon::FaviconURL* current_candidate() {
233 return (!image_urls_.empty()) ? &image_urls_.front() : NULL; 233 return (!image_urls_.empty()) ? &image_urls_.front() : NULL;
234 } 234 }
235 235
236 // Returns whether the page's url changed since the favicon was requested. 236 // Returns whether the page's url changed since the favicon was requested.
237 bool PageChangedSinceFaviconWasRequested(); 237 bool PageChangedSinceFaviconWasRequested();
238 238
239 // Returns the preferred size of the image. 0 means no preference (any size 239 // Returns the preferred size of the image. 0 means no preference (any size
240 // will do). 240 // will do).
241 int preferred_icon_size() const { 241 int preferred_icon_size() const {
242 if (download_largest_icon_) 242 if (download_largest_icon_)
(...skipping 25 matching lines...) Expand all
268 typedef std::map<int, DownloadRequest> DownloadRequests; 268 typedef std::map<int, DownloadRequest> DownloadRequests;
269 DownloadRequests download_requests_; 269 DownloadRequests download_requests_;
270 270
271 // The combination of the supported icon types. 271 // The combination of the supported icon types.
272 const int icon_types_; 272 const int icon_types_;
273 273
274 // Whether the largest icon should be downloaded. 274 // Whether the largest icon should be downloaded.
275 const bool download_largest_icon_; 275 const bool download_largest_icon_;
276 276
277 // The prioritized favicon candidates from the page back from the renderer. 277 // The prioritized favicon candidates from the page back from the renderer.
278 std::vector<content::FaviconURL> image_urls_; 278 std::vector<favicon::FaviconURL> image_urls_;
279 279
280 // The FaviconBitmapResults from history. 280 // The FaviconBitmapResults from history.
281 std::vector<favicon_base::FaviconBitmapResult> history_results_; 281 std::vector<favicon_base::FaviconBitmapResult> history_results_;
282 282
283 // The client which implements embedder-specific Favicon operations. 283 // The client which implements embedder-specific Favicon operations.
284 FaviconClient* client_; // weak 284 FaviconClient* client_; // weak
285 285
286 // This handler's driver. 286 // This handler's driver.
287 FaviconDriver* driver_; // weak 287 FaviconDriver* driver_; // weak
288 288
289 // Best image we've seen so far. As images are downloaded from the page they 289 // Best image we've seen so far. As images are downloaded from the page they
290 // are stored here. When there is an exact match, or no more images are 290 // are stored here. When there is an exact match, or no more images are
291 // available the favicon service and the current page are updated (assuming 291 // available the favicon service and the current page are updated (assuming
292 // the image is for a favicon). 292 // the image is for a favicon).
293 FaviconCandidate best_favicon_candidate_; 293 FaviconCandidate best_favicon_candidate_;
294 294
295 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); 295 DISALLOW_COPY_AND_ASSIGN(FaviconHandler);
296 }; 296 };
297 297
298 #endif // CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ 298 #endif // CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/favicon/favicon_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698