Chromium Code Reviews| Index: chrome/browser/ui/browser_instant_controller.cc |
| diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc |
| index c579176157be92fd3cc0490a7f7c3ef1aeb52f6f..f6961a97f5f3f4dfed3e9ef71b4b85f819e3ec34 100644 |
| --- a/chrome/browser/ui/browser_instant_controller.cc |
| +++ b/chrome/browser/ui/browser_instant_controller.cc |
| @@ -21,10 +21,12 @@ |
| #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| #include "chrome/common/instant_types.h" |
| #include "chrome/common/url_constants.h" |
| +#include "content/public/browser/navigation_controller.h" |
| +#include "content/public/browser/navigation_entry.h" |
| #include "content/public/browser/render_process_host.h" |
| #include "content/public/browser/user_metrics.h" |
| #include "content/public/browser/web_contents.h" |
| - |
| +#include "content/public/common/referrer.h" |
| // Helpers -------------------------------------------------------------------- |
| @@ -140,7 +142,8 @@ void BrowserInstantController::ModelChanged( |
| instant_.InstantSupportChanged(new_state.instant_support); |
| } |
| -void BrowserInstantController::DefaultSearchProviderChanged() { |
| +void BrowserInstantController::DefaultSearchProviderChanged( |
| + bool google_base_url_domain_changed) { |
| InstantService* instant_service = |
| InstantServiceFactory::GetForProfile(profile()); |
| if (!instant_service) |
| @@ -157,17 +160,26 @@ void BrowserInstantController::DefaultSearchProviderChanged() { |
| content::RenderProcessHost* rph = contents->GetRenderProcessHost(); |
| instant_service->SendSearchURLsToRenderer(rph); |
| - // Reload the contents to ensure that it gets assigned to a non-priviledged |
| - // renderer. |
| if (!instant_service->IsInstantProcess(rph->GetID())) |
| continue; |
| - contents->GetController().Reload(false); |
| - |
| - // As the reload was not triggered by the user we don't want to close any |
| - // infobars. We have to tell the InfoBarService after the reload, otherwise |
| - // it would ignore this call when |
| - // WebContentsObserver::DidStartNavigationToPendingEntry is invoked. |
| - InfoBarService::FromWebContents(contents)->set_ignore_next_reload(); |
| + if (google_base_url_domain_changed && |
| + SearchTabHelper::FromWebContents(contents)->model()->mode().is_ntp()) { |
| + // Replace the server NTP with the local NTP. |
| + const GURL local_ntp_url = GURL(chrome::kChromeSearchLocalNtpUrl); |
| + content::NavigationController::LoadURLParams params(local_ntp_url); |
|
kmadhusu
2015/02/19 19:55:12
nit: content::NavigationController::LoadURLParams
Mathieu
2015/02/19 20:19:18
Done.
|
| + params.should_replace_current_entry = true; |
|
kmadhusu
2015/02/19 19:55:12
I think you need to override params.transition and
Mathieu
2015/02/19 20:19:18
Done with referrer. Also changed to RELOAD because
Peter Kasting
2015/02/19 21:26:34
SGTM
|
| + contents->GetController().LoadURLWithParams(params); |
| + } else { |
| + // Reload the contents to ensure that it gets assigned to a |
| + // non-priviledged renderer. |
| + contents->GetController().Reload(false); |
| + |
| + // As the reload was not triggered by the user we don't want to close any |
| + // infobars. We have to tell the InfoBarService after the reload, |
| + // otherwise it would ignore this call when |
| + // WebContentsObserver::DidStartNavigationToPendingEntry is invoked. |
| + InfoBarService::FromWebContents(contents)->set_ignore_next_reload(); |
| + } |
| } |
| } |