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

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: Check return value of UpdateSearchState. 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
« no previous file with comments | « chrome/browser/ui/search/instant_extended_browsertest.cc ('k') | chrome/test/data/instant_extended.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/searchbox/searchbox.cc
diff --git a/chrome/renderer/searchbox/searchbox.cc b/chrome/renderer/searchbox/searchbox.cc
index a29ab743f614032a55c9aa791ad041700ae7157e..c2977f89bfe3b791ea105c4b0592fc200a0af94e 100644
--- a/chrome/renderer/searchbox/searchbox.cc
+++ b/chrome/renderer/searchbox/searchbox.cc
@@ -230,15 +230,24 @@ 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(
render_view()->GetWebView()->mainFrame());
}
- Reset();
+
+ if (!query.empty())
+ Reset();
}
void SearchBox::OnCancel(const string16& query) {
« no previous file with comments | « chrome/browser/ui/search/instant_extended_browsertest.cc ('k') | chrome/test/data/instant_extended.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698