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

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

Issue 8370020: Add a new field trial for Instant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed @sky's comments Created 9 years, 2 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/instant/instant_controller.h ('k') | chrome/browser/instant/instant_field_trial.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/instant/instant_controller.cc
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc
index ffbfc3e855cdebcca4f7ce391336118fa136bdee..22bbd069968d028b8910caaee50b71073dee0c60 100644
--- a/chrome/browser/instant/instant_controller.cc
+++ b/chrome/browser/instant/instant_controller.cc
@@ -175,8 +175,8 @@ bool InstantController::Update(TabContentsWrapper* tab_contents,
// trial to normal mode, with no intervening call to DestroyPreviewContents().
// This would leave the loader in a weird state, which would manifest if the
// user pressed <Enter> without calling Update(). TODO(sreeram): Handle it.
- if (InstantFieldTrial::IsHiddenExperiment(tab_contents->profile())) {
- // For the HIDDEN field trial we process |user_text| at commit time, which
+ if (InstantFieldTrial::IsSilentExperiment(tab_contents->profile())) {
+ // For the SILENT field trial we process |user_text| at commit time, which
// means we're never really out of date.
is_out_of_date_ = false;
loader_->MaybeLoadInstantURL(tab_contents, template_url);
@@ -236,9 +236,12 @@ bool InstantController::PrepareForCommit() {
if (is_out_of_date_ || !loader_.get())
return false;
- // If we are not in the HIDDEN field trial, return the status of the preview.
- if (!InstantFieldTrial::IsHiddenExperiment(tab_contents_->profile()))
+ // If we are not in the HIDDEN or SILENT field trials, return the status of
+ // the preview.
+ if (!InstantFieldTrial::IsHiddenExperiment(tab_contents_->profile()) &&
+ !InstantFieldTrial::IsSilentExperiment(tab_contents_->profile())) {
return IsCurrent();
+ }
TemplateURLService* model = TemplateURLServiceFactory::GetForProfile(
tab_contents_->profile());
@@ -419,7 +422,10 @@ void InstantController::SetSuggestedTextFor(
InstantLoader* loader,
const string16& text,
InstantCompleteBehavior behavior) {
- delegate_->SetSuggestedText(text, behavior);
+ if (!is_out_of_date_ &&
+ !InstantFieldTrial::IsHiddenExperiment(tab_contents_->profile())) {
+ delegate_->SetSuggestedText(text, behavior);
+ }
}
gfx::Rect InstantController::GetInstantBounds() {
@@ -460,6 +466,11 @@ void InstantController::SwappedTabContents(InstantLoader* loader) {
}
void InstantController::UpdateIsDisplayable() {
+ if (!is_out_of_date_ &&
+ InstantFieldTrial::IsHiddenExperiment(tab_contents_->profile())) {
+ return;
+ }
+
bool displayable =
(!is_out_of_date_ && loader_.get() && loader_->ready() &&
loader_->http_status_ok());
@@ -489,6 +500,9 @@ void InstantController::UpdateLoader(const TemplateURL* template_url,
loader_->Update(tab_contents_, template_url, url, transition_type, user_text,
verbatim, suggested_text);
UpdateIsDisplayable();
+ // For the HIDDEN field trial, don't send back suggestions to the omnibox.
+ if (InstantFieldTrial::IsHiddenExperiment(tab_contents_->profile()))
+ suggested_text->clear();
}
bool InstantController::ShouldUseInstant(const AutocompleteMatch& match) {
« no previous file with comments | « chrome/browser/instant/instant_controller.h ('k') | chrome/browser/instant/instant_field_trial.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698