Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: chrome/renderer/searchbox/searchbox.cc

Issue 12895007: Send onsubmit query down to the instant extended overlay page when a navigation is performed from t… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert to original browser test, add comment re potential brittleness for posterity. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/searchbox/searchbox.cc
diff --git a/chrome/renderer/searchbox/searchbox.cc b/chrome/renderer/searchbox/searchbox.cc
index a29ab743f614032a55c9aa791ad041700ae7157e..f4d78aa7ed2651750593d6208dc9594479331743 100644
--- a/chrome/renderer/searchbox/searchbox.cc
+++ b/chrome/renderer/searchbox/searchbox.cc
@@ -230,9 +230,16 @@ void SearchBox::OnChange(const string16& query,
}
void SearchBox::OnSubmit(const string16& query) {
- query_ = query;
- verbatim_ = true;
- selection_start_ = selection_end_ = query_.size();
+ // Submit() is called when the user hits Enter to commit the omnibox text.
+ // If |query| is non-blank, the user committed a search. If it's blank, the
+ // omnibox text was a URL, and the user is navigating to it, in which case
+ // we shouldn't update the |query_| or associated state.
+ if (!query.empty()) {
+ query_ = query;
+ verbatim_ = true;
+ selection_start_ = selection_end_ = query_.size();
+ }
+
if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
DVLOG(1) << render_view() << " OnSubmit";
extensions_v8::SearchBoxExtension::DispatchSubmit(

Powered by Google App Engine
This is Rietveld 408576698