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( |