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 favicon download. | |
79 // Recorded as Favicons.DownloadOutcome and public for testing. | |
80 // | |
81 // These values must stay in sync with the FaviconDownloadStatus enum | |
82 // in histograms.xml. | |
Ilya Sherman
2017/04/12 23:22:14
nit: Please also document that this enum should be
fhorschig
2017/04/13 15:14:05
Done.
| |
83 enum DownloadOutcome { SUCCEEDED = 0, FAILED = 1, SKIPPED = 2 }; | |
Ilya Sherman
2017/04/12 23:22:14
nit: Could this be an enum class?
fhorschig
2017/04/13 15:14:05
Done.
| |
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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
303 // UpdateFaviconCandidate()), the favicon service and the delegate are | 310 // UpdateFaviconCandidate()), the favicon service and the delegate are |
304 // notified. | 311 // notified. |
305 DownloadedFavicon best_favicon_; | 312 DownloadedFavicon best_favicon_; |
306 | 313 |
307 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); | 314 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); |
308 }; | 315 }; |
309 | 316 |
310 } // namespace favicon | 317 } // namespace favicon |
311 | 318 |
312 #endif // COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_ | 319 #endif // COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_ |
OLD | NEW |