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 1d20fa01495539b225dd6be8e8abb57730a8a069..55bc148a788e0bcf375f7137215569179d3b60a8 100644 |
| --- a/chrome/browser/ui/toolbar/toolbar_model_impl.cc |
| +++ b/chrome/browser/ui/toolbar/toolbar_model_impl.cc |
| @@ -8,6 +8,7 @@ |
| #include "base/utf_string_conversions.h" |
| #include "chrome/browser/autocomplete/autocomplete_input.h" |
| #include "chrome/browser/google/google_util.h" |
| +#include "chrome/browser/instant/instant_controller.h" |
| #include "chrome/browser/prefs/pref_service.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/search_engines/template_url.h" |
| @@ -72,6 +73,17 @@ ToolbarModelImpl::~ToolbarModelImpl() { |
| string16 ToolbarModelImpl::GetText( |
| bool display_search_urls_as_search_terms) const { |
| if (display_search_urls_as_search_terms) { |
| + // If search terms were set explicitely on the NavigationEntry, use those. |
|
sky
2013/01/16 22:32:37
explicitly
Mathieu
2013/01/17 15:59:29
Done.
|
| + NavigationController* controller = GetNavigationController(); |
| + if (controller) { |
| + NavigationEntry* entry = controller->GetVisibleEntry(); |
| + if (entry) { |
| + string16 out_value; |
| + if (entry->GetExtraData(InstantController::kSearchTermsKey, |
| + &out_value)) |
| + return out_value; |
| + } |
| + } |
| string16 search_terms = TryToExtractSearchTermsFromURL(); |
| if (!search_terms.empty()) |
| return search_terms; |