Index: chrome/browser/ui/toolbar/toolbar_model_impl.cc |
diff --git a/chrome/browser/ui/toolbar/toolbar_model_impl.cc b/chrome/browser/ui/toolbar/toolbar_model_impl.cc |
index 64a3716f5ea591a6d5c9b0e4a8fdadcac3c62dab..ba4ae9fb8eae60af51dd8a7f39961088210b4ef2 100644 |
--- a/chrome/browser/ui/toolbar/toolbar_model_impl.cc |
+++ b/chrome/browser/ui/toolbar/toolbar_model_impl.cc |
@@ -1,4 +1,3 @@ |
-// Copyright 2012 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -49,10 +48,23 @@ ToolbarModelImpl::~ToolbarModelImpl() { |
// ToolbarModelImpl Implementation. |
string16 ToolbarModelImpl::GetText( |
bool display_search_urls_as_search_terms) const { |
+ NavigationEntry* entry; |
if (display_search_urls_as_search_terms) { |
+ const NavigationController* navigation_controller = |
+ GetNavigationController(); |
+ if (navigation_controller) { |
+ entry = navigation_controller->GetVisibleEntry(); |
+ if (entry && !entry->GetSearchTerms().empty()) { |
+ // Entry has existing search terms. |
+ return entry->GetSearchTerms(); |
+ } |
+ } |
string16 search_terms = TryToExtractSearchTermsFromURL(); |
- if (!search_terms.empty()) |
+ if (!search_terms.empty()) { |
+ if (entry) |
+ entry->SetSearchTerms(search_terms); |
return search_terms; |
+ } |
} |
std::string languages; // Empty if we don't have a |navigation_controller|. |
Profile* profile = GetProfile(); |