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

Unified Diff: chrome/browser/instant/instant_controller.cc

Issue 7337007: Introduce a field trial for Instant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 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/browser/instant/instant_controller.cc
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc
index c25f62c1f046ce60793b5e27d925b8d9294dda9f..6b5f40734df8a20c96f8b28852899d8495312c2a 100644
--- a/chrome/browser/instant/instant_controller.cc
+++ b/chrome/browser/instant/instant_controller.cc
@@ -10,6 +10,7 @@
#include "build/build_config.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/instant/instant_delegate.h"
+#include "chrome/browser/instant/instant_field_trial.h"
#include "chrome/browser/instant/instant_loader.h"
#include "chrome/browser/instant/instant_loader_manager.h"
#include "chrome/browser/instant/promo_counter.h"
@@ -49,9 +50,9 @@ InstantController::InstantController(Profile* profile,
last_transition_type_(PageTransition::LINK),
ALLOW_THIS_IN_INITIALIZER_LIST(destroy_factory_(this)) {
PrefService* service = profile->GetPrefs();
- if (service) {
- // kInstantWasEnabledOnce was added after instant, set it now to make sure
- // it is correctly set.
+ if (service && !instant_field_trial::IsExperiment(profile)) {
+ // kInstantEnabledOnce was added after instant, set it now to make sure it
+ // is correctly set.
service->SetBoolean(prefs::kInstantEnabledOnce, true);
}
}
@@ -100,7 +101,8 @@ void InstantController::RecordMetrics(Profile* profile) {
// static
bool InstantController::IsEnabled(Profile* profile) {
PrefService* prefs = profile->GetPrefs();
- return prefs->GetBoolean(prefs::kInstantEnabled);
+ return prefs->GetBoolean(prefs::kInstantEnabled) ||
+ instant_field_trial::IsExperiment(profile);
}
// static
@@ -704,7 +706,8 @@ InstantController::PreviewCondition InstantController::GetPreviewConditionFor(
return PREVIEW_CONDITION_BLACKLISTED;
const CommandLine* cl = CommandLine::ForCurrentProcess();
- if (cl->HasSwitch(switches::kRestrictInstantToSearch) &&
+ if ((cl->HasSwitch(switches::kRestrictInstantToSearch) ||
+ instant_field_trial::IsExperiment(tab_contents_->profile())) &&
match.type != AutocompleteMatch::SEARCH_WHAT_YOU_TYPED &&
match.type != AutocompleteMatch::SEARCH_HISTORY &&
match.type != AutocompleteMatch::SEARCH_SUGGEST &&

Powered by Google App Engine
This is Rietveld 408576698