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

Side by Side Diff: components/ntp_tiles/most_visited_sites.cc

Issue 2846233003: 📰 Record user actions on the NTP and Home sheet (Closed)
Patch Set: Address bauerb@'s comment Created 3 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ntp_tiles/most_visited_sites.h" 5 #include "components/ntp_tiles/most_visited_sites.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/feature_list.h" 14 #include "base/feature_list.h"
15 #include "base/metrics/user_metrics.h"
15 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
16 #include "components/history/core/browser/top_sites.h" 17 #include "components/history/core/browser/top_sites.h"
17 #include "components/ntp_tiles/constants.h" 18 #include "components/ntp_tiles/constants.h"
18 #include "components/ntp_tiles/field_trial.h" 19 #include "components/ntp_tiles/field_trial.h"
19 #include "components/ntp_tiles/icon_cacher.h" 20 #include "components/ntp_tiles/icon_cacher.h"
20 #include "components/ntp_tiles/pref_names.h" 21 #include "components/ntp_tiles/pref_names.h"
21 #include "components/ntp_tiles/switches.h" 22 #include "components/ntp_tiles/switches.h"
22 #include "components/pref_registry/pref_registry_syncable.h" 23 #include "components/pref_registry/pref_registry_syncable.h"
23 #include "components/prefs/pref_service.h" 24 #include "components/prefs/pref_service.h"
24 25
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // Also start a request for fresh suggestions. 128 // Also start a request for fresh suggestions.
128 Refresh(); 129 Refresh();
129 } 130 }
130 131
131 void MostVisitedSites::Refresh() { 132 void MostVisitedSites::Refresh() {
132 suggestions_service_->FetchSuggestionsData(); 133 suggestions_service_->FetchSuggestionsData();
133 } 134 }
134 135
135 void MostVisitedSites::AddOrRemoveBlacklistedUrl(const GURL& url, 136 void MostVisitedSites::AddOrRemoveBlacklistedUrl(const GURL& url,
136 bool add_url) { 137 bool add_url) {
138 if (add_url) {
139 base::RecordAction(base::UserMetricsAction("Suggestions.Site.Removed"));
140 } else {
141 base::RecordAction(
142 base::UserMetricsAction("Suggestions.Site.RemovalUndone"));
143 }
144
137 if (top_sites_) { 145 if (top_sites_) {
138 // Always blacklist in the local TopSites. 146 // Always blacklist in the local TopSites.
139 if (add_url) 147 if (add_url)
140 top_sites_->AddBlacklistedURL(url); 148 top_sites_->AddBlacklistedURL(url);
141 else 149 else
142 top_sites_->RemoveBlacklistedURL(url); 150 top_sites_->RemoveBlacklistedURL(url);
143 } 151 }
144 152
145 // Only blacklist in the server-side suggestions service if it's active. 153 // Only blacklist in the server-side suggestions service if it's active.
146 if (mv_source_ == TileSource::SUGGESTIONS_SERVICE) { 154 if (mv_source_ == TileSource::SUGGESTIONS_SERVICE) {
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 442
435 void MostVisitedSites::TopSitesChanged(TopSites* top_sites, 443 void MostVisitedSites::TopSitesChanged(TopSites* top_sites,
436 ChangeReason change_reason) { 444 ChangeReason change_reason) {
437 if (mv_source_ == TileSource::TOP_SITES) { 445 if (mv_source_ == TileSource::TOP_SITES) {
438 // The displayed tiles are invalidated. 446 // The displayed tiles are invalidated.
439 InitiateTopSitesQuery(); 447 InitiateTopSitesQuery();
440 } 448 }
441 } 449 }
442 450
443 } // namespace ntp_tiles 451 } // namespace ntp_tiles
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698