From a4fa52f5aa6d0d770ac0adbbfafdb47204eaa24c Mon Sep 17 00:00:00 2001 From: "sky@chromium.org" Date: Wed, 19 Jan 2011 23:14:27 +0000 Subject: Removes some code we no longer care about. BUG=none TEST=none Review URL: http://codereview.chromium.org/6359002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71866 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/autocomplete/autocomplete_edit.cc | 39 ---------------------- chrome/browser/autocomplete/autocomplete_edit.h | 10 ------ .../autocomplete/autocomplete_edit_unittest.cc | 1 - .../autocomplete/autocomplete_popup_model.cc | 1 - .../ui/cocoa/location_bar/location_bar_view_mac.h | 1 - .../ui/cocoa/location_bar/location_bar_view_mac.mm | 5 --- chrome/browser/ui/gtk/location_bar_view_gtk.cc | 5 --- chrome/browser/ui/gtk/location_bar_view_gtk.h | 1 - .../ui/views/location_bar/location_bar_view.cc | 4 --- .../ui/views/location_bar/location_bar_view.h | 1 - 10 files changed, 68 deletions(-) (limited to 'chrome') diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc index 9b03855..c4d782a 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.cc +++ b/chrome/browser/autocomplete/autocomplete_edit.cc @@ -697,10 +697,6 @@ void AutocompleteEditModel::PopupBoundsChangedTo(const gfx::Rect& bounds) { controller_->OnPopupBoundsChanged(bounds); } -void AutocompleteEditModel::ResultsUpdated() { - UpdateSuggestedSearchText(); -} - // Return true if the suggestion type warrants a TCP/IP preconnection. // i.e., it is now highly likely that the user will select the related domain. static bool IsPreconnectable(AutocompleteMatch::Type type) { @@ -799,38 +795,3 @@ bool AutocompleteEditModel::GetURLForText(const std::wstring& text, *url = parsed_url; return true; } - -// Returns true if suggested search text should be shown for the specified match -// type. -static bool ShouldShowSuggestSearchTextFor(AutocompleteMatch::Type type) { - // TODO: add support for other engines when in keyword mode. - return ((type == AutocompleteMatch::SEARCH_HISTORY) || - (type == AutocompleteMatch::SEARCH_SUGGEST)); -} - -void AutocompleteEditModel::UpdateSuggestedSearchText() { - if (!InstantController::IsEnabled(profile_, InstantController::VERBATIM_TYPE)) - return; - - string16 suggested_text; - // The suggested text comes from the first search result. - if (popup_->IsOpen()) { - const AutocompleteResult& result = popup_->result(); - if ((result.size() > 1) && (popup_->selected_line() == 0) && - ((result.begin()->inline_autocomplete_offset == std::wstring::npos) || - (result.begin()->inline_autocomplete_offset == - result.begin()->fill_into_edit.size()))) { - for (AutocompleteResult::const_iterator i = result.begin() + 1; - i != result.end(); ++i) { - // TODO: add support for other engines when in keyword mode. - if (ShouldShowSuggestSearchTextFor(i->type) && - i->inline_autocomplete_offset != std::wstring::npos) { - suggested_text = WideToUTF16(i->fill_into_edit.substr( - i->inline_autocomplete_offset)); - break; - } - } - } - } - controller_->OnSetSuggestedSearchText(suggested_text); -} diff --git a/chrome/browser/autocomplete/autocomplete_edit.h b/chrome/browser/autocomplete/autocomplete_edit.h index 83c87c3..ea70b84 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.h +++ b/chrome/browser/autocomplete/autocomplete_edit.h @@ -56,9 +56,6 @@ class AutocompleteEditController { // Returns false if there is no instant preview showing. virtual bool AcceptCurrentInstantPreview() = 0; - // Sets the suggested search text to |suggested_text|. - virtual void OnSetSuggestedSearchText(const string16& suggested_text) = 0; - // Invoked when the popup is going to change its bounds to |bounds|. virtual void OnPopupBoundsChanged(const gfx::Rect& bounds) = 0; @@ -339,9 +336,6 @@ class AutocompleteEditModel : public NotificationObserver { // Invoked when the popup is going to change its bounds to |bounds|. void PopupBoundsChangedTo(const gfx::Rect& bounds); - // Invoked when the autocomplete results may have changed in some way. - void ResultsUpdated(); - private: enum PasteState { NONE, // Most recent edit was not a paste that replaced all text. @@ -399,10 +393,6 @@ class AutocompleteEditModel : public NotificationObserver { // copy. bool GetURLForText(const std::wstring& text, GURL* url) const; - // Determines the suggested search text and invokes OnSetSuggestedSearchText - // on the controller. - void UpdateSuggestedSearchText(); - AutocompleteEditView* view_; AutocompletePopupModel* popup_; diff --git a/chrome/browser/autocomplete/autocomplete_edit_unittest.cc b/chrome/browser/autocomplete/autocomplete_edit_unittest.cc index bff0815..f599db3 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_unittest.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_unittest.cc @@ -81,7 +81,6 @@ class TestingAutocompleteEditController : public AutocompleteEditController { virtual bool AcceptCurrentInstantPreview() { return false; } - virtual void OnSetSuggestedSearchText(const string16& suggested_text) {} virtual void OnPopupBoundsChanged(const gfx::Rect& bounds) {} virtual void OnAutocompleteAccept(const GURL& url, WindowOpenDisposition disposition, diff --git a/chrome/browser/autocomplete/autocomplete_popup_model.cc b/chrome/browser/autocomplete/autocomplete_popup_model.cc index beb80c3..588683d 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_model.cc +++ b/chrome/browser/autocomplete/autocomplete_popup_model.cc @@ -318,7 +318,6 @@ void AutocompletePopupModel::Observe(NotificationType type, SetHoveredLine(kNoMatch); view_->UpdatePopupAppearance(); - edit_model_->ResultsUpdated(); edit_model_->PopupBoundsChangedTo(view_->GetTargetBounds()); } diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h index f492aeb..201b645 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h @@ -134,7 +134,6 @@ class LocationBarViewMac : public AutocompleteEditController, virtual void OnAutocompleteWillAccept(); virtual bool OnCommitSuggestedText(const std::wstring& typed_text); virtual bool AcceptCurrentInstantPreview(); - virtual void OnSetSuggestedSearchText(const string16& suggested_text); virtual void OnPopupBoundsChanged(const gfx::Rect& bounds); virtual void OnAutocompleteAccept(const GURL& url, WindowOpenDisposition disposition, diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm index f69951f..35aa08c 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm @@ -256,11 +256,6 @@ bool LocationBarViewMac::AcceptCurrentInstantPreview() { return InstantController::CommitIfCurrent(browser_->instant()); } -void LocationBarViewMac::OnSetSuggestedSearchText( - const string16& suggested_text) { - SetSuggestedText(suggested_text); -} - void LocationBarViewMac::OnPopupBoundsChanged(const gfx::Rect& bounds) { InstantController* instant = browser_->instant(); if (instant) diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc index 4489a5f..34ca4c0 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc @@ -467,11 +467,6 @@ bool LocationBarViewGtk::AcceptCurrentInstantPreview() { return InstantController::CommitIfCurrent(browser_->instant()); } -void LocationBarViewGtk::OnSetSuggestedSearchText( - const string16& suggested_text) { - SetSuggestedText(suggested_text); -} - void LocationBarViewGtk::OnPopupBoundsChanged(const gfx::Rect& bounds) { InstantController* instant = browser_->instant(); if (instant) diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.h b/chrome/browser/ui/gtk/location_bar_view_gtk.h index 2a82530..6d3fbc5 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.h +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.h @@ -97,7 +97,6 @@ class LocationBarViewGtk : public AutocompleteEditController, // For this implementation, the parameter is ignored. virtual bool OnCommitSuggestedText(const std::wstring& typed_text); virtual bool AcceptCurrentInstantPreview(); - virtual void OnSetSuggestedSearchText(const string16& suggested_text); virtual void OnPopupBoundsChanged(const gfx::Rect& bounds); virtual void OnAutocompleteAccept(const GURL& url, WindowOpenDisposition disposition, diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index ff40ad8..d77d597 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -786,10 +786,6 @@ bool LocationBarView::AcceptCurrentInstantPreview() { return InstantController::CommitIfCurrent(delegate_->GetInstant()); } -void LocationBarView::OnSetSuggestedSearchText(const string16& suggested_text) { - SetSuggestedText(suggested_text); -} - void LocationBarView::OnPopupBoundsChanged(const gfx::Rect& bounds) { InstantController* instant = delegate_->GetInstant(); if (instant) diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h index 15bb586..f36c5c8 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.h +++ b/chrome/browser/ui/views/location_bar/location_bar_view.h @@ -197,7 +197,6 @@ class LocationBarView : public LocationBar, virtual void OnAutocompleteWillAccept(); virtual bool OnCommitSuggestedText(const std::wstring& typed_text); virtual bool AcceptCurrentInstantPreview(); - virtual void OnSetSuggestedSearchText(const string16& suggested_text); virtual void OnPopupBoundsChanged(const gfx::Rect& bounds); virtual void OnAutocompleteAccept(const GURL& url, WindowOpenDisposition disposition, -- cgit v1.1