Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Side by Side Diff: components/previews/core/previews_black_list.cc

Issue 2760063002: Add support to previews/ for Server LoFi and LitePages (Closed)
Patch Set: build fix Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "components/previews/core/previews_black_list.h" 5 #include "components/previews/core/previews_black_list.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/optional.h" 10 #include "base/optional.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 69
70 PreviewsBlackList::~PreviewsBlackList() {} 70 PreviewsBlackList::~PreviewsBlackList() {}
71 71
72 void PreviewsBlackList::AddPreviewNavigation(const GURL& url, 72 void PreviewsBlackList::AddPreviewNavigation(const GURL& url,
73 bool opt_out, 73 bool opt_out,
74 PreviewsType type) { 74 PreviewsType type) {
75 DCHECK(thread_checker_.CalledOnValidThread()); 75 DCHECK(thread_checker_.CalledOnValidThread());
76 DCHECK(url.has_host()); 76 DCHECK(url.has_host());
77 switch (type) { 77 switch (type) {
78 case PreviewsType::LITE_PAGE:
79 UMA_HISTOGRAM_BOOLEAN("Previews.OptOut.UserOptedOut.LitePage", opt_out);
80 break;
81 case PreviewsType::SERVER_LOFI:
82 UMA_HISTOGRAM_BOOLEAN("Previews.OptOut.UserOptedOut.ServerLoFi", opt_out);
83 break;
78 case PreviewsType::OFFLINE: 84 case PreviewsType::OFFLINE:
79 UMA_HISTOGRAM_BOOLEAN("Previews.OptOut.UserOptedOut.Offline", opt_out); 85 UMA_HISTOGRAM_BOOLEAN("Previews.OptOut.UserOptedOut.Offline", opt_out);
80 break; 86 break;
81 default: 87 case PreviewsType::NONE:
88 case PreviewsType::LAST:
82 NOTREACHED(); 89 NOTREACHED();
83 } 90 }
84 if (opt_out) { 91 if (opt_out) {
85 last_opt_out_time_ = clock_->Now(); 92 last_opt_out_time_ = clock_->Now();
86 } 93 }
87 // If the |black_list_item_map_| has been loaded from |opt_out_store_|, 94 // If the |black_list_item_map_| has been loaded from |opt_out_store_|,
88 // synchronous operations will be accurate. Otherwise, queue the task to run 95 // synchronous operations will be accurate. Otherwise, queue the task to run
89 // asynchronously. 96 // asynchronously.
90 if (loaded_) { 97 if (loaded_) {
91 AddPreviewNavigationSync(url, opt_out, type); 98 AddPreviewNavigationSync(url, opt_out, type);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 // static 228 // static
222 std::unique_ptr<PreviewsBlackListItem> 229 std::unique_ptr<PreviewsBlackListItem>
223 PreviewsBlackList::CreateHostIndifferentBlackListItem() { 230 PreviewsBlackList::CreateHostIndifferentBlackListItem() {
224 return base::MakeUnique<PreviewsBlackListItem>( 231 return base::MakeUnique<PreviewsBlackListItem>(
225 params::MaxStoredHistoryLengthForHostIndifferentBlackList(), 232 params::MaxStoredHistoryLengthForHostIndifferentBlackList(),
226 params::HostIndifferentBlackListOptOutThreshold(), 233 params::HostIndifferentBlackListOptOutThreshold(),
227 params::HostIndifferentBlackListPerHostDuration()); 234 params::HostIndifferentBlackListPerHostDuration());
228 } 235 }
229 236
230 } // namespace previews 237 } // namespace previews
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698