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..d8568434c1c2132c64113e891613d41e6b7ab904 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 explicitly on the NavigationEntry, use those. |
|
samarth
2013/01/17 17:40:45
Factor this out into a GetSearchTermsFromNavigatio
Mathieu
2013/01/18 18:38:05
Done.
|
| + NavigationController* controller = GetNavigationController(); |
| + if (controller) { |
| + NavigationEntry* entry = controller->GetVisibleEntry(); |
| + if (entry) { |
| + string16 out_value; |
| + if (entry->GetExtraData(std::string(InstantController::kSearchTermsKey), |
| + &out_value)) |
| + return out_value; |
| + } |
| + } |
| string16 search_terms = TryToExtractSearchTermsFromURL(); |
| if (!search_terms.empty()) |
| return search_terms; |