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

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

Issue 684983003: Add Observer in FaviconTabHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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_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>
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 base::CancelableTaskTracker* tracker); 141 base::CancelableTaskTracker* tracker);
142 142
143 virtual void SetHistoryFavicons(const GURL& page_url, 143 virtual void SetHistoryFavicons(const GURL& page_url,
144 const GURL& icon_url, 144 const GURL& icon_url,
145 favicon_base::IconType icon_type, 145 favicon_base::IconType icon_type,
146 const gfx::Image& image); 146 const gfx::Image& image);
147 147
148 // Returns true if the favicon should be saved. 148 // Returns true if the favicon should be saved.
149 virtual bool ShouldSaveFavicon(const GURL& url); 149 virtual bool ShouldSaveFavicon(const GURL& url);
150 150
151 // Notifies the driver that the favicon for the active entry was updated.
152 // |icon_url_changed| is true if a favicon with a different icon URL has been
153 // selected since the previous call to NotifyFaviconUpdated().
154 virtual void NotifyFaviconUpdated(bool icon_url_changed);
155
156 private: 151 private:
157 friend class TestFaviconHandler; // For testing 152 friend class TestFaviconHandler; // For testing
158 153
159 // Represents an in progress download of an image from the renderer. 154 // Represents an in progress download of an image from the renderer.
160 struct DownloadRequest { 155 struct DownloadRequest {
161 DownloadRequest(); 156 DownloadRequest();
162 ~DownloadRequest(); 157 ~DownloadRequest();
163 158
164 DownloadRequest(const GURL& url, 159 DownloadRequest(const GURL& url,
165 const GURL& image_url, 160 const GURL& image_url,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 const gfx::Image& image, 214 const gfx::Image& image,
220 float score, 215 float score,
221 favicon_base::IconType icon_type); 216 favicon_base::IconType icon_type);
222 217
223 // Sets the image data for the favicon. 218 // Sets the image data for the favicon.
224 void SetFavicon(const GURL& url, 219 void SetFavicon(const GURL& url,
225 const GURL& icon_url, 220 const GURL& icon_url,
226 const gfx::Image& image, 221 const gfx::Image& image,
227 favicon_base::IconType icon_type); 222 favicon_base::IconType icon_type);
228 223
229 // Sets the favicon's data. 224 // Notifies driver favicon available.
sky 2014/11/04 18:11:43 driver->|driver_|
michaelbai 2014/11/04 19:26:57 Done.
230 void SetFaviconOnActivePage(const std::vector< 225 void NotifyFaviconAvailable(
231 favicon_base::FaviconRawBitmapResult>& favicon_bitmap_results); 226 const std::vector<favicon_base::FaviconRawBitmapResult>&
232 void SetFaviconOnActivePage(const GURL& icon_url, const gfx::Image& image); 227 favicon_bitmap_results,
228 bool update_active_favicon);
sky 2014/11/04 18:11:43 Document what update_active_favicon. It's ok to sa
michaelbai 2014/11/04 19:26:57 Done.
229 void NotifyFaviconAvailable(const GURL& icon_url,
230 const gfx::Image& image,
231 bool update_active_favicon);
233 232
234 // Return the current candidate if any. 233 // Return the current candidate if any.
235 favicon::FaviconURL* current_candidate() { 234 favicon::FaviconURL* current_candidate() {
236 return (!image_urls_.empty()) ? &image_urls_.front() : NULL; 235 return (!image_urls_.empty()) ? &image_urls_.front() : NULL;
237 } 236 }
238 237
239 // Returns whether the page's url changed since the favicon was requested. 238 // Returns whether the page's url changed since the favicon was requested.
240 bool PageChangedSinceFaviconWasRequested(); 239 bool PageChangedSinceFaviconWasRequested();
241 240
242 // Returns the preferred size of the image. 0 means no preference (any size 241 // Returns the preferred size of the image. 0 means no preference (any size
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 // Best image we've seen so far. As images are downloaded from the page they 291 // Best image we've seen so far. As images are downloaded from the page they
293 // are stored here. When there is an exact match, or no more images are 292 // are stored here. When there is an exact match, or no more images are
294 // available the favicon service and the current page are updated (assuming 293 // available the favicon service and the current page are updated (assuming
295 // the image is for a favicon). 294 // the image is for a favicon).
296 FaviconCandidate best_favicon_candidate_; 295 FaviconCandidate best_favicon_candidate_;
297 296
298 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); 297 DISALLOW_COPY_AND_ASSIGN(FaviconHandler);
299 }; 298 };
300 299
301 #endif // CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ 300 #endif // CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/favicon/favicon_handler.cc » ('j') | chrome/browser/favicon/favicon_tab_helper.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698