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

Unified Diff: chrome/installer/util/user_experiment.h

Issue 12321061: Pulling user experiment code from BrowserDistribution to a new class. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Updating .gypi to fix compile error. Created 7 years, 10 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
Index: chrome/installer/util/user_experiment.h
diff --git a/chrome/installer/util/user_experiment.h b/chrome/installer/util/user_experiment.h
new file mode 100644
index 0000000000000000000000000000000000000000..919e2cefc4d137334b45d9f08af59563952df116
--- /dev/null
+++ b/chrome/installer/util/user_experiment.h
@@ -0,0 +1,94 @@
+// Copyright 2013 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.
+//
+// This files declares a class that contains methods and data to conduct
+// for user expeirments.
+
+#ifndef CHROME_INSTALLER_UTIL_USER_EXPERIMENT_H_
+#define CHROME_INSTALLER_UTIL_USER_EXPERIMENT_H_
+
+#include "base/string16.h"
+#include "chrome/installer/util/browser_distribution.h"
+#include "chrome/installer/util/util_constants.h"
+
+class BrowserDistribution;
+class Version;
+
+namespace base {
+class FilePath;
+}
+
+namespace installer {
+
+class Product;
+
+namespace user_experiment {
+
+class UserExperiment {
grt (UTC plus 2) 2013/02/26 02:42:09 my apologies for not being clear in my previous re
huangs 2013/02/26 03:22:25 Ah yes, I misread. Done.
+ public:
+
+ enum ExperimentCode {
+ kExperimentAny, // Whether or not any experiment is supported.
+ kExperimentInactiveUserToast,
+ };
+
+ // Flags to control what to show in the UserExperiment dialog.
+ enum ToastUIflags {
+ kUninstall = 1, // Uninstall radio button.
gab 2013/02/25 22:09:53 s/1/1 << 0
huangs 2013/02/26 03:22:25 s/$/\//. :) Done.
+ kDontBugMeAsButton = 2, // Don't bug me is a button, not a radio button.
gab 2013/02/25 22:09:53 s/2/1 << 1
huangs 2013/02/26 03:22:25 Done.
+ kWhyLink = 4, // Has the 'why I am seeing this' link.
gab 2013/02/25 22:09:53 s/4/1 << 2
huangs 2013/02/26 03:22:25 Done.
+ kMakeDefault = 8, // Has the 'make it default' checkbox.
gab 2013/02/25 22:09:53 s/8/1 << 3 This is how bitfields are usually writ
huangs 2013/02/26 03:22:25 Done.
+ };
+
+ // A struct for communicating what a UserExperiment contains. In these
+ // experiments we show toasts to the user if they are inactive for a certain
+ // amount of time.
+ struct ExperimentDetails {
+ string16 prefix; // The experiment code prefix for this experiment,
+ // also known as the 'TV' part in 'TV80'.
+ int flavor; // The flavor index for this experiment.
+ int heading; // The heading resource ID to use for this experiment.
+ int flags; // See ToastUIFlags above.
+ int control_group; // Size of the control group (in percentages). Control
+ // group is the group that qualifies for the
+ // experiment but does not participate.
+ };
+
+ UserExperiment();
+
+ static bool IsExperimentSupported(BrowserDistribution::Type type,
+ ExperimentCode code);
+
+ // Creates the experiment details for a given language-brand combo.
+ // If |flavor| is -1, then a flavor will be selected at random. |experiment|
+ // is the struct you want to write the experiment information to.
+ // Returns false if no experiment details could be gathered.
+ static bool CreateExperimentDetails(int flavor,
+ ExperimentDetails* experiment);
+
+ // After an install or upgrade the user might qualify to participate in an
+ // experiment. This function determines if the user qualifies and if so it
+ // sets the wheels in motion or in simple cases does the experiment itself.
+ static void LaunchUserExperiment(const base::FilePath& setup_path,
+ InstallStatus status,
+ const Version& version,
+ const Product& product,
+ bool system_level);
+
+ // The user has qualified for the inactive user toast experiment and this
+ // function just performs it.
+ static void InactiveUserToastExperiment(
+ BrowserDistribution* dist,
+ int flavor,
+ const string16& experiment_group,
+ const Product& installation,
+ const base::FilePath& application_path);
+
+};
+
+} // namespace user_experiment
+
+} // namespace installer
+
+#endif // CHROME_INSTALLER_UTIL_USER_EXPERIMENT_H_

Powered by Google App Engine
This is Rietveld 408576698