summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-24 04:49:34 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-24 04:49:34 +0000
commit4ab4c7c5fd8008de223d1bb7f2361cd80bac9778 (patch)
tree54e963ae4e745d8f9370bf759d171feb99c5af97 /chrome/browser/ui
parent4030ced8df93134f9da566dddd5fcb7e1882307f (diff)
downloadchromium_src-4ab4c7c5fd8008de223d1bb7f2361cd80bac9778.zip
chromium_src-4ab4c7c5fd8008de223d1bb7f2361cd80bac9778.tar.gz
chromium_src-4ab4c7c5fd8008de223d1bb7f2361cd80bac9778.tar.bz2
Makes committing the suggested text only update the default search
provider and nothing else. BUG=none TEST=none Review URL: http://codereview.chromium.org/5270001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67218 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.cc15
1 files changed, 8 insertions, 7 deletions
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 bfcb980..4a23cbc 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -412,10 +412,7 @@ void LocationBarView::OnCommitSuggestedText() {
InstantController* instant = delegate_->GetInstant();
DCHECK(instant);
DCHECK(suggested_text_view_);
- location_entry_->ReplaceSelection(
- WideToUTF16(suggested_text_view_->GetText()));
- // TODO(sky): We need to route the suggestion through InstantController so it
- // doesn't fetch suggestions.
+ OnCommitSuggestedText(location_entry_->GetText());
}
gfx::Size LocationBarView::GetPreferredSize() {
@@ -783,9 +780,8 @@ bool LocationBarView::OnCommitSuggestedText(const std::wstring& typed_text) {
suggested_text_view_->GetText().empty()) {
return false;
}
- // TODO(sky): I may need to route this through InstantController so that we
- // don't fetch suggestions for the new combined text.
- location_entry_->SetUserText(typed_text + suggested_text_view_->GetText());
+ location_entry_->model()->FinalizeInstantQuery(
+ typed_text + suggested_text_view_->GetText());
return true;
}
@@ -846,6 +842,8 @@ void LocationBarView::OnChanged() {
Layout();
SchedulePaint();
+ // TODO(sky): code for updating instant is nearly identical on all platforms.
+ // It sould be pushed to a common place.
InstantController* instant = delegate_->GetInstant();
string16 suggested_text;
if (update_instant_ && instant && GetTabContentsWrapper()) {
@@ -856,8 +854,11 @@ void LocationBarView::OnChanged() {
WideToUTF16(location_entry_->GetText()),
location_entry_->model()->UseVerbatimInstant(),
&suggested_text);
+ if (!instant->IsShowingInstant())
+ location_entry_->model()->FinalizeInstantQuery(std::wstring());
} else {
instant->DestroyPreviewContents();
+ location_entry_->model()->FinalizeInstantQuery(std::wstring());
}
}