summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-17 02:17:38 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-17 02:17:38 +0000
commitd7e1eb01337e621b6c23e8f3af0d7728a83d78d8 (patch)
treedecdf30ff9bbabf542c45b40813b79a01a1a33b5
parent2c12398bb295951bf8bbdaae2c7fa9c3e789fe22 (diff)
downloadchromium_src-d7e1eb01337e621b6c23e8f3af0d7728a83d78d8.zip
chromium_src-d7e1eb01337e621b6c23e8f3af0d7728a83d78d8.tar.gz
chromium_src-d7e1eb01337e621b6c23e8f3af0d7728a83d78d8.tar.bz2
Moves instant back into flags.
I'm TBRing this since it's mostly a revert. TBR=ben@chromium.org BUG=59298 TEST=make sure instant isn't in preferences anymore. Review URL: http://codereview.chromium.org/3809005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62881 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/generated_resources.grd10
-rw-r--r--chrome/browser/about_flags.cc7
-rw-r--r--chrome/browser/browser.cc12
-rw-r--r--chrome/browser/browser.h3
-rw-r--r--chrome/browser/instant/instant_controller.cc6
-rw-r--r--chrome/browser/instant/instant_controller.h3
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc1
-rw-r--r--chrome/browser/views/options/general_page_view.cc61
-rw-r--r--chrome/browser/views/options/general_page_view.h11
-rw-r--r--chrome/browser/views/options/options_group_view.cc3
-rw-r--r--chrome/browser/views/options/options_group_view.h2
-rw-r--r--chrome/renderer/search_extension.cc6
12 files changed, 24 insertions, 101 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 91c57ad..ced241f 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -4114,12 +4114,6 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_INSTANT_OPT_IN_MESSAGE" desc="Message shown in the instant opt-in dialog">
Instant lets you view web pages and search results faster than ever!\n\nWith Instant enabled, most web pages begin loading as soon as you type a URL in the omnibox, before you hit Enter. In addition, if supported by your default search engine, search results appear instantly as you type queries in the omnibox, and in-line predictions help guide your search.\n\nBecause new search results are requested each time you press a key, anything you type into the omnibox may be logged as a search query by your default search engine.\n\n
</message>
- <message name="IDS_INSTANT_PREF" desc="Preference for enabling instant">
- Enable Instant for faster searching and browsing
- </message>
- <message name="IDS_INSTANT_PREF_WARNING" desc="Warning displayed beneath instant pref">
- Omnibox input may be logged
- </message>
<!-- Click-to-load -->
<message name="IDS_PLUGIN_LOAD" desc="The link for loading a blocked plug-in, displayed in the click-to-play UI.">
@@ -6442,12 +6436,12 @@ Keep your key file in a safe place. You will need it to create new versions of y
<if expr="not pp_ifdef('use_titlecase') or os != 'linux2'">
<message name="IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME" desc="The title of the default search engine group">
- Search:
+ Default search:
</message>
</if>
<if expr="pp_ifdef('use_titlecase') and os == 'linux2'">
<message name="IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME" desc="In Title Case and without trailing colon: The title of the default search engine group">
- Search
+ Default Search
</message>
</if>
<message name="IDS_OPTIONS_DEFAULTSEARCH_MANAGE_ENGINES_LINK"
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index b61f0ce..066ca81 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -76,6 +76,13 @@ const Experiment kExperiments[] = {
switches::kEnableTabbedOptions
},
{
+ "match-preview", // Do not change; see above.
+ IDS_FLAGS_INSTANT_NAME,
+ IDS_FLAGS_INSTANT_DESCRIPTION,
+ kOsWin,
+ switches::kEnableMatchPreview
+ },
+ {
"remoting", // Do not change; see above.
IDS_FLAGS_REMOTING_NAME,
#if defined(OS_WIN)
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index b2ff5fc..c9111a9 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -240,7 +240,6 @@ Browser::Browser(Type type, Profile* profile)
encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector,
profile_->GetPrefs(), NULL);
use_vertical_tabs_.Init(prefs::kUseVerticalTabs, profile_->GetPrefs(), this);
- instant_enabled_.Init(prefs::kInstantEnabled, profile_->GetPrefs(), this);
if (!TabMenuModel::AreVerticalTabsEnabled()) {
// If vertical tabs aren't enabled, explicitly turn them off. Otherwise we
// might show vertical tabs but not show an option to turn them off.
@@ -3351,15 +3350,6 @@ void Browser::Observe(NotificationType type,
UseVerticalTabsChanged();
} else if (pref_name == prefs::kPrintingEnabled) {
UpdatePrintingState(0);
- } else if (pref_name == prefs::kInstantEnabled) {
- if (!InstantController::IsEnabled(profile())) {
- if (instant()) {
- instant()->DestroyPreviewContents();
- instant_.reset(NULL);
- }
- } else {
- CreateInstantIfNecessary();
- }
} else {
NOTREACHED();
}
@@ -4267,7 +4257,7 @@ bool Browser::OpenInstant(WindowOpenDisposition disposition) {
}
void Browser::CreateInstantIfNecessary() {
- if (type() == TYPE_NORMAL && InstantController::IsEnabled(profile()) &&
+ if (type() == TYPE_NORMAL && InstantController::IsEnabled() &&
!profile()->IsOffTheRecord()) {
instant_.reset(new InstantController(this));
}
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index a040498..dc22dd4 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -1093,9 +1093,6 @@ class Browser : public TabHandlerDelegate,
// Keep track of the printing enabled pref.
BooleanPrefMember printing_enabled_;
- // Keep track of when instant enabled changes.
- BooleanPrefMember instant_enabled_;
-
// Indicates if command execution is blocked.
bool block_command_execution_;
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc
index 24c70f8..40f9d71 100644
--- a/chrome/browser/instant/instant_controller.cc
+++ b/chrome/browser/instant/instant_controller.cc
@@ -28,7 +28,8 @@ void InstantController::RegisterUserPrefs(PrefService* prefs) {
}
// static
-bool InstantController::IsEnabled(Profile* profile) {
+bool InstantController::IsEnabled() {
+ // TODO: convert to kInstantEnabled once pref lands.
static bool enabled = false;
static bool checked = false;
if (!checked) {
@@ -36,8 +37,7 @@ bool InstantController::IsEnabled(Profile* profile) {
enabled = CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableMatchPreview);
}
- PrefService* prefs = profile->GetPrefs();
- return (enabled || (prefs && prefs->GetBoolean(prefs::kInstantEnabled)));
+ return enabled;
}
InstantController::InstantController(InstantDelegate* delegate)
diff --git a/chrome/browser/instant/instant_controller.h b/chrome/browser/instant/instant_controller.h
index 0430083..e72f235 100644
--- a/chrome/browser/instant/instant_controller.h
+++ b/chrome/browser/instant/instant_controller.h
@@ -23,7 +23,6 @@ struct AutocompleteMatch;
class InstantDelegate;
class InstantLoaderManager;
class PrefService;
-class Profile;
class TabContents;
class TemplateURL;
@@ -44,7 +43,7 @@ class InstantController : public InstantLoaderDelegate {
static void RegisterUserPrefs(PrefService* prefs);
// Is InstantController enabled?
- static bool IsEnabled(Profile* profile);
+ static bool IsEnabled();
// Invoked as the user types in the omnibox with the url to navigate to. If
// the url is empty and there is a preview TabContents it is destroyed. If url
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index f8ef0b1..f5e0ba0 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -614,6 +614,7 @@ void BrowserRenderProcessHost::PropagateBrowserCommandLineToRenderer(
switches::kEnableResourceContentSettings,
switches::kPrelaunchGpuProcess,
switches::kEnableAcceleratedDecoding,
+ switches::kEnableMatchPreview,
switches::kDisableFileSystem
};
renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames,
diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc
index e7c4d3e..d1c8ebb 100644
--- a/chrome/browser/views/options/general_page_view.cc
+++ b/chrome/browser/views/options/general_page_view.cc
@@ -11,11 +11,8 @@
#include "base/string16.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
-#include "chrome/browser/browser.h"
-#include "chrome/browser/browser_window.h"
#include "chrome/browser/custom_home_pages_table_model.h"
#include "chrome/browser/dom_ui/new_tab_ui.h"
-#include "chrome/browser/instant/instant_confirm_dialog.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profile.h"
@@ -212,8 +209,6 @@ GeneralPageView::GeneralPageView(Profile* profile)
homepage_show_home_button_checkbox_(NULL),
default_search_group_(NULL),
default_search_manage_engines_button_(NULL),
- instant_checkbox_(NULL),
- instant_link_(NULL),
default_browser_group_(NULL),
default_browser_status_label_(NULL),
default_browser_use_as_default_button_(NULL),
@@ -287,16 +282,6 @@ void GeneralPageView::ButtonPressed(
UserMetricsRecordAction(UserMetricsAction("Options_ManageSearchEngines"),
NULL);
KeywordEditorView::Show(profile());
- } else if (sender == instant_checkbox_) {
- if (instant_checkbox_->checked()) {
- // Don't toggle immediately, instead let
- // ShowInstantConfirmDialogIfNecessary do it.
- instant_checkbox_->SetChecked(false);
- browser::ShowInstantConfirmDialogIfNecessary(
- GetWindow()->GetNativeWindow(), profile());
- } else {
- profile()->GetPrefs()->SetBoolean(prefs::kInstantEnabled, false);
- }
}
}
@@ -373,7 +358,6 @@ void GeneralPageView::InitControlLayout() {
registrar_.Init(profile()->GetPrefs());
registrar_.Add(prefs::kRestoreOnStartup, this);
registrar_.Add(prefs::kURLsToRestoreOnStartup, this);
- registrar_.Add(prefs::kInstantEnabled, this);
new_tab_page_is_home_page_.Init(prefs::kHomePageIsNewTabPage,
profile()->GetPrefs(), this);
@@ -382,10 +366,10 @@ void GeneralPageView::InitControlLayout() {
}
void GeneralPageView::NotifyPrefChanged(const std::string* pref_name) {
- PrefService* prefs = profile()->GetPrefs();
if (!pref_name ||
*pref_name == prefs::kRestoreOnStartup ||
*pref_name == prefs::kURLsToRestoreOnStartup) {
+ PrefService* prefs = profile()->GetPrefs();
const SessionStartupPref startup_pref =
SessionStartupPref::GetStartupPref(prefs);
bool radio_buttons_enabled = !SessionStartupPref::TypeIsManaged(prefs);
@@ -440,9 +424,6 @@ void GeneralPageView::NotifyPrefChanged(const std::string* pref_name) {
homepage_show_home_button_checkbox_->SetEnabled(
!show_home_button_.IsManaged());
}
-
- if (!pref_name || *pref_name == prefs::kInstantEnabled)
- instant_checkbox_->SetChecked(prefs->GetBoolean(prefs::kInstantEnabled));
}
void GeneralPageView::HighlightGroup(OptionsGroup highlight_group) {
@@ -450,12 +431,6 @@ void GeneralPageView::HighlightGroup(OptionsGroup highlight_group) {
default_search_group_->SetHighlighted(true);
}
-void GeneralPageView::LinkActivated(views::Link* source, int event_flags) {
- DCHECK(source == instant_link_);
- browser::ShowOptionsURL(profile(),
- GURL(browser::kInstantLearnMoreURL));
-}
-
///////////////////////////////////////////////////////////////////////////////
// GeneralPageView, private:
@@ -653,15 +628,6 @@ void GeneralPageView::InitDefaultSearchGroup() {
this,
l10n_util::GetString(IDS_OPTIONS_DEFAULTSEARCH_MANAGE_ENGINES_LINK));
- instant_checkbox_ = new views::Checkbox(
- l10n_util::GetString(IDS_INSTANT_PREF));
- instant_checkbox_->SetMultiLine(true);
- instant_checkbox_->set_listener(this);
-
- instant_link_ = new views::Link(l10n_util::GetString(IDS_LEARN_MORE));
- instant_link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- instant_link_->SetController(this);
-
using views::GridLayout;
using views::ColumnSet;
@@ -677,34 +643,9 @@ void GeneralPageView::InitDefaultSearchGroup() {
column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
GridLayout::USE_PREF, 0, 0);
- const int single_column_view_set_id = 1;
- column_set = layout->AddColumnSet(single_column_view_set_id);
- column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1,
- GridLayout::USE_PREF, 0, 0);
-
- const int link_column_set_id = 2;
- column_set = layout->AddColumnSet(link_column_set_id);
- // TODO(sky): this isn't right, we need a method to determine real indent.
- column_set->AddPaddingColumn(0, views::Checkbox::GetTextIndent() + 3);
- column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
- GridLayout::USE_PREF, 0, 0);
- column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing);
- column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
- GridLayout::USE_PREF, 0, 0);
-
layout->StartRow(0, double_column_view_set_id);
layout->AddView(default_search_engine_combobox_);
layout->AddView(default_search_manage_engines_button_);
- layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing);
-
- layout->StartRow(0, single_column_view_set_id);
- layout->AddView(instant_checkbox_);
- layout->AddPaddingRow(0, 0);
-
- layout->StartRow(0, link_column_set_id);
- layout->AddView(
- new views::Label(l10n_util::GetString(IDS_INSTANT_PREF_WARNING)));
- layout->AddView(instant_link_);
default_search_group_ = new OptionsGroupView(
contents, l10n_util::GetString(IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME),
diff --git a/chrome/browser/views/options/general_page_view.h b/chrome/browser/views/options/general_page_view.h
index a663c82..f2b126f 100644
--- a/chrome/browser/views/options/general_page_view.h
+++ b/chrome/browser/views/options/general_page_view.h
@@ -13,7 +13,6 @@
#include "chrome/browser/views/url_picker.h"
#include "views/controls/combobox/combobox.h"
#include "views/controls/button/button.h"
-#include "views/controls/link.h"
#include "views/controls/table/table_view_observer.h"
#include "views/view.h"
@@ -40,8 +39,7 @@ class GeneralPageView : public OptionsPageView,
public views::Textfield::Controller,
public UrlPickerDelegate,
public views::TableViewObserver,
- public ShellIntegration::DefaultBrowserObserver,
- public views::LinkController {
+ public ShellIntegration::DefaultBrowserObserver {
public:
explicit GeneralPageView(Profile* profile);
virtual ~GeneralPageView();
@@ -66,9 +64,6 @@ class GeneralPageView : public OptionsPageView,
virtual void NotifyPrefChanged(const std::string* pref_name);
virtual void HighlightGroup(OptionsGroup highlight_group);
- // LinkController implementation:
- virtual void LinkActivated(views::Link* source, int event_flags);
-
private:
// ShellIntegration::DefaultBrowserObserver implementation:
// Updates the UI state to reflect the current default browser state.
@@ -148,13 +143,11 @@ class GeneralPageView : public OptionsPageView,
StringPrefMember homepage_;
BooleanPrefMember show_home_button_;
- // Controls for the Search group
+ // Controls for the Default Search group
OptionsGroupView* default_search_group_;
views::Combobox* default_search_engine_combobox_;
views::NativeButton* default_search_manage_engines_button_;
scoped_ptr<SearchEngineListModel> default_search_engines_model_;
- views::Checkbox* instant_checkbox_;
- views::Link* instant_link_;
// Controls for the Default Browser group
OptionsGroupView* default_browser_group_;
diff --git a/chrome/browser/views/options/options_group_view.cc b/chrome/browser/views/options/options_group_view.cc
index ef3e5dd..14131b7 100644
--- a/chrome/browser/views/options/options_group_view.cc
+++ b/chrome/browser/views/options/options_group_view.cc
@@ -53,9 +53,6 @@ OptionsGroupView::OptionsGroupView(views::View* contents,
contents->SetAccessibleName(title);
}
-OptionsGroupView::~OptionsGroupView() {
-}
-
void OptionsGroupView::SetHighlighted(bool highlighted) {
highlighted_ = highlighted;
SchedulePaint();
diff --git a/chrome/browser/views/options/options_group_view.h b/chrome/browser/views/options/options_group_view.h
index b79a36e..69b4efa 100644
--- a/chrome/browser/views/options/options_group_view.h
+++ b/chrome/browser/views/options/options_group_view.h
@@ -25,7 +25,7 @@ class OptionsGroupView : public views::View {
const std::wstring& title,
const std::wstring& description,
bool show_separator);
- virtual ~OptionsGroupView();
+ virtual ~OptionsGroupView() {}
// Sets the group as being highlighted to attract attention.
void SetHighlighted(bool highlighted);
diff --git a/chrome/renderer/search_extension.cc b/chrome/renderer/search_extension.cc
index 1a3f543..17bfd29 100644
--- a/chrome/renderer/search_extension.cc
+++ b/chrome/renderer/search_extension.cc
@@ -86,7 +86,11 @@ v8::Handle<v8::Value> SearchExtensionWrapper::SetSuggestResult(
}
v8::Extension* SearchExtension::Get() {
- return new SearchExtensionWrapper();
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableMatchPreview)) {
+ return new SearchExtensionWrapper();
+ }
+ return NULL;
}
} // namespace extensions_v8