Chromium Code Reviews| OLD | NEW |
|---|---|
| (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; | |
|
Alexei Svitkine (slow)
2013/07/24 21:04:31
This comes from base/values.h, either remove the #
annark1
2013/07/24 21:51:40
Done.
| |
| 13 class InstantMostVisitedItem; | |
|
Alexei Svitkine (slow)
2013/07/24 21:04:31
You're already including instant_types.h, so no ne
annark1
2013/07/24 21:51:40
Done.
| |
| 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 // Helper method to shuffle MostVisited tiles for A/B testing purposes. | |
| 32 static void MaybeShuffle(MostVisitedURLList* data); | |
| 33 | |
| 34 // Returns true if this user is part of the Most Visited Tile Placement | |
| 35 // experiment group where URLs currently open in another browser tab are not | |
| 36 // displayed on an NTP tile. Note: the experiment targets only the top-level | |
| 37 // of sites i.e. if www.foo.com/bar is open in browser, and www.foo.com is a | |
| 38 // recommended URL, www.foo.com will still appear on the next NTP open. The | |
| 39 // experiment will not remove a URL if doing so would cause the number of Most | |
| 40 // Visited recommendations to drop below eight. | |
| 41 static bool IsDontShowOpenURLsEnabled(); | |
| 42 | |
| 43 // Removes URLs already open in browser, for 1993 clients, if part of | |
| 44 // experiment described for IsDontShowOpenURLsEnabled(). | |
| 45 static void RemoveItemsMatchingOpenTabs( | |
| 46 const std::set<std::string>& open_urls, | |
| 47 std::vector<InstantMostVisitedItem>* items); | |
| 48 | |
| 49 // Removes URLs already open in browser, for non-1993 clients, if part of | |
| 50 // experiment described for IsDontShowOpenURLsEnabled(). | |
| 51 static void RemovePageValuesMatchingOpenTabs( | |
| 52 const std::set<std::string>& open_urls, | |
| 53 base::ListValue* pages_value); | |
| 54 | |
| 55 private: | |
| 56 // Helper method to log the actions carried out by the Most Visited Tile | |
| 57 // Placement experiment. | |
| 58 static void LogInHistogram(NtpTileExperimentActions action); | |
| 59 | |
| 60 // Helper method to determine whether |url| is in |open_urls|. | |
| 61 static bool ShouldRemoveURL(const std::set<std::string>& open_urls, | |
| 62 const std::string& url, | |
| 63 const size_t size); | |
| 64 | |
| 65 DISALLOW_IMPLICIT_CONSTRUCTORS(MostVisitedTilesExperiment); | |
| 66 }; | |
| 67 | |
| 68 } // namespace history | |
| 69 | |
| 70 #endif // CHROME_BROWSER_HISTORY_MOST_VISITED_TILES_EXPERIMENT_H_ | |
| OLD | NEW |