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

Side by Side Diff: chrome/browser/history/most_visited_tiles_experiment.h

Issue 17114002: Field trial removing tiles from NTP if URL is already open - for 1993 clients (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Spacing fix Created 7 years, 5 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
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_HISTORY_MOST_VISITED_TILES_EXPERIMENT_H_
6 #define CHROME_BROWSER_HISTORY_MOST_VISITED_TILES_EXPERIMENT_H_
7
8 #include "base/values.h"
9 #include "chrome/browser/history/history_types.h"
10 #include "chrome/common/instant_types.h"
11
12 class ListValue;
13 class InstantMostVisitedItem;
14
15 namespace history {
16
17 // This enum is also defined in histograms.xml. These values represent the
18 // types of actions carried out by the Most Visited Tile Placement experiment.
19 enum NtpTileExperimentActions {
20 NTP_TILE_EXPERIMENT_ACTION_REMOVED_URL = 0,
21 NTP_TILE_EXPERIMENT_ACTION_DID_NOT_REMOVE_URL = 1,
22 NTP_TILE_EXPERIMENT_ACTION_TOO_FEW_URLS_TILES_1_8 = 2,
23 NTP_TILE_EXPERIMENT_ACTION_TOO_FEW_URLS_TILES_1_4 = 3,
24 // The number of Most Visited Tile Placement experiment actions logged.
25 NUM_NTP_TILE_EXPERIMENT_ACTIONS
26 };
27
28 // Class for implementing the Most Visited Tile Placement experiment.
29 class MostVisitedTilesExperiment {
30 public:
31 // Minimum number of Most Visited suggestions required in order for the Most
32 // Visited Field Trial to remove a URL already open in the browser.
33 static const size_t kMinUrlSuggestions;
34
35 // Name of the histogram tracking types of actions carried out by the Most
36 // Visited Tile Placement experiment.
37 static const char kMostVisitedExperimentHistogramName[];
38
39 // Helper method to shuffle MostVisited tiles for A/B testing purposes.
40 static void MaybeShuffle(MostVisitedURLList* data);
41
42 // Returns true if this user is part of the Most Visited Tile Placement
43 // experiment group where URLs currently open in another browser tab are not
44 // displayed on an NTP tile. Note: the experiment targets only the top-level
45 // of sites i.e. if www.foo.com/bar is open in browser, and www.foo.com is a
46 // recommended URL, www.foo.com will still appear on the next NTP open. The
47 // experiment will not remove a URL if doing so would cause the number of Most
48 // Visited recommendations to drop below eight.
49 static bool IsDontShowOpenURLsEnabled();
Alexei Svitkine (slow) 2013/07/22 21:14:10 Is there a better name you can come up with for th
annark1 2013/07/23 19:52:21 This name is as per sky@'s suggestion, and is spec
50
51 // Removes URLs already open in browser, for 1993 clients, if part of
52 // experiment described for IsDontShowOpenURLsEnabled().
53 static void RemoveItemsMatchingOpenTabs(
54 const std::set<std::string>& open_urls,
55 std::vector<InstantMostVisitedItem>* items);
56
57 // Removes URLs already open in browser, for non-1993 clients, if part of
58 // experiment described for IsDontShowOpenURLsEnabled().
59 static void RemovePageValuesMatchingOpenTabs(
60 const std::set<std::string>& open_urls,
61 base::ListValue* pages_value);
62
63 private:
64 // Helper method to log the actions carried out by the Most Visited Tile
65 // Placement experiment.
66 static void LogInHistogram(NtpTileExperimentActions action);
67
68 DISALLOW_IMPLICIT_CONSTRUCTORS(MostVisitedTilesExperiment);
69 };
70
71 } // namespace history
72
73 #endif // CHROME_BROWSER_HISTORY_MOST_VISITED_TILES_EXPERIMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698