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

Side by Side Diff: chrome/browser/instant/instant_controller.cc

Issue 8588003: Add a new field trial for Instant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/instant/instant_controller.h" 5 #include "chrome/browser/instant/instant_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 void InstantController::InstantStatusChanged(InstantLoader* loader) { 417 void InstantController::InstantStatusChanged(InstantLoader* loader) {
418 DCHECK(loader_.get()); 418 DCHECK(loader_.get());
419 UpdateIsDisplayable(); 419 UpdateIsDisplayable();
420 } 420 }
421 421
422 void InstantController::SetSuggestedTextFor( 422 void InstantController::SetSuggestedTextFor(
423 InstantLoader* loader, 423 InstantLoader* loader,
424 const string16& text, 424 const string16& text,
425 InstantCompleteBehavior behavior) { 425 InstantCompleteBehavior behavior) {
426 if (!is_out_of_date_ && 426 if (!is_out_of_date_ &&
427 !InstantFieldTrial::IsHiddenExperiment(tab_contents_->profile())) { 427 InstantFieldTrial::ShouldSetSuggestedText(tab_contents_->profile())) {
428 delegate_->SetSuggestedText(text, behavior); 428 delegate_->SetSuggestedText(text, behavior);
429 } 429 }
430 } 430 }
431 431
432 gfx::Rect InstantController::GetInstantBounds() { 432 gfx::Rect InstantController::GetInstantBounds() {
433 return delegate_->GetInstantBounds(); 433 return delegate_->GetInstantBounds();
434 } 434 }
435 435
436 bool InstantController::ShouldCommitInstantOnMouseUp() { 436 bool InstantController::ShouldCommitInstantOnMouseUp() {
437 return commit_on_mouse_up_; 437 return commit_on_mouse_up_;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 } 490 }
491 } 491 }
492 492
493 void InstantController::UpdateLoader(const TemplateURL* template_url, 493 void InstantController::UpdateLoader(const TemplateURL* template_url,
494 const GURL& url, 494 const GURL& url,
495 content::PageTransition transition_type, 495 content::PageTransition transition_type,
496 const string16& user_text, 496 const string16& user_text,
497 bool verbatim, 497 bool verbatim,
498 string16* suggested_text) { 498 string16* suggested_text) {
499 is_out_of_date_ = false; 499 is_out_of_date_ = false;
500 bool hidden = InstantFieldTrial::IsHiddenExperiment(tab_contents_->profile()); 500 if (!InstantFieldTrial::IsHiddenExperiment(tab_contents_->profile()))
501 if (!hidden)
502 loader_->SetOmniboxBounds(omnibox_bounds_); 501 loader_->SetOmniboxBounds(omnibox_bounds_);
503 loader_->Update(tab_contents_, template_url, url, transition_type, user_text, 502 loader_->Update(tab_contents_, template_url, url, transition_type, user_text,
504 verbatim, suggested_text); 503 verbatim, suggested_text);
505 UpdateIsDisplayable(); 504 UpdateIsDisplayable();
506 // For the HIDDEN and SILENT field trials, don't send back suggestions. 505 // For the HIDDEN and SILENT field trials, don't send back suggestions.
507 if (hidden) 506 if (!InstantFieldTrial::ShouldSetSuggestedText(tab_contents_->profile()))
508 suggested_text->clear(); 507 suggested_text->clear();
509 } 508 }
510 509
511 bool InstantController::ShouldUseInstant(const AutocompleteMatch& match) { 510 bool InstantController::ShouldUseInstant(const AutocompleteMatch& match) {
512 TemplateURLService* model = TemplateURLServiceFactory::GetForProfile( 511 TemplateURLService* model = TemplateURLServiceFactory::GetForProfile(
513 tab_contents_->profile()); 512 tab_contents_->profile());
514 if (!model) 513 if (!model)
515 return false; 514 return false;
516 515
517 const TemplateURL* default_t_url = model->GetDefaultSearchProvider(); 516 const TemplateURL* default_t_url = model->GetDefaultSearchProvider();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 if (destroy_factory_.empty()) { 553 if (destroy_factory_.empty()) {
555 MessageLoop::current()->PostTask( 554 MessageLoop::current()->PostTask(
556 FROM_HERE, destroy_factory_.NewRunnableMethod( 555 FROM_HERE, destroy_factory_.NewRunnableMethod(
557 &InstantController::DestroyLoaders)); 556 &InstantController::DestroyLoaders));
558 } 557 }
559 } 558 }
560 559
561 void InstantController::DestroyLoaders() { 560 void InstantController::DestroyLoaders() {
562 loaders_to_destroy_.reset(); 561 loaders_to_destroy_.reset();
563 } 562 }
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_browsertest.cc ('k') | chrome/browser/instant/instant_field_trial.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698