summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser_main.cc1
-rw-r--r--chrome/browser/first_run.h4
-rw-r--r--chrome/browser/first_run_gtk.cc1
-rw-r--r--chrome/browser/first_run_mac.mm1
-rw-r--r--chrome/browser/first_run_win.cc11
-rw-r--r--chrome/browser/views/first_run_customize_view.cc21
-rw-r--r--chrome/browser/views/first_run_customize_view.h1
-rw-r--r--chrome/browser/views/first_run_search_engine_view.cc16
-rw-r--r--chrome/browser/views/first_run_search_engine_view.h8
-rw-r--r--chrome/browser/views/first_run_view.cc18
-rw-r--r--chrome/browser/views/first_run_view.h8
-rw-r--r--chrome/browser/views/first_run_view_base.cc6
-rw-r--r--chrome/browser/views/first_run_view_base.h4
-rw-r--r--chrome/installer/util/master_preferences_constants.cc6
-rw-r--r--chrome/installer/util/master_preferences_constants.h2
15 files changed, 79 insertions, 29 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 361be11..9bec9f2 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -1205,6 +1205,7 @@ int BrowserMain(const MainFunctionParams& parameters) {
master_prefs.do_import_items,
master_prefs.dont_import_items,
master_prefs.run_search_engine_experiment,
+ master_prefs.randomize_search_engine_experiment,
&process_singleton)) {
// The user cancelled the first run dialog box, we should exit Chrome.
return ResultCodes::NORMAL_EXIT;
diff --git a/chrome/browser/first_run.h b/chrome/browser/first_run.h
index 92c80c0..6994855 100644
--- a/chrome/browser/first_run.h
+++ b/chrome/browser/first_run.h
@@ -44,6 +44,7 @@ class FirstRun {
int do_import_items;
int dont_import_items;
bool run_search_engine_experiment;
+ bool randomize_search_engine_experiment;
std::vector<GURL> new_tabs;
std::vector<GURL> bookmarks;
};
@@ -262,6 +263,8 @@ class FirstRunImportObserver : public ImportObserver {
// preferences and will override default behavior of importer.
// |search_engine_experiment| indicates whether the experimental search engine
// window should be shown.
+// |randomize_search_engine_experiment| is true if the logos in the search
+// engine window should be shown in randomized order.
// Returns true if the user clicked "Start", false if the user pressed "Cancel"
// or closed the dialog.
bool OpenFirstRunDialog(Profile* profile,
@@ -269,6 +272,7 @@ bool OpenFirstRunDialog(Profile* profile,
int import_items,
int dont_import_items,
bool search_engine_experiment,
+ bool randomize_search_engine_experiment,
ProcessSingleton* process_singleton);
#endif // CHROME_BROWSER_FIRST_RUN_H_
diff --git a/chrome/browser/first_run_gtk.cc b/chrome/browser/first_run_gtk.cc
index 202d095..c35063d 100644
--- a/chrome/browser/first_run_gtk.cc
+++ b/chrome/browser/first_run_gtk.cc
@@ -25,6 +25,7 @@ bool OpenFirstRunDialog(Profile* profile, bool homepage_defined,
int import_items,
int dont_import_items,
bool search_engine_experiment,
+ bool randomize_search_engine_experiment,
ProcessSingleton* process_singleton) {
return FirstRunDialog::Show(profile, process_singleton);
}
diff --git a/chrome/browser/first_run_mac.mm b/chrome/browser/first_run_mac.mm
index 3a73403..948e806 100644
--- a/chrome/browser/first_run_mac.mm
+++ b/chrome/browser/first_run_mac.mm
@@ -51,6 +51,7 @@ bool OpenFirstRunDialog(Profile* profile,
int import_items,
int dont_import_items,
bool search_engine_experiment,
+ bool randomize_search_engine_experiment,
ProcessSingleton* process_singleton) {
FirstRunController* controller = new FirstRunController;
return controller->DoFirstRun(profile, process_singleton);
diff --git a/chrome/browser/first_run_win.cc b/chrome/browser/first_run_win.cc
index fc1e0cc..512385c 100644
--- a/chrome/browser/first_run_win.cc
+++ b/chrome/browser/first_run_win.cc
@@ -324,6 +324,13 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
&value) && value) {
// Set the first run dialog to include the search choice window.
out_prefs->run_search_engine_experiment = true;
+ // Check to see if search engine logos should be randomized.
+ if (installer_util::GetDistroBooleanPreference(prefs.get(),
+ installer_util::master_preferences::
+ kSearchEngineExperimentRandomizePref,
+ &value) && value) {
+ out_prefs->randomize_search_engine_experiment = true;
+ }
// Set the first run bubble to minimal.
FirstRun::SetMinimalFirstRunBubblePref();
}
@@ -491,6 +498,7 @@ bool OpenFirstRunDialog(Profile* profile,
int import_items,
int dont_import_items,
bool search_engine_experiment,
+ bool randomize_search_engine_experiment,
ProcessSingleton* process_singleton) {
DCHECK(profile);
DCHECK(process_singleton);
@@ -502,7 +510,8 @@ bool OpenFirstRunDialog(Profile* profile,
homepage_defined,
import_items,
dont_import_items,
- search_engine_experiment));
+ search_engine_experiment,
+ randomize_search_engine_experiment));
first_run_view->set_parent_owned(false);
views::Window* first_run_ui = views::Window::CreateChromeWindow(
NULL, gfx::Rect(), first_run_view.get());
diff --git a/chrome/browser/views/first_run_customize_view.cc b/chrome/browser/views/first_run_customize_view.cc
index 503d75a..cbaab1d 100644
--- a/chrome/browser/views/first_run_customize_view.cc
+++ b/chrome/browser/views/first_run_customize_view.cc
@@ -22,16 +22,19 @@
#include "views/standard_layout.h"
#include "views/window/window.h"
-FirstRunCustomizeView::FirstRunCustomizeView(Profile* profile,
- ImporterHost* importer_host,
- CustomizeViewObserver* observer,
- bool default_browser_checked,
- bool homepage_defined,
- int import_items,
- int dont_import_items,
- bool search_engine_experiment)
+FirstRunCustomizeView::FirstRunCustomizeView(
+ Profile* profile,
+ ImporterHost* importer_host,
+ CustomizeViewObserver* observer,
+ bool default_browser_checked,
+ bool homepage_defined,
+ int import_items,
+ int dont_import_items,
+ bool search_engine_experiment,
+ bool randomize_search_engine_experiment)
: FirstRunViewBase(profile, homepage_defined, import_items,
- dont_import_items, search_engine_experiment),
+ dont_import_items, search_engine_experiment,
+ randomize_search_engine_experiment),
main_label_(NULL),
import_cbox_(NULL),
import_from_combo_(NULL),
diff --git a/chrome/browser/views/first_run_customize_view.h b/chrome/browser/views/first_run_customize_view.h
index ecc3a7aa..11ee459 100644
--- a/chrome/browser/views/first_run_customize_view.h
+++ b/chrome/browser/views/first_run_customize_view.h
@@ -43,6 +43,7 @@ class FirstRunCustomizeView : public FirstRunViewBase,
bool homepage_defined,
int import_items,
int dont_import_items,
+ bool randomize_search_engine_experiment,
bool search_engine_experiment);
virtual ~FirstRunCustomizeView();
diff --git a/chrome/browser/views/first_run_search_engine_view.cc b/chrome/browser/views/first_run_search_engine_view.cc
index f1eef9f..90b8ac0 100644
--- a/chrome/browser/views/first_run_search_engine_view.cc
+++ b/chrome/browser/views/first_run_search_engine_view.cc
@@ -4,11 +4,13 @@
#include "chrome/browser/views/first_run_search_engine_view.h"
+#include <algorithm>
#include <map>
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/i18n/rtl.h"
+#include "base/time.h"
#include "chrome/browser/options_window.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url.h"
@@ -29,6 +31,7 @@
#include "views/view_text_utils.h"
#include "views/window/window.h"
+using base::Time;
using TemplateURLPrepopulateData::SearchEngineType;
namespace {
@@ -156,10 +159,11 @@ void SearchEngineChoice::SetChoiceViewBounds(int x, int y, int width,
}
FirstRunSearchEngineView::FirstRunSearchEngineView(
- SearchEngineSelectionObserver* observer, Profile* profile)
+ SearchEngineSelectionObserver* observer, Profile* profile, bool randomize)
: profile_(profile),
observer_(observer),
- text_direction_is_rtl_(base::i18n::IsRTL()) {
+ text_direction_is_rtl_(base::i18n::IsRTL()),
+ randomize_(randomize) {
DCHECK(observer);
// Don't show ourselves until all the search engines have loaded from
// the profile -- otherwise we have nothing to show.
@@ -250,6 +254,14 @@ void FirstRunSearchEngineView::OnTemplateURLModelChanged() {
AddChildView(default_choice); // The button associated with the choice.
}
+ // Randomize order of logos if option has been set.
+ if (randomize_) {
+ int seed = static_cast<int>(Time::Now().ToInternalValue());
+ srand(seed);
+ std::random_shuffle(search_engine_choices_.begin(),
+ search_engine_choices_.end());
+ }
+
// Now that we know how many logos to show, lay out and become visible.
SetVisible(true);
Layout();
diff --git a/chrome/browser/views/first_run_search_engine_view.h b/chrome/browser/views/first_run_search_engine_view.h
index b012e22..774c682 100644
--- a/chrome/browser/views/first_run_search_engine_view.h
+++ b/chrome/browser/views/first_run_search_engine_view.h
@@ -85,9 +85,10 @@ class FirstRunSearchEngineView
public:
// |observer| is the FirstRunView that waits for us to pass back a search
// engine choice; |profile| allows us to get the set of imported search
- // engines, and display the KeywordEditorView on demand.
+ // engines, and display the KeywordEditorView on demand; |randomize|
+ // is true if logos are to be displayed in random order.
FirstRunSearchEngineView(SearchEngineSelectionObserver* observer,
- Profile* profile);
+ Profile* profile, bool randomize);
virtual ~FirstRunSearchEngineView();
@@ -133,6 +134,9 @@ class FirstRunSearchEngineView
bool text_direction_is_rtl_;
+ // If logos are to be displayed in random order. Used for UX testing.
+ bool randomize_;
+
// UI elements:
// Text above the first horizontal separator
views::Label* title_label_;
diff --git a/chrome/browser/views/first_run_view.cc b/chrome/browser/views/first_run_view.cc
index 23eb645..209c9be 100644
--- a/chrome/browser/views/first_run_view.cc
+++ b/chrome/browser/views/first_run_view.cc
@@ -40,9 +40,11 @@ std::wstring AddBullet(const std::wstring& text) {
FirstRunView::FirstRunView(Profile* profile, bool homepage_defined,
int import_items, int dont_import_items,
- bool search_engine_experiment)
+ bool search_engine_experiment,
+ bool randomize_search_engine_experiment)
: FirstRunViewBase(profile, homepage_defined, import_items,
- dont_import_items, search_engine_experiment),
+ dont_import_items, search_engine_experiment,
+ randomize_search_engine_experiment),
welcome_label_(NULL),
actions_label_(NULL),
actions_import_(NULL),
@@ -186,15 +188,17 @@ void FirstRunView::OpenCustomizeDialog() {
homepage_defined_,
import_items_,
dont_import_items_,
- search_engine_experiment_))->Show();
+ search_engine_experiment_,
+ randomize_search_engine_experiment_))->Show();
}
-void FirstRunView::OpenSearchEngineDialog() {
+void FirstRunView::OpenSearchEngineDialog(bool randomize) {
views::Window::CreateChromeWindow(
window()->GetNativeWindow(),
gfx::Rect(),
new FirstRunSearchEngineView(this,
- profile_))->Show();
+ profile_,
+ randomize))->Show();
}
void FirstRunView::LinkActivated(views::Link* source, int event_flags) {
@@ -229,7 +233,7 @@ bool FirstRunView::Accept() {
// Launch the search engine dialog.
if (search_engine_experiment_) {
- OpenSearchEngineDialog();
+ OpenSearchEngineDialog(randomize_search_engine_experiment_);
// Leave without shutting down; we'll observe the search engine dialog and
// shut down after it closes.
return false;
@@ -251,7 +255,7 @@ bool FirstRunView::Cancel() {
// the work is done there we have nothing else to do.
void FirstRunView::CustomizeAccepted() {
if (search_engine_experiment_) {
- OpenSearchEngineDialog();
+ OpenSearchEngineDialog(randomize_search_engine_experiment_);
// We'll shut down after search engine has been chosen.
return;
}
diff --git a/chrome/browser/views/first_run_view.h b/chrome/browser/views/first_run_view.h
index 05a8a09..bab3581f 100644
--- a/chrome/browser/views/first_run_view.h
+++ b/chrome/browser/views/first_run_view.h
@@ -30,7 +30,8 @@ class FirstRunView : public FirstRunViewBase,
public:
explicit FirstRunView(Profile* profile, bool homepage_defined,
int import_items, int dont_import_items,
- bool search_engine_experiment);
+ bool search_engine_experiment,
+ bool randomize_search_engine_experiment);
virtual ~FirstRunView();
bool accepted() const { return accepted_;}
@@ -64,8 +65,9 @@ class FirstRunView : public FirstRunViewBase,
// Creates the dialog that allows the user to customize work items.
void OpenCustomizeDialog();
- // Creates the search engine selection dialog.
- void OpenSearchEngineDialog();
+ // Creates the search engine selection dialog. If |randomize|, the display
+ // of search engine logos should be randomized.
+ void OpenSearchEngineDialog(bool randomize);
views::Label* welcome_label_;
views::Label* actions_label_;
diff --git a/chrome/browser/views/first_run_view_base.cc b/chrome/browser/views/first_run_view_base.cc
index 47897cf..474c569 100644
--- a/chrome/browser/views/first_run_view_base.cc
+++ b/chrome/browser/views/first_run_view_base.cc
@@ -34,7 +34,8 @@
FirstRunViewBase::FirstRunViewBase(Profile* profile, bool homepage_defined,
int import_items, int dont_import_items,
- bool search_engine_experiment)
+ bool search_engine_experiment,
+ bool randomize_search_engine_experiment)
: preferred_width_(0),
background_image_(NULL),
separator_1_(NULL),
@@ -46,7 +47,8 @@ FirstRunViewBase::FirstRunViewBase(Profile* profile, bool homepage_defined,
homepage_defined_(homepage_defined),
import_items_(import_items),
dont_import_items_(dont_import_items),
- search_engine_experiment_(search_engine_experiment) {
+ search_engine_experiment_(search_engine_experiment),
+ randomize_search_engine_experiment_(randomize_search_engine_experiment) {
DCHECK(profile);
SetupControls();
}
diff --git a/chrome/browser/views/first_run_view_base.h b/chrome/browser/views/first_run_view_base.h
index 31b57b4..9198e22 100644
--- a/chrome/browser/views/first_run_view_base.h
+++ b/chrome/browser/views/first_run_view_base.h
@@ -30,7 +30,8 @@ class FirstRunViewBase : public views::View,
public:
explicit FirstRunViewBase(Profile* profile, bool homepage_defined,
int import_items, int dont_import_items,
- bool search_engine_experiment);
+ bool search_engine_experiment,
+ bool randomize_search_engine_experiment);
virtual ~FirstRunViewBase();
// Overridden from views::View.
@@ -94,6 +95,7 @@ class FirstRunViewBase : public views::View,
int import_items_;
int dont_import_items_;
bool search_engine_experiment_;
+ bool randomize_search_engine_experiment_;
private:
// Initializes the controls on the dialog.
diff --git a/chrome/installer/util/master_preferences_constants.cc b/chrome/installer/util/master_preferences_constants.cc
index aa7c900..8dd7063 100644
--- a/chrome/installer/util/master_preferences_constants.cc
+++ b/chrome/installer/util/master_preferences_constants.cc
@@ -13,7 +13,7 @@ namespace master_preferences {
const wchar_t kCreateAllShortcuts[] = L"create_all_shortcuts";
const wchar_t kDistroImportBookmarksPref[] = L"import_bookmarks";
const wchar_t kDistroImportBookmarksFromFilePref[] =
- L"import_bookmarks_from_file";
+ L"import_bookmarks_from_file";
const wchar_t kDistroImportHistoryPref[] = L"import_history";
const wchar_t kDistroImportHomePagePref[] = L"import_home_page";
const wchar_t kDistroImportSearchPref[] = L"import_search_engine";
@@ -23,12 +23,14 @@ namespace master_preferences {
const wchar_t kDoNotCreateShortcuts[] = L"do_not_create_shortcuts";
const wchar_t kDoNotLaunchChrome[] = L"do_not_launch_chrome";
const wchar_t kDoNotRegisterForUpdateLaunch[] =
- L"do_not_register_for_update_launch";
+ L"do_not_register_for_update_launch";
const wchar_t kMakeChromeDefault[] = L"make_chrome_default";
const wchar_t kMakeChromeDefaultForUser[] = L"make_chrome_default_for_user";
const wchar_t kMsi[] = L"msi";
const wchar_t kRequireEula[] = L"require_eula";
const wchar_t kSearchEngineExperimentPref[] = L"search_engine_experiment";
+ const wchar_t kSearchEngineExperimentRandomizePref[] =
+ L"search_engine_experiment_randomize";
const wchar_t kSystemLevel[] = L"system_level";
const wchar_t kVerboseLogging[] = L"verbose_logging";
const wchar_t kExtensionsBlock[] = L"extensions.settings";
diff --git a/chrome/installer/util/master_preferences_constants.h b/chrome/installer/util/master_preferences_constants.h
index 6c5843a..ed2fe1f 100644
--- a/chrome/installer/util/master_preferences_constants.h
+++ b/chrome/installer/util/master_preferences_constants.h
@@ -65,6 +65,8 @@ extern const wchar_t kVerboseLogging[];
extern const wchar_t kExtensionsBlock[];
// Boolean. Use experimental search engine selection dialog.
extern const wchar_t kSearchEngineExperimentPref[];
+// Boolean. Randomize logos in experimental search engine selection dialog.
+extern const wchar_t kSearchEngineExperimentRandomizePref[];
}
}