| Index: components/favicon/core/favicon_driver_impl.cc
|
| diff --git a/components/favicon/core/favicon_driver_impl.cc b/components/favicon/core/favicon_driver_impl.cc
|
| index c44b49eda2ddb859d214094821f117e997f08378..453c96b02e0efa5427f298518c969b93a8cb2f21 100644
|
| --- a/components/favicon/core/favicon_driver_impl.cc
|
| +++ b/components/favicon/core/favicon_driver_impl.cc
|
| @@ -5,12 +5,14 @@
|
| #include "components/favicon/core/favicon_driver_impl.h"
|
|
|
| #include "base/logging.h"
|
| +#include "base/metrics/histogram_macros.h"
|
| #include "base/strings/string_util.h"
|
| #include "build/build_config.h"
|
| #include "components/bookmarks/browser/bookmark_model.h"
|
| #include "components/favicon/core/favicon_driver_observer.h"
|
| #include "components/favicon/core/favicon_handler.h"
|
| #include "components/favicon/core/favicon_service.h"
|
| +#include "components/favicon/core/favicon_url.h"
|
| #include "components/history/core/browser/history_service.h"
|
|
|
| namespace favicon {
|
| @@ -22,6 +24,26 @@ const bool kEnableTouchIcon = true;
|
| const bool kEnableTouchIcon = false;
|
| #endif
|
|
|
| +void RecordCandidateMetrics(const std::vector<FaviconURL>& candidates) {
|
| + size_t with_defined_touch_icons = 0;
|
| + size_t with_defined_sizes = 0;
|
| + for (const auto& candidate : candidates) {
|
| + if (!candidate.icon_sizes.empty()) {
|
| + with_defined_sizes++;
|
| + }
|
| + if (candidate.icon_type &
|
| + (favicon_base::IconType::TOUCH_ICON |
|
| + favicon_base::IconType::TOUCH_PRECOMPOSED_ICON)) {
|
| + with_defined_touch_icons++;
|
| + }
|
| + }
|
| + UMA_HISTOGRAM_COUNTS_100("Favicons.CandidatesCount", candidates.size());
|
| + UMA_HISTOGRAM_COUNTS_100("Favicons.CandidatesWithDefinedSizesCount",
|
| + with_defined_sizes);
|
| + UMA_HISTOGRAM_COUNTS_100("Favicons.CandidatesWithTouchIconsCount",
|
| + with_defined_touch_icons);
|
| +}
|
| +
|
| } // namespace
|
|
|
| FaviconDriverImpl::FaviconDriverImpl(FaviconService* favicon_service,
|
| @@ -78,6 +100,7 @@ void FaviconDriverImpl::OnUpdateFaviconURL(
|
| const GURL& page_url,
|
| const std::vector<FaviconURL>& candidates) {
|
| DCHECK(!candidates.empty());
|
| + RecordCandidateMetrics(candidates);
|
| favicon_handler_->OnUpdateFaviconURL(page_url, candidates);
|
| if (touch_icon_handler_.get())
|
| touch_icon_handler_->OnUpdateFaviconURL(page_url, candidates);
|
|
|