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 and should be treated as append-only, since it backs an |
| 83 // UMA histogram.. |
| 84 enum class DownloadOutcome { |
| 85 SUCCEEDED = 0, |
| 86 FAILED = 1, |
| 87 SKIPPED = 2, |
| 88 DOWNLOAD_OUTCOME_COUNT = 3 |
| 89 }; |
| 90 |
78 class Delegate { | 91 class Delegate { |
79 public: | 92 public: |
80 // Mimics WebContents::ImageDownloadCallback. | 93 // Mimics WebContents::ImageDownloadCallback. |
81 typedef base::Callback<void( | 94 typedef base::Callback<void( |
82 int id, | 95 int id, |
83 int status_code, | 96 int status_code, |
84 const GURL& image_url, | 97 const GURL& image_url, |
85 const std::vector<SkBitmap>& bitmaps, | 98 const std::vector<SkBitmap>& bitmaps, |
86 const std::vector<gfx::Size>& original_bitmap_sizes)> | 99 const std::vector<gfx::Size>& original_bitmap_sizes)> |
87 ImageDownloadCallback; | 100 ImageDownloadCallback; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 // UpdateFaviconCandidate()), the favicon service and the delegate are | 316 // UpdateFaviconCandidate()), the favicon service and the delegate are |
304 // notified. | 317 // notified. |
305 DownloadedFavicon best_favicon_; | 318 DownloadedFavicon best_favicon_; |
306 | 319 |
307 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); | 320 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); |
308 }; | 321 }; |
309 | 322 |
310 } // namespace favicon | 323 } // namespace favicon |
311 | 324 |
312 #endif // COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_ | 325 #endif // COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_ |
OLD | NEW |