Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 // | 68 // |
| 69 // When the renderer downloads favicons, it considers the entire list of | 69 // When the renderer downloads favicons, it considers the entire list of |
| 70 // favicon candidates, if |download_largest_favicon_| is true, the largest | 70 // favicon candidates, if |download_largest_favicon_| is true, the largest |
| 71 // favicon will be used, otherwise the one that best matches the preferred size | 71 // favicon will be used, otherwise the one that best matches the preferred size |
| 72 // is chosen (or the first one if there is no preferred size). Once the | 72 // is chosen (or the first one if there is no preferred size). Once the |
| 73 // matching favicon has been determined, SetFavicon is called which updates | 73 // matching favicon has been determined, SetFavicon is called which updates |
| 74 // the page's favicon and notifies the database to save the favicon. | 74 // the page's favicon and notifies the database to save the favicon. |
| 75 | 75 |
| 76 class FaviconHandler { | 76 class FaviconHandler { |
| 77 public: | 77 public: |
| 78 // Outcome of a single favicon download. | |
| 79 // Recorded as Favicons.DownloadOutcome and public for testing. | |
| 80 // | |
| 81 // These values must stay in sync with the FaviconCacheStatus enum | |
|
jkrcal
2017/04/10 12:29:38
nit: FaviconDownloadStatus
fhorschig
2017/04/10 13:45:37
Done.
| |
| 82 // in histograms.xml. | |
| 83 enum DownloadOutcome { SUCCEEDED = 0, FAILED = 1, SKIPPED = 2 }; | |
| 84 | |
| 78 class Delegate { | 85 class Delegate { |
| 79 public: | 86 public: |
| 80 // Mimics WebContents::ImageDownloadCallback. | 87 // Mimics WebContents::ImageDownloadCallback. |
| 81 typedef base::Callback<void( | 88 typedef base::Callback<void( |
| 82 int id, | 89 int id, |
| 83 int status_code, | 90 int status_code, |
| 84 const GURL& image_url, | 91 const GURL& image_url, |
| 85 const std::vector<SkBitmap>& bitmaps, | 92 const std::vector<SkBitmap>& bitmaps, |
| 86 const std::vector<gfx::Size>& original_bitmap_sizes)> | 93 const std::vector<gfx::Size>& original_bitmap_sizes)> |
| 87 ImageDownloadCallback; | 94 ImageDownloadCallback; |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 // UpdateFaviconCandidate()), the favicon service and the delegate are | 306 // UpdateFaviconCandidate()), the favicon service and the delegate are |
| 300 // notified. | 307 // notified. |
| 301 DownloadedFavicon best_favicon_; | 308 DownloadedFavicon best_favicon_; |
| 302 | 309 |
| 303 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); | 310 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); |
| 304 }; | 311 }; |
| 305 | 312 |
| 306 } // namespace favicon | 313 } // namespace favicon |
| 307 | 314 |
| 308 #endif // COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_ | 315 #endif // COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_ |
| OLD | NEW |