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

Unified Diff: chrome/browser/ui/webui/ntp/new_tab_ui.cc

Issue 9303005: [NTP4] Experiment for adding Chrome Web Store link to footer. (Closed)
Patch Set: rebase Created 8 years, 11 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/ui/webui/ntp/new_tab_ui.h ('k') | chrome/browser/ui/webui/ntp/ntp_resource_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/ntp/new_tab_ui.cc
diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.cc b/chrome/browser/ui/webui/ntp/new_tab_ui.cc
index 23a2bb95aa63ff3cee1c40b7004bb9a838a9ad78..1e32af482da3418018515f35303333d4bdd6385e 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_ui.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_ui.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,6 +14,7 @@
#include "base/i18n/rtl.h"
#include "base/lazy_instance.h"
#include "base/memory/singleton.h"
+#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
#include "base/string_number_conversions.h"
#include "base/threading/thread.h"
@@ -23,8 +24,8 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_types.h"
#include "chrome/browser/sync/profile_sync_service.h"
-#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/themes/theme_service_factory.h"
+#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/webui/metrics_handler.h"
#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
@@ -34,8 +35,8 @@
#include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h"
#include "chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h"
#include "chrome/browser/ui/webui/ntp/ntp_login_handler.h"
-#include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
#include "chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.h"
+#include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
#include "chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.h"
#include "chrome/browser/ui/webui/theme_source.h"
#include "chrome/common/chrome_notification_types.h"
@@ -71,6 +72,9 @@ const char kLTRHtmlTextDirection[] = "ltr";
static base::LazyInstance<std::set<const WebUIController*> > g_live_new_tabs;
+// The Web Store footer experiment FieldTrial name.
+const char kWebStoreLinkExperiment[] = "WebStoreLinkExperiment";
+
} // namespace
///////////////////////////////////////////////////////////////////////////////
@@ -216,6 +220,33 @@ void NewTabUI::RegisterUserPrefs(PrefService* prefs) {
}
// static
+void NewTabUI::SetupFieldTrials() {
+ scoped_refptr<base::FieldTrial> trial(
+ new base::FieldTrial("WebStoreLinkExperiment", 1000, "Disabled",
+ 2012, 6, 1));
+
+ // Try to give the user a consistent experience, if possible.
+ if (base::FieldTrialList::IsOneTimeRandomizationEnabled())
+ trial->UseOneTimeRandomization();
+
+ // 4% in Enabled group.
+ trial->AppendGroup("Enabled", 40);
+}
+
+// static
+bool NewTabUI::IsWebStoreExperimentEnabled() {
+ const CommandLine* cli = CommandLine::ForCurrentProcess();
+ if (cli->HasSwitch(switches::kEnableWebStoreLink))
+ return true;
+
+ if (!base::FieldTrialList::TrialExists(kWebStoreLinkExperiment))
+ return false;
+
+ return base::FieldTrialList::FindValue(kWebStoreLinkExperiment) !=
+ base::FieldTrial::kDefaultGroupNumber;
+}
+
+// static
void NewTabUI::SetURLTitleAndDirection(DictionaryValue* dictionary,
const string16& title,
const GURL& gurl) {
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_ui.h ('k') | chrome/browser/ui/webui/ntp/ntp_resource_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698