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 c36cad8f18c4a95cdad1b152c92d0a5434947b9f..6c4ed1155907485014bfcaaec952bfe3a6504353 100644 |
| --- a/chrome/browser/ui/browser_instant_controller.cc |
| +++ b/chrome/browser/ui/browser_instant_controller.cc |
| @@ -5,16 +5,12 @@ |
| #include "chrome/browser/ui/browser_instant_controller.h" |
| #include "base/bind.h" |
| -#include "base/prefs/pref_service.h" |
| #include "chrome/browser/extensions/extension_service.h" |
| #include "chrome/browser/extensions/extension_web_ui.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/search/instant_service.h" |
| #include "chrome/browser/search/instant_service_factory.h" |
| #include "chrome/browser/search/search.h" |
| -#include "chrome/browser/search_engines/template_url.h" |
| -#include "chrome/browser/search_engines/template_url_service.h" |
| -#include "chrome/browser/search_engines/template_url_service_factory.h" |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/browser_window.h" |
| #include "chrome/browser/ui/omnibox/location_bar.h" |
| @@ -24,9 +20,7 @@ |
| #include "chrome/browser/ui/search/search_tab_helper.h" |
| #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| -#include "chrome/common/pref_names.h" |
| #include "chrome/common/url_constants.h" |
| -#include "components/user_prefs/pref_registry_syncable.h" |
| #include "content/public/browser/render_process_host.h" |
| #include "content/public/browser/user_metrics.h" |
| #include "content/public/browser/web_contents.h" |
| @@ -40,11 +34,6 @@ BrowserInstantController::BrowserInstantController(Browser* browser) |
| : browser_(browser), |
| instant_(this, chrome::IsInstantExtendedAPIEnabled()), |
| instant_unload_handler_(browser) { |
| - profile_pref_registrar_.Init(profile()->GetPrefs()); |
| - profile_pref_registrar_.Add( |
| - prefs::kDefaultSearchProviderID, |
| - base::Bind(&BrowserInstantController::OnDefaultSearchProviderChanged, |
| - base::Unretained(this))); |
| browser_->search_model()->AddObserver(this); |
| InstantService* instant_service = |
| @@ -223,23 +212,19 @@ void BrowserInstantController::ModelChanged( |
| instant_.InstantSupportChanged(new_state.instant_support); |
| } |
| -void BrowserInstantController::OnDefaultSearchProviderChanged( |
| - const std::string& pref_name) { |
| - DCHECK_EQ(pref_name, std::string(prefs::kDefaultSearchProviderID)); |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// BrowserInstantController, InstantServiceObserver implementation: |
| - Profile* browser_profile = profile(); |
| - const TemplateURL* template_url = |
| - TemplateURLServiceFactory::GetForProfile(browser_profile)-> |
| - GetDefaultSearchProvider(); |
| - if (!template_url) { |
| - // A NULL |template_url| could mean either this notification is sent during |
| - // the browser start up operation or the user now has no default search |
| - // provider. There is no way for the user to reach this state using the |
| - // Chrome settings. Only explicitly poking at the DB or bugs in the Sync |
| - // could cause that, neither of which we support. |
| - return; |
| - } |
| +void BrowserInstantController::DefaultSearchProviderChanged() { |
| + MaybeReloadInstantWebContents(); |
| +} |
| + |
| +void BrowserInstantController::GoogleURLUpdated() { |
| + MaybeReloadInstantWebContents(); |
| +} |
| +void BrowserInstantController::MaybeReloadInstantWebContents() { |
| + Profile* browser_profile = profile(); |
|
samarth
2013/07/26 23:33:15
Just inline this call below.
Anuj
2013/07/31 07:16:18
Done.
|
| InstantService* instant_service = |
| InstantServiceFactory::GetForProfile(browser_profile); |
| if (!instant_service) |