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

Side by Side Diff: components/favicon/core/favicon_handler.h

Issue 1118073002: Simplify FaviconDriverImpl by removing extra FaviconHandler member. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_ 5 #ifndef COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_
6 #define COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_ 6 #define COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // . Otherwise we ask the history database to update the mapping from 63 // . Otherwise we ask the history database to update the mapping from
64 // page url to favicon url and call us back with the favicon. Remember, it is 64 // page url to favicon url and call us back with the favicon. Remember, it is
65 // possible for the db to already have the favicon, just not the mapping 65 // possible for the db to already have the favicon, just not the mapping
66 // between page to favicon url. The callback for this is OnFaviconData. 66 // between page to favicon url. The callback for this is OnFaviconData.
67 // 67 //
68 // OnFaviconData either updates the favicon of the current page (if the 68 // OnFaviconData either updates the favicon of the current page (if the
69 // db knew about the favicon), or requests the renderer to download the 69 // db knew about the favicon), or requests the renderer to download the
70 // favicon. 70 // favicon.
71 // 71 //
72 // When the renderer downloads favicons, it considers the entire list of 72 // When the renderer downloads favicons, it considers the entire list of
73 // favicon candidates, if |download_largest_favicon_| is true, the largest 73 // favicon candidates, if |download_largest_favicon_| is true, the largest
huangs 2015/04/30 20:23:41 Update name |download_largest_favicon_|
74 // favicon will be used, otherwise the one that best matches the preferred size 74 // favicon will be used, otherwise the one that best matches the preferred size
75 // is chosen (or the first one if there is no preferred size). Once the 75 // is chosen (or the first one if there is no preferred size). Once the
76 // matching favicon has been determined, SetFavicon is called which updates 76 // matching favicon has been determined, SetFavicon is called which updates
77 // the page's favicon and notifies the database to save the favicon. 77 // the page's favicon and notifies the database to save the favicon.
78 78
79 class FaviconHandler { 79 class FaviconHandler {
80 public: 80 public:
81 enum Type { FAVICON, TOUCH, LARGE }; 81 enum Type { FAVICON, TOUCH, LARGE };
huangs 2015/04/30 20:23:41 Remove LARGE?
82 82
83 FaviconHandler(FaviconService* service, 83 FaviconHandler(FaviconService* service,
84 FaviconDriver* driver, 84 FaviconDriver* driver,
85 Type handler_type, 85 Type handler_type,
86 bool download_largest_icon); 86 bool download_largest_icon);
87 virtual ~FaviconHandler(); 87 virtual ~FaviconHandler();
88 88
89 // Returns the bit mask of favicon_base::IconType based on the handler's type. 89 // Returns the bit mask of favicon_base::IconType based on the handler's type.
90 static int GetIconTypesFromHandlerType(Type icon_type); 90 static int GetIconTypesFromHandlerType(Type icon_type);
91 91
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 GURL url; 187 GURL url;
188 GURL image_url; 188 GURL image_url;
189 gfx::Image image; 189 gfx::Image image;
190 float score; 190 float score;
191 favicon_base::IconType icon_type; 191 favicon_base::IconType icon_type;
192 }; 192 };
193 193
194 // Get the maximal icon size in pixels for a icon of type |icon_type| for the 194 // Get the maximal icon size in pixels for a icon of type |icon_type| for the
195 // current platform. 195 // current platform.
196 static int GetMaximalIconSize(favicon_base::IconType icon_type); 196 int GetMaximalIconSize(favicon_base::IconType icon_type);
197 197
198 // See description above class for details. 198 // See description above class for details.
199 void OnFaviconDataForInitialURLFromFaviconService(const std::vector< 199 void OnFaviconDataForInitialURLFromFaviconService(const std::vector<
200 favicon_base::FaviconRawBitmapResult>& favicon_bitmap_results); 200 favicon_base::FaviconRawBitmapResult>& favicon_bitmap_results);
201 201
202 // If the favicon has expired, asks the renderer to download the favicon. 202 // If the favicon has expired, asks the renderer to download the favicon.
203 // Otherwise asks history to update the mapping between page url and icon 203 // Otherwise asks history to update the mapping between page url and icon
204 // url with a callback to OnFaviconData when done. 204 // url with a callback to OnFaviconData when done.
205 void DownloadFaviconOrAskFaviconService(const GURL& page_url, 205 void DownloadFaviconOrAskFaviconService(const GURL& page_url,
206 const GURL& icon_url, 206 const GURL& icon_url,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 // available the favicon service and the current page are updated (assuming 304 // available the favicon service and the current page are updated (assuming
305 // the image is for a favicon). 305 // the image is for a favicon).
306 FaviconCandidate best_favicon_candidate_; 306 FaviconCandidate best_favicon_candidate_;
307 307
308 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); 308 DISALLOW_COPY_AND_ASSIGN(FaviconHandler);
309 }; 309 };
310 310
311 } // namespace favicon 311 } // namespace favicon
312 312
313 #endif // COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_ 313 #endif // COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698