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

Unified Diff: chrome/browser/history/top_sites_factory.cc

Issue 1809603005: Create a --disable-top-sites flag for use by telemetry tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move flag check to factory Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/history/top_sites_factory.h ('k') | components/history/core/browser/top_sites_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/top_sites_factory.cc
diff --git a/chrome/browser/history/top_sites_factory.cc b/chrome/browser/history/top_sites_factory.cc
index b85e843173f61520960648c100ff9ddccd31d5a8..66cdfbc22c52a6ab7132cddfd2ffb634d6a5a22d 100644
--- a/chrome/browser/history/top_sites_factory.cc
+++ b/chrome/browser/history/top_sites_factory.cc
@@ -7,6 +7,7 @@
#include <stddef.h>
#include "base/bind.h"
+#include "base/command_line.h"
#include "base/macros.h"
#include "base/memory/singleton.h"
#include "build/build_config.h"
@@ -27,6 +28,12 @@
namespace {
+const char kDisableTopSites[] = "disable-top-sites";
+
+bool IsTopSitesDisabled() {
+ return base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableTopSites);
+}
+
struct RawPrepopulatedPage {
int url_id; // The resource for the page URL.
int title_id; // The resource for the page title.
@@ -76,6 +83,8 @@ void InitializePrepopulatedPageList(
// static
scoped_refptr<history::TopSites> TopSitesFactory::GetForProfile(
Profile* profile) {
+ if (IsTopSitesDisabled())
+ return nullptr;
return static_cast<history::TopSites*>(
GetInstance()->GetServiceForBrowserContext(profile, true).get());
}
« no previous file with comments | « chrome/browser/history/top_sites_factory.h ('k') | components/history/core/browser/top_sites_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698