Commit a4fa52f5 authored by sky@chromium.org's avatar sky@chromium.org

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
parent b2d4e293
...@@ -697,10 +697,6 @@ void AutocompleteEditModel::PopupBoundsChangedTo(const gfx::Rect& bounds) { ...@@ -697,10 +697,6 @@ void AutocompleteEditModel::PopupBoundsChangedTo(const gfx::Rect& bounds) {
controller_->OnPopupBoundsChanged(bounds); controller_->OnPopupBoundsChanged(bounds);
} }
void AutocompleteEditModel::ResultsUpdated() {
UpdateSuggestedSearchText();
}
// Return true if the suggestion type warrants a TCP/IP preconnection. // 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. // i.e., it is now highly likely that the user will select the related domain.
static bool IsPreconnectable(AutocompleteMatch::Type type) { static bool IsPreconnectable(AutocompleteMatch::Type type) {
...@@ -799,38 +795,3 @@ bool AutocompleteEditModel::GetURLForText(const std::wstring& text, ...@@ -799,38 +795,3 @@ bool AutocompleteEditModel::GetURLForText(const std::wstring& text,
*url = parsed_url; *url = parsed_url;
return true; 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);
}
...@@ -56,9 +56,6 @@ class AutocompleteEditController { ...@@ -56,9 +56,6 @@ class AutocompleteEditController {
// Returns false if there is no instant preview showing. // Returns false if there is no instant preview showing.
virtual bool AcceptCurrentInstantPreview() = 0; 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|. // Invoked when the popup is going to change its bounds to |bounds|.
virtual void OnPopupBoundsChanged(const gfx::Rect& bounds) = 0; virtual void OnPopupBoundsChanged(const gfx::Rect& bounds) = 0;
...@@ -339,9 +336,6 @@ class AutocompleteEditModel : public NotificationObserver { ...@@ -339,9 +336,6 @@ class AutocompleteEditModel : public NotificationObserver {
// Invoked when the popup is going to change its bounds to |bounds|. // Invoked when the popup is going to change its bounds to |bounds|.
void PopupBoundsChangedTo(const gfx::Rect& bounds); void PopupBoundsChangedTo(const gfx::Rect& bounds);
// Invoked when the autocomplete results may have changed in some way.
void ResultsUpdated();
private: private:
enum PasteState { enum PasteState {
NONE, // Most recent edit was not a paste that replaced all text. NONE, // Most recent edit was not a paste that replaced all text.
...@@ -399,10 +393,6 @@ class AutocompleteEditModel : public NotificationObserver { ...@@ -399,10 +393,6 @@ class AutocompleteEditModel : public NotificationObserver {
// copy. // copy.
bool GetURLForText(const std::wstring& text, GURL* url) const; bool GetURLForText(const std::wstring& text, GURL* url) const;
// Determines the suggested search text and invokes OnSetSuggestedSearchText
// on the controller.
void UpdateSuggestedSearchText();
AutocompleteEditView* view_; AutocompleteEditView* view_;
AutocompletePopupModel* popup_; AutocompletePopupModel* popup_;
......
...@@ -81,7 +81,6 @@ class TestingAutocompleteEditController : public AutocompleteEditController { ...@@ -81,7 +81,6 @@ class TestingAutocompleteEditController : public AutocompleteEditController {
virtual bool AcceptCurrentInstantPreview() { virtual bool AcceptCurrentInstantPreview() {
return false; return false;
} }
virtual void OnSetSuggestedSearchText(const string16& suggested_text) {}
virtual void OnPopupBoundsChanged(const gfx::Rect& bounds) {} virtual void OnPopupBoundsChanged(const gfx::Rect& bounds) {}
virtual void OnAutocompleteAccept(const GURL& url, virtual void OnAutocompleteAccept(const GURL& url,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
......
...@@ -318,7 +318,6 @@ void AutocompletePopupModel::Observe(NotificationType type, ...@@ -318,7 +318,6 @@ void AutocompletePopupModel::Observe(NotificationType type,
SetHoveredLine(kNoMatch); SetHoveredLine(kNoMatch);
view_->UpdatePopupAppearance(); view_->UpdatePopupAppearance();
edit_model_->ResultsUpdated();
edit_model_->PopupBoundsChangedTo(view_->GetTargetBounds()); edit_model_->PopupBoundsChangedTo(view_->GetTargetBounds());
} }
......
...@@ -134,7 +134,6 @@ class LocationBarViewMac : public AutocompleteEditController, ...@@ -134,7 +134,6 @@ class LocationBarViewMac : public AutocompleteEditController,
virtual void OnAutocompleteWillAccept(); virtual void OnAutocompleteWillAccept();
virtual bool OnCommitSuggestedText(const std::wstring& typed_text); virtual bool OnCommitSuggestedText(const std::wstring& typed_text);
virtual bool AcceptCurrentInstantPreview(); virtual bool AcceptCurrentInstantPreview();
virtual void OnSetSuggestedSearchText(const string16& suggested_text);
virtual void OnPopupBoundsChanged(const gfx::Rect& bounds); virtual void OnPopupBoundsChanged(const gfx::Rect& bounds);
virtual void OnAutocompleteAccept(const GURL& url, virtual void OnAutocompleteAccept(const GURL& url,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
......
...@@ -256,11 +256,6 @@ bool LocationBarViewMac::AcceptCurrentInstantPreview() { ...@@ -256,11 +256,6 @@ bool LocationBarViewMac::AcceptCurrentInstantPreview() {
return InstantController::CommitIfCurrent(browser_->instant()); return InstantController::CommitIfCurrent(browser_->instant());
} }
void LocationBarViewMac::OnSetSuggestedSearchText(
const string16& suggested_text) {
SetSuggestedText(suggested_text);
}
void LocationBarViewMac::OnPopupBoundsChanged(const gfx::Rect& bounds) { void LocationBarViewMac::OnPopupBoundsChanged(const gfx::Rect& bounds) {
InstantController* instant = browser_->instant(); InstantController* instant = browser_->instant();
if (instant) if (instant)
......
...@@ -467,11 +467,6 @@ bool LocationBarViewGtk::AcceptCurrentInstantPreview() { ...@@ -467,11 +467,6 @@ bool LocationBarViewGtk::AcceptCurrentInstantPreview() {
return InstantController::CommitIfCurrent(browser_->instant()); return InstantController::CommitIfCurrent(browser_->instant());
} }
void LocationBarViewGtk::OnSetSuggestedSearchText(
const string16& suggested_text) {
SetSuggestedText(suggested_text);
}
void LocationBarViewGtk::OnPopupBoundsChanged(const gfx::Rect& bounds) { void LocationBarViewGtk::OnPopupBoundsChanged(const gfx::Rect& bounds) {
InstantController* instant = browser_->instant(); InstantController* instant = browser_->instant();
if (instant) if (instant)
......
...@@ -97,7 +97,6 @@ class LocationBarViewGtk : public AutocompleteEditController, ...@@ -97,7 +97,6 @@ class LocationBarViewGtk : public AutocompleteEditController,
// For this implementation, the parameter is ignored. // For this implementation, the parameter is ignored.
virtual bool OnCommitSuggestedText(const std::wstring& typed_text); virtual bool OnCommitSuggestedText(const std::wstring& typed_text);
virtual bool AcceptCurrentInstantPreview(); virtual bool AcceptCurrentInstantPreview();
virtual void OnSetSuggestedSearchText(const string16& suggested_text);
virtual void OnPopupBoundsChanged(const gfx::Rect& bounds); virtual void OnPopupBoundsChanged(const gfx::Rect& bounds);
virtual void OnAutocompleteAccept(const GURL& url, virtual void OnAutocompleteAccept(const GURL& url,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
......
...@@ -786,10 +786,6 @@ bool LocationBarView::AcceptCurrentInstantPreview() { ...@@ -786,10 +786,6 @@ bool LocationBarView::AcceptCurrentInstantPreview() {
return InstantController::CommitIfCurrent(delegate_->GetInstant()); return InstantController::CommitIfCurrent(delegate_->GetInstant());
} }
void LocationBarView::OnSetSuggestedSearchText(const string16& suggested_text) {
SetSuggestedText(suggested_text);
}
void LocationBarView::OnPopupBoundsChanged(const gfx::Rect& bounds) { void LocationBarView::OnPopupBoundsChanged(const gfx::Rect& bounds) {
InstantController* instant = delegate_->GetInstant(); InstantController* instant = delegate_->GetInstant();
if (instant) if (instant)
......
...@@ -197,7 +197,6 @@ class LocationBarView : public LocationBar, ...@@ -197,7 +197,6 @@ class LocationBarView : public LocationBar,
virtual void OnAutocompleteWillAccept(); virtual void OnAutocompleteWillAccept();
virtual bool OnCommitSuggestedText(const std::wstring& typed_text); virtual bool OnCommitSuggestedText(const std::wstring& typed_text);
virtual bool AcceptCurrentInstantPreview(); virtual bool AcceptCurrentInstantPreview();
virtual void OnSetSuggestedSearchText(const string16& suggested_text);
virtual void OnPopupBoundsChanged(const gfx::Rect& bounds); virtual void OnPopupBoundsChanged(const gfx::Rect& bounds);
virtual void OnAutocompleteAccept(const GURL& url, virtual void OnAutocompleteAccept(const GURL& url,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
......
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