Commit 6eff939e authored by sky@chromium.org's avatar sky@chromium.org

Removes different instant behaviors that are no longer used.

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/6245012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72692 0039d316-1c4b-4281-b951-d872f2087c98
parent a362e159
...@@ -3949,21 +3949,6 @@ Keep your key file in a safe place. You will need it to create new versions of y ...@@ -3949,21 +3949,6 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_FLAGS_INSTANT_AUTOCOMPLETE_IMMEDIATELY_DESCRIPTION" desc="Description of the 'Instant Autocomplete Immediately' lab."> <message name="IDS_FLAGS_INSTANT_AUTOCOMPLETE_IMMEDIATELY_DESCRIPTION" desc="Description of the 'Instant Autocomplete Immediately' lab.">
Whether the search provider suggestion should be autocompleted immediately when instant is enabled. Whether the search provider suggestion should be autocompleted immediately when instant is enabled.
</message> </message>
<message name="IDS_FLAGS_INSTANT_TYPE_NAME" desc="Description of the 'Instant Type' lab.">
Instant Type
</message>
<message name="IDS_FLAGS_INSTANT_TYPE_DESCRIPTION" desc="Description of the 'Instant Type' lab.">
Configures the behavior of instant.
</message>
<message name="IDS_FLAGS_INSTANT_TYPE_PREDICTIVE" desc="Name for 'predictive' instant results">
Predictive
</message>
<message name="IDS_FLAGS_INSTANT_TYPE_PREDICTIVE_NO_AUTO_COMPLETE" desc="Name for 'predictive no auto-complete' instant results">
Predictive no auto-complete
</message>
<message name="IDS_FLAGS_INSTANT_TYPE_VERBATIM" desc="Name for 'verbatim' instant results">
Verbatim
</message>
<message name="IDS_FLAGS_REMOTING_NAME" desc="Description of the 'Remoting' lab."> <message name="IDS_FLAGS_REMOTING_NAME" desc="Description of the 'Remoting' lab.">
Remoting Remoting
</message> </message>
......
...@@ -38,15 +38,6 @@ const char kMediaPlayerExperimentName[] = "media-player"; ...@@ -38,15 +38,6 @@ const char kMediaPlayerExperimentName[] = "media-player";
const char kAdvancedFileSystemExperimentName[] = "advanced-file-system"; const char kAdvancedFileSystemExperimentName[] = "advanced-file-system";
const char kVerticalTabsExperimentName[] = "vertical-tabs"; const char kVerticalTabsExperimentName[] = "vertical-tabs";
// If adding a new choice, add it to the end of the list.
const Experiment::Choice kInstantChoices[] = {
{ IDS_FLAGS_INSTANT_TYPE_VERBATIM, switches::kEnableVerbatimInstant },
{ IDS_FLAGS_INSTANT_TYPE_PREDICTIVE, switches::kEnablePredictiveInstant },
{ IDS_FLAGS_INSTANT_TYPE_PREDICTIVE_NO_AUTO_COMPLETE,
switches::kEnablePredictiveNoAutoCompleteInstant
},
};
// RECORDING USER METRICS FOR FLAGS: // RECORDING USER METRICS FOR FLAGS:
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// The first line of the experiment is the internal name. If you'd like to // The first line of the experiment is the internal name. If you'd like to
...@@ -250,13 +241,6 @@ const Experiment kExperiments[] = { ...@@ -250,13 +241,6 @@ const Experiment kExperiments[] = {
kOsMac | kOsWin | kOsLinux, // Currently does nothing on CrOS. kOsMac | kOsWin | kOsLinux, // Currently does nothing on CrOS.
SINGLE_VALUE_TYPE(switches::kExperimentalLocationFeatures) SINGLE_VALUE_TYPE(switches::kExperimentalLocationFeatures)
}, },
{
"instant-type", // FLAGS:RECORD_UMA
IDS_FLAGS_INSTANT_TYPE_NAME,
IDS_FLAGS_INSTANT_TYPE_DESCRIPTION,
kOsWin,
MULTI_VALUE_TYPE(kInstantChoices)
},
{ {
"instant-autocomplete-immediately", // FLAGS:RECORD_UMA "instant-autocomplete-immediately", // FLAGS:RECORD_UMA
IDS_FLAGS_INSTANT_AUTOCOMPLETE_IMMEDIATELY_NAME, IDS_FLAGS_INSTANT_AUTOCOMPLETE_IMMEDIATELY_NAME,
......
...@@ -765,8 +765,7 @@ void AutocompleteEditViewGtk::SetInstantSuggestion(const string16& suggestion) { ...@@ -765,8 +765,7 @@ void AutocompleteEditViewGtk::SetInstantSuggestion(const string16& suggestion) {
gtk_widget_hide(instant_view_); gtk_widget_hide(instant_view_);
return; return;
} }
if (InstantController::IsEnabled(model_->profile(), if (InstantController::IsEnabled(model_->profile())
InstantController::PREDICTIVE_TYPE)
#if GTK_CHECK_VERSION(2, 20, 0) #if GTK_CHECK_VERSION(2, 20, 0)
&& preedit_.empty() && preedit_.empty()
#endif #endif
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/omnibox/location_bar.h" #include "chrome/browser/ui/omnibox/location_bar.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/in_process_browser_test.h" #include "chrome/test/in_process_browser_test.h"
#include "chrome/test/ui_test_utils.h" #include "chrome/test/ui_test_utils.h"
...@@ -36,6 +35,10 @@ class InstantTest : public InProcessBrowserTest { ...@@ -36,6 +35,10 @@ class InstantTest : public InProcessBrowserTest {
EnableDOMAutomation(); EnableDOMAutomation();
} }
void EnableInstant() {
InstantController::Enable(browser()->profile());
}
void SetupInstantProvider(const std::string& page) { void SetupInstantProvider(const std::string& page) {
TemplateURLModel* model = browser()->profile()->GetTemplateURLModel(); TemplateURLModel* model = browser()->profile()->GetTemplateURLModel();
ASSERT_TRUE(model); ASSERT_TRUE(model);
...@@ -270,10 +273,6 @@ class InstantTest : public InProcessBrowserTest { ...@@ -270,10 +273,6 @@ class InstantTest : public InProcessBrowserTest {
} }
protected: protected:
virtual void SetUpCommandLine(CommandLine* command_line) {
command_line->AppendSwitch(switches::kEnablePredictiveInstant);
}
LocationBar* location_bar_; LocationBar* location_bar_;
TabContents* preview_; TabContents* preview_;
}; };
...@@ -286,6 +285,7 @@ class InstantTest : public InProcessBrowserTest { ...@@ -286,6 +285,7 @@ class InstantTest : public InProcessBrowserTest {
// Verify that the onchange event is dispatched upon typing in the box. // Verify that the onchange event is dispatched upon typing in the box.
IN_PROC_BROWSER_TEST_F(InstantTest, OnChangeEvent) { IN_PROC_BROWSER_TEST_F(InstantTest, OnChangeEvent) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
EnableInstant();
ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html"));
ASSERT_NO_FATAL_FAILURE(SetupLocationBar()); ASSERT_NO_FATAL_FAILURE(SetupLocationBar());
ASSERT_NO_FATAL_FAILURE(SetupPreview()); ASSERT_NO_FATAL_FAILURE(SetupPreview());
...@@ -299,6 +299,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, OnChangeEvent) { ...@@ -299,6 +299,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, OnChangeEvent) {
IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsArrayOfStrings) { IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsArrayOfStrings) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
EnableInstant();
ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html"));
ASSERT_NO_FATAL_FAILURE(SetupLocationBar()); ASSERT_NO_FATAL_FAILURE(SetupLocationBar());
ASSERT_NO_FATAL_FAILURE(SetupPreview()); ASSERT_NO_FATAL_FAILURE(SetupPreview());
...@@ -310,6 +311,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsArrayOfStrings) { ...@@ -310,6 +311,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsArrayOfStrings) {
IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsEmptyArray) { IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsEmptyArray) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
EnableInstant();
ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html"));
ASSERT_NO_FATAL_FAILURE(SetupLocationBar()); ASSERT_NO_FATAL_FAILURE(SetupLocationBar());
ASSERT_NO_FATAL_FAILURE(SetupPreview()); ASSERT_NO_FATAL_FAILURE(SetupPreview());
...@@ -321,6 +323,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsEmptyArray) { ...@@ -321,6 +323,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsEmptyArray) {
IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsValidJson) { IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsValidJson) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
EnableInstant();
ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html"));
ASSERT_NO_FATAL_FAILURE(SetupLocationBar()); ASSERT_NO_FATAL_FAILURE(SetupLocationBar());
ASSERT_NO_FATAL_FAILURE(SetupPreview()); ASSERT_NO_FATAL_FAILURE(SetupPreview());
...@@ -334,6 +337,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsValidJson) { ...@@ -334,6 +337,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsValidJson) {
IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsInvalidSuggestions) { IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsInvalidSuggestions) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
EnableInstant();
ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html"));
ASSERT_NO_FATAL_FAILURE(SetupLocationBar()); ASSERT_NO_FATAL_FAILURE(SetupLocationBar());
ASSERT_NO_FATAL_FAILURE(SetupPreview()); ASSERT_NO_FATAL_FAILURE(SetupPreview());
...@@ -347,6 +351,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsInvalidSuggestions) { ...@@ -347,6 +351,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsInvalidSuggestions) {
IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsEmptyJson) { IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsEmptyJson) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
EnableInstant();
ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html"));
ASSERT_NO_FATAL_FAILURE(SetupLocationBar()); ASSERT_NO_FATAL_FAILURE(SetupLocationBar());
ASSERT_NO_FATAL_FAILURE(SetupPreview()); ASSERT_NO_FATAL_FAILURE(SetupPreview());
...@@ -358,6 +363,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsEmptyJson) { ...@@ -358,6 +363,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsEmptyJson) {
IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsEmptySuggestions) { IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsEmptySuggestions) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
EnableInstant();
ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html"));
ASSERT_NO_FATAL_FAILURE(SetupLocationBar()); ASSERT_NO_FATAL_FAILURE(SetupLocationBar());
ASSERT_NO_FATAL_FAILURE(SetupPreview()); ASSERT_NO_FATAL_FAILURE(SetupPreview());
...@@ -369,6 +375,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsEmptySuggestions) { ...@@ -369,6 +375,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsEmptySuggestions) {
IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsEmptySuggestion) { IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsEmptySuggestion) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
EnableInstant();
ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html"));
ASSERT_NO_FATAL_FAILURE(SetupLocationBar()); ASSERT_NO_FATAL_FAILURE(SetupLocationBar());
ASSERT_NO_FATAL_FAILURE(SetupPreview()); ASSERT_NO_FATAL_FAILURE(SetupPreview());
...@@ -381,6 +388,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsEmptySuggestion) { ...@@ -381,6 +388,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, SetSuggestionsEmptySuggestion) {
// Verify instant preview is shown correctly for a non-search query. // Verify instant preview is shown correctly for a non-search query.
IN_PROC_BROWSER_TEST_F(InstantTest, ShowPreviewNonSearch) { IN_PROC_BROWSER_TEST_F(InstantTest, ShowPreviewNonSearch) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
EnableInstant();
GURL url(test_server()->GetURL("files/instant/empty.html")); GURL url(test_server()->GetURL("files/instant/empty.html"));
ASSERT_NO_FATAL_FAILURE(SetLocationBarText(UTF8ToWide(url.spec()))); ASSERT_NO_FATAL_FAILURE(SetLocationBarText(UTF8ToWide(url.spec())));
// The preview should be active and showing. // The preview should be active and showing.
...@@ -399,6 +407,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, ShowPreviewNonSearch) { ...@@ -399,6 +407,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, ShowPreviewNonSearch) {
// correctly. // correctly.
IN_PROC_BROWSER_TEST_F(InstantTest, NonSearchToSearch) { IN_PROC_BROWSER_TEST_F(InstantTest, NonSearchToSearch) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
EnableInstant();
GURL url(test_server()->GetURL("files/instant/empty.html")); GURL url(test_server()->GetURL("files/instant/empty.html"));
ASSERT_NO_FATAL_FAILURE(SetLocationBarText(UTF8ToWide(url.spec()))); ASSERT_NO_FATAL_FAILURE(SetLocationBarText(UTF8ToWide(url.spec())));
// The preview should be active and showing. // The preview should be active and showing.
...@@ -479,6 +488,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, NonSearchToSearch) { ...@@ -479,6 +488,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, NonSearchToSearch) {
#endif #endif
IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_SearchServerDoesntSupportInstant) { IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_SearchServerDoesntSupportInstant) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
EnableInstant();
ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("empty.html")); ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("empty.html"));
ASSERT_NO_FATAL_FAILURE(FindLocationBar()); ASSERT_NO_FATAL_FAILURE(FindLocationBar());
location_bar_->location_entry()->SetUserText(ASCIIToUTF16("a")); location_bar_->location_entry()->SetUserText(ASCIIToUTF16("a"));
...@@ -516,6 +526,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_SearchServerDoesntSupportInstant) { ...@@ -516,6 +526,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_SearchServerDoesntSupportInstant) {
IN_PROC_BROWSER_TEST_F(InstantTest, IN_PROC_BROWSER_TEST_F(InstantTest,
MAYBE_NonSearchToSearchDoesntSupportInstant) { MAYBE_NonSearchToSearchDoesntSupportInstant) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
EnableInstant();
ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("empty.html")); ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("empty.html"));
GURL url(test_server()->GetURL("files/instant/empty.html")); GURL url(test_server()->GetURL("files/instant/empty.html"));
ASSERT_NO_FATAL_FAILURE(SetLocationBarText(UTF8ToWide(url.spec()))); ASSERT_NO_FATAL_FAILURE(SetLocationBarText(UTF8ToWide(url.spec())));
...@@ -553,6 +564,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, ...@@ -553,6 +564,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest,
// Verifies the page was told a non-zero height. // Verifies the page was told a non-zero height.
IN_PROC_BROWSER_TEST_F(InstantTest, ValidHeight) { IN_PROC_BROWSER_TEST_F(InstantTest, ValidHeight) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
EnableInstant();
ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html"));
ASSERT_NO_FATAL_FAILURE(SetupLocationBar()); ASSERT_NO_FATAL_FAILURE(SetupLocationBar());
ASSERT_NO_FATAL_FAILURE(SetupPreview()); ASSERT_NO_FATAL_FAILURE(SetupPreview());
...@@ -578,6 +590,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, ValidHeight) { ...@@ -578,6 +590,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, ValidHeight) {
// query the host again. // query the host again.
IN_PROC_BROWSER_TEST_F(InstantTest, HideOn403) { IN_PROC_BROWSER_TEST_F(InstantTest, HideOn403) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
EnableInstant();
GURL url(test_server()->GetURL("files/instant/403.html")); GURL url(test_server()->GetURL("files/instant/403.html"));
ASSERT_NO_FATAL_FAILURE(FindLocationBar()); ASSERT_NO_FATAL_FAILURE(FindLocationBar());
location_bar_->location_entry()->SetUserText(UTF8ToUTF16(url.spec())); location_bar_->location_entry()->SetUserText(UTF8ToUTF16(url.spec()));
...@@ -604,6 +617,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, HideOn403) { ...@@ -604,6 +617,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, HideOn403) {
// Verify that the onsubmit event is dispatched upon pressing enter. // Verify that the onsubmit event is dispatched upon pressing enter.
IN_PROC_BROWSER_TEST_F(InstantTest, OnSubmitEvent) { IN_PROC_BROWSER_TEST_F(InstantTest, OnSubmitEvent) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
EnableInstant();
ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html"));
ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
...@@ -627,6 +641,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, OnSubmitEvent) { ...@@ -627,6 +641,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, OnSubmitEvent) {
// Verify that the oncancel event is dispatched upon losing focus. // Verify that the oncancel event is dispatched upon losing focus.
IN_PROC_BROWSER_TEST_F(InstantTest, OnCancelEvent) { IN_PROC_BROWSER_TEST_F(InstantTest, OnCancelEvent) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
EnableInstant();
ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html"));
ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
...@@ -656,6 +671,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, OnCancelEvent) { ...@@ -656,6 +671,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, OnCancelEvent) {
#endif #endif
IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_TabKey) { IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_TabKey) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
EnableInstant();
ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html"));
ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -41,10 +41,7 @@ InstantController::InstantController(Profile* profile, ...@@ -41,10 +41,7 @@ InstantController::InstantController(Profile* profile,
is_displayable_(false), is_displayable_(false),
commit_on_mouse_up_(false), commit_on_mouse_up_(false),
last_transition_type_(PageTransition::LINK), last_transition_type_(PageTransition::LINK),
ALLOW_THIS_IN_INITIALIZER_LIST(destroy_factory_(this)), ALLOW_THIS_IN_INITIALIZER_LIST(destroy_factory_(this)) {
type_(FIRST_TYPE) {
bool enabled = GetType(profile, &type_);
DCHECK(enabled);
PrefService* service = profile->GetPrefs(); PrefService* service = profile->GetPrefs();
if (service) { if (service) {
// kInstantWasEnabledOnce was added after instant, set it now to make sure // kInstantWasEnabledOnce was added after instant, set it now to make sure
...@@ -79,27 +76,17 @@ void InstantController::RecordMetrics(Profile* profile) { ...@@ -79,27 +76,17 @@ void InstantController::RecordMetrics(Profile* profile) {
} else { } else {
base::TimeDelta delta = base::TimeDelta delta =
base::Time::Now() - base::Time::FromInternalValue(enable_time); base::Time::Now() - base::Time::FromInternalValue(enable_time);
std::string name = "Instant.EnabledTime. " + GetTypeString(profile);
// Can't use histogram macros as name isn't constant.
// Histogram from 1 hour to 30 days. // Histogram from 1 hour to 30 days.
scoped_refptr<base::Histogram> counter = UMA_HISTOGRAM_CUSTOM_COUNTS("Instant.EnabledTime.Predictive",
base::Histogram::FactoryGet(name, 1, 30 * 24, 50, delta.InHours(), 1, 30 * 24, 50);
base::Histogram::kUmaTargetedHistogramFlag);
counter->Add(delta.InHours());
} }
} }
} }
// static // static
bool InstantController::IsEnabled(Profile* profile) { bool InstantController::IsEnabled(Profile* profile) {
Type type; PrefService* prefs = profile->GetPrefs();
return GetType(profile, &type); return prefs->GetBoolean(prefs::kInstantEnabled);
}
// static
bool InstantController::IsEnabled(Profile* profile, Type type) {
Type enabled_type;
return GetType(profile, &enabled_type) && type == enabled_type;
} }
// static // static
...@@ -129,13 +116,9 @@ void InstantController::Disable(Profile* profile) { ...@@ -129,13 +116,9 @@ void InstantController::Disable(Profile* profile) {
if (enable_time) { if (enable_time) {
base::TimeDelta delta = base::TimeDelta delta =
base::Time::Now() - base::Time::FromInternalValue(enable_time); base::Time::Now() - base::Time::FromInternalValue(enable_time);
std::string name = "Instant.TimeToDisable." + GetTypeString(profile);
// Can't use histogram macros as name isn't constant.
// Histogram from 1 minute to 10 days. // Histogram from 1 minute to 10 days.
scoped_refptr<base::Histogram> counter = UMA_HISTOGRAM_CUSTOM_COUNTS("Instant.TimeToDisable.Predictive",
base::Histogram::FactoryGet(name, 1, 60 * 24 * 10, 50, delta.InMinutes(), 1, 60 * 24 * 10, 50);
base::Histogram::kUmaTargetedHistogramFlag);
counter->Add(delta.InMinutes());
} }
service->SetBoolean(prefs::kInstantEnabled, false); service->SetBoolean(prefs::kInstantEnabled, false);
...@@ -586,16 +569,6 @@ void InstantController::DestroyLoaders() { ...@@ -586,16 +569,6 @@ void InstantController::DestroyLoaders() {
const TemplateURL* InstantController::GetTemplateURL( const TemplateURL* InstantController::GetTemplateURL(
const AutocompleteMatch& match) { const AutocompleteMatch& match) {
if (type_ == VERBATIM_TYPE) {
// When using VERBATIM_TYPE we don't want to attempt to use the instant
// JavaScript API, otherwise the page would show predictive results. By
// returning NULL here we ensure we don't attempt to use the instant API.
//
// TODO: when the full search box API is in place we can lift this
// restriction and force the page to show verbatim results always.
return NULL;
}
const TemplateURL* template_url = match.template_url; const TemplateURL* template_url = match.template_url;
if (match.type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED || if (match.type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED ||
match.type == AutocompleteMatch::SEARCH_HISTORY || match.type == AutocompleteMatch::SEARCH_HISTORY ||
...@@ -605,51 +578,3 @@ const TemplateURL* InstantController::GetTemplateURL( ...@@ -605,51 +578,3 @@ const TemplateURL* InstantController::GetTemplateURL(
} }
return template_url; return template_url;
} }
// static
bool InstantController::GetType(Profile* profile, Type* type) {
*type = FIRST_TYPE;
// CommandLine takes precedence.
CommandLine* cl = CommandLine::ForCurrentProcess();
if (cl->HasSwitch(switches::kEnablePredictiveInstant)) {
*type = PREDICTIVE_TYPE;
return true;
}
if (cl->HasSwitch(switches::kEnableVerbatimInstant)) {
*type = VERBATIM_TYPE;
return true;
}
if (cl->HasSwitch(switches::kEnablePredictiveNoAutoCompleteInstant)) {
*type = PREDICTIVE_NO_AUTO_COMPLETE_TYPE;
return true;
}
// Then prefs.
PrefService* prefs = profile->GetPrefs();
if (!prefs->GetBoolean(prefs::kInstantEnabled))
return false;
// PREDICTIVE_TYPE is the default if enabled via preferences.
*type = PREDICTIVE_TYPE;
return true;
}
// static
std::string InstantController::GetTypeString(Profile* profile) {
Type type;
if (!GetType(profile, &type)) {
NOTREACHED();
return std::string();
}
switch (type) {
case PREDICTIVE_TYPE:
return "Predictive";
case VERBATIM_TYPE:
return "Verbatim";
case PREDICTIVE_NO_AUTO_COMPLETE_TYPE:
return "PredictiveNoAutoComplete";
default:
NOTREACHED();
return std::string();
}
}
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -44,27 +44,6 @@ class TemplateURL; ...@@ -44,27 +44,6 @@ class TemplateURL;
// being invoked on the delegate. // being invoked on the delegate.
class InstantController : public InstantLoaderDelegate { class InstantController : public InstantLoaderDelegate {
public: public:
// Variations of instant support.
// TODO(sky): nuke these when we decide the default behavior.
enum Type {
// NOTE: these values are persisted to prefs. Don't change them!
FIRST_TYPE = 0,
// Search results are shown for the best guess of what we think the user was
// planning on typing.
PREDICTIVE_TYPE = 0,
// Search results are shown for exactly what was typed.
VERBATIM_TYPE,
// Variant of predictive that does not auto-complete after a delay.
PREDICTIVE_NO_AUTO_COMPLETE_TYPE,
LAST_TYPE = PREDICTIVE_NO_AUTO_COMPLETE_TYPE
};
// Amount of time to wait before starting the instant animation. // Amount of time to wait before starting the instant animation.
static const int kAutoCommitPauseTimeMS = 1000; static const int kAutoCommitPauseTimeMS = 1000;
// Duration of the instant animation in which the colors change. // Duration of the instant animation in which the colors change.
...@@ -79,12 +58,9 @@ class InstantController : public InstantLoaderDelegate { ...@@ -79,12 +58,9 @@ class InstantController : public InstantLoaderDelegate {
// Records instant metrics. // Records instant metrics.
static void RecordMetrics(Profile* profile); static void RecordMetrics(Profile* profile);
// Returns true if either type of instant is enabled. // Returns true if instant is enabled.
static bool IsEnabled(Profile* profile); static bool IsEnabled(Profile* profile);
// Returns true if the specified type of instant is enabled.
static bool IsEnabled(Profile* profile, Type type);
// Enables instant. // Enables instant.
static void Enable(Profile* profile); static void Enable(Profile* profile);
...@@ -257,14 +233,6 @@ class InstantController : public InstantLoaderDelegate { ...@@ -257,14 +233,6 @@ class InstantController : public InstantLoaderDelegate {
// NULL if there is no TemplateURL for |match|. // NULL if there is no TemplateURL for |match|.
const TemplateURL* GetTemplateURL(const AutocompleteMatch& match); const TemplateURL* GetTemplateURL(const AutocompleteMatch& match);
// If instant is enabled for the specified profile the type of instant is set
// in |type| and true is returned. Otherwise returns false.
static bool GetType(Profile* profile, Type* type);
// Returns a string description for the currently enabled type. This is used
// for histograms.
static std::string GetTypeString(Profile* profile);
InstantDelegate* delegate_; InstantDelegate* delegate_;
// The TabContents last passed to |Update|. // The TabContents last passed to |Update|.
...@@ -302,8 +270,6 @@ class InstantController : public InstantLoaderDelegate { ...@@ -302,8 +270,6 @@ class InstantController : public InstantLoaderDelegate {
// URL last pased to ScheduleUpdate. // URL last pased to ScheduleUpdate.
GURL scheduled_url_; GURL scheduled_url_;
Type type_;
// List of InstantLoaders to destroy. See ScheduleForDestroy for details. // List of InstantLoaders to destroy. See ScheduleForDestroy for details.
ScopedVector<InstantLoader> loaders_to_destroy_; ScopedVector<InstantLoader> loaders_to_destroy_;
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -19,10 +19,6 @@ SuggestedTextView::~SuggestedTextView() { ...@@ -19,10 +19,6 @@ SuggestedTextView::~SuggestedTextView() {
} }
void SuggestedTextView::StartAnimation() { void SuggestedTextView::StartAnimation() {
if (!InstantController::IsEnabled(location_bar_->profile(),
InstantController::PREDICTIVE_TYPE)) {
return;
}
StopAnimation(); StopAnimation();
animation_.reset(CreateAnimation()); animation_.reset(CreateAnimation());
......
...@@ -541,13 +541,6 @@ const char kEnableNaClDebug[] = "enable-nacl-debug"; ...@@ -541,13 +541,6 @@ const char kEnableNaClDebug[] = "enable-nacl-debug";
// Enable Native Web Worker support. // Enable Native Web Worker support.
const char kEnableNativeWebWorkers[] = "enable-native-web-workers"; const char kEnableNativeWebWorkers[] = "enable-native-web-workers";
// Is InstantController::PREDICTIVE_TYPE enabled?
const char kEnablePredictiveInstant[] = "enable-predictive-instant";
// Is InstantController::PREDICTIVE_NO_AUTO_COMPLETE_TYPE enabled?
const char kEnablePredictiveNoAutoCompleteInstant[] =
"enable-predictive-no-auto-complete-instant";
// This applies only when the process type is "service". Enables the // This applies only when the process type is "service". Enables the
// Chromoting Host Process within the service process. // Chromoting Host Process within the service process.
const char kEnableRemoting[] = "enable-remoting"; const char kEnableRemoting[] = "enable-remoting";
...@@ -600,9 +593,6 @@ const char kEnableTcpFastOpen[] = "enable-tcp-fastopen"; ...@@ -600,9 +593,6 @@ const char kEnableTcpFastOpen[] = "enable-tcp-fastopen";
// Whether or not the touch events API is exposed. // Whether or not the touch events API is exposed.
const char kEnableTouch[] = "enable-touch"; const char kEnableTouch[] = "enable-touch";
// Is verbatim instant enabled?
const char kEnableVerbatimInstant[] = "enable-verbatim-instant";
// Enables the option to show tabs as a vertical stack down the side of the // Enables the option to show tabs as a vertical stack down the side of the
// browser window. // browser window.
const char kEnableVerticalTabs[] = "enable-vertical-tabs"; const char kEnableVerticalTabs[] = "enable-vertical-tabs";
......
...@@ -161,8 +161,6 @@ extern const char kEnableNaClDebug[]; ...@@ -161,8 +161,6 @@ extern const char kEnableNaClDebug[];
extern const char kEnableNativeWebWorkers[]; extern const char kEnableNativeWebWorkers[];
extern const char kEnablePagePrerender[]; extern const char kEnablePagePrerender[];
extern const char kEnablePreconnect[]; extern const char kEnablePreconnect[];
extern const char kEnablePredictiveInstant[];
extern const char kEnablePredictiveNoAutoCompleteInstant[];
extern const char kEnablePreparsedJsCaching[]; extern const char kEnablePreparsedJsCaching[];
extern const char kEnablePrintPreview[]; extern const char kEnablePrintPreview[];
extern const char kEnableRemoting[]; extern const char kEnableRemoting[];
...@@ -179,7 +177,6 @@ extern const char kEnableSyncTypedUrls[]; ...@@ -179,7 +177,6 @@ extern const char kEnableSyncTypedUrls[];
extern const char kEnableTcpFastOpen[]; extern const char kEnableTcpFastOpen[];
extern const char kEnableTopSites[]; extern const char kEnableTopSites[];
extern const char kEnableTouch[]; extern const char kEnableTouch[];
extern const char kEnableVerbatimInstant[];
extern const char kEnableVerticalTabs[]; extern const char kEnableVerticalTabs[];
extern const char kEnableVideoFullscreen[]; extern const char kEnableVideoFullscreen[];
extern const char kEnableVideoLogging[]; extern const char kEnableVideoLogging[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment