Index: chrome/browser/instant/instant_controller.cc |
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc |
index 1e63886b896da48c173bbbb985d178fc240b5439..888d54ea4589fac9c6a3c6e9495adb65c0a5df81 100644 |
--- a/chrome/browser/instant/instant_controller.cc |
+++ b/chrome/browser/instant/instant_controller.cc |
@@ -449,29 +449,11 @@ bool InstantController::CommitIfCurrent(InstantCommitType type) { |
content::WebContents* preview = loader_->ReleaseContents(); |
if (extended_enabled_) { |
- // Consider what's happening: |
- // 1. The user has typed a query in the omnibox and committed it (either |
- // by pressing Enter or clicking on the preview). |
- // 2. We commit the preview to the tab strip, and tell the page. |
- // 3. The page will update the URL hash fragment with the query terms. |
- // After steps 1 and 3, the omnibox will show the query terms. However, if |
- // the URL we are committing at step 2 doesn't already have query terms, it |
- // will flash for a brief moment as a plain URL. So, avoid that flicker by |
- // pretending that the plain URL is actually the typed query terms. |
- // TODO(samarth,beaudoin): Instead of this hack, we should add a new field |
- // to NavigationEntry to keep track of what the correct query, if any, is. |
- content::NavigationEntry* entry = |
- preview->GetController().GetVisibleEntry(); |
- std::string url = entry->GetVirtualURL().spec(); |
- if (!google_util::IsInstantExtendedAPIGoogleSearchUrl(url) && |
- google_util::IsGoogleDomainUrl(url, google_util::ALLOW_SUBDOMAIN, |
- google_util::ALLOW_NON_STANDARD_PORTS)) { |
- entry->SetVirtualURL(GURL( |
- url + "#q=" + |
- net::EscapeQueryParamValue(UTF16ToUTF8(last_omnibox_text_), true))); |
- chrome::search::SearchTabHelper::FromWebContents(preview)-> |
- NavigationEntryUpdated(); |
- } |
+ string16 search_terms = last_omnibox_text_; |
+ if (type == INSTANT_COMMIT_FOCUS_LOST && |
+ last_suggestion_.behavior == INSTANT_COMPLETE_NEVER) |
+ search_terms += last_suggestion_.text; |
Jered
2012/12/07 00:16:03
Indent.
Mathieu
2012/12/11 00:30:17
Done.
|
+ preview->GetController().GetVisibleEntry()->SetSearchTerms(search_terms); |
} |
// If the preview page has navigated since the last Update(), we need to add |