Chromium Code Reviews| 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 bb09f298afd909169ccd03eb71e11a86dd4b224a..643e8a407c40e995d4b1a05e3684428d8f48b883 100644 |
| --- a/chrome/browser/ui/toolbar/toolbar_model_impl.cc |
| +++ b/chrome/browser/ui/toolbar/toolbar_model_impl.cc |
| @@ -52,9 +52,22 @@ string16 ToolbarModelImpl::GetText( |
| GURL url(GetURL()); |
| if (display_search_urls_as_search_terms) { |
| + NavigationEntry* entry; |
| + 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(url); |
| - if (!search_terms.empty()) |
| + if (!search_terms.empty()) { |
| + if (entry) |
|
akalin
2012/12/05 19:40:27
bug! entry isn't always initialized
Mathieu
2012/12/05 20:42:16
Done. Thanks.
|
| + entry->SetSearchTerms(search_terms); |
| return search_terms; |
| + } |
| } |
| std::string languages; // Empty if we don't have a |navigation_controller|. |
| Profile* profile = GetProfile(); |