Chromium Code Reviews| Index: components/previews/core/previews_black_list.cc |
| diff --git a/components/previews/core/previews_black_list.cc b/components/previews/core/previews_black_list.cc |
| index ea5de7d822f6ebb8cf9d5504a500ad896895303a..ffd35cc71e52cb52aabdb3ac76e0befdec502f10 100644 |
| --- a/components/previews/core/previews_black_list.cc |
| +++ b/components/previews/core/previews_black_list.cc |
| @@ -6,7 +6,7 @@ |
| #include "base/bind.h" |
| #include "base/memory/ptr_util.h" |
| -#include "base/metrics/histogram_macros.h" |
| +#include "base/metrics/histogram.h" |
| #include "base/optional.h" |
| #include "base/time/clock.h" |
| #include "components/previews/core/previews_black_list_item.h" |
| @@ -74,13 +74,12 @@ void PreviewsBlackList::AddPreviewNavigation(const GURL& url, |
| PreviewsType type) { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| DCHECK(url.has_host()); |
| - switch (type) { |
| - case PreviewsType::OFFLINE: |
| - UMA_HISTOGRAM_BOOLEAN("Previews.OptOut.UserOptedOut.Offline", opt_out); |
| - break; |
| - default: |
| - NOTREACHED(); |
| - } |
| + std::string histogram_name("Previews.OptOut.UserOptedOut."); |
|
tbansal1
2017/05/02 21:49:31
Use StringPiece or base::StringPrintf to reduce
RyanSturm
2017/05/02 22:57:18
Done.
|
| + histogram_name.append(GetStringNameForType(type)); |
| + |
| + base::BooleanHistogram::FactoryGet( |
| + histogram_name, base::HistogramBase::kUmaTargetedHistogramFlag) |
| + ->Add(opt_out); |
| if (opt_out) { |
| last_opt_out_time_ = clock_->Now(); |
| } |