Chromium Code Reviews| Index: chrome/browser/search/instant_service.h |
| diff --git a/chrome/browser/search/instant_service.h b/chrome/browser/search/instant_service.h |
| index 393d0721fa06c06b3657c61f5e59482b230145f6..3c57d860956d5e97195441af241f793bd01f52eb 100644 |
| --- a/chrome/browser/search/instant_service.h |
| +++ b/chrome/browser/search/instant_service.h |
| @@ -18,6 +18,7 @@ |
| #include "base/prefs/pref_change_registrar.h" |
| #include "chrome/browser/google/google_url_tracker.h" |
| #include "chrome/browser/history/history_types.h" |
| +#include "chrome/browser/search_engines/template_url_service_observer.h" |
| #include "chrome/browser/ui/search/instant_search_prerenderer.h" |
| #include "chrome/common/instant_types.h" |
| #include "components/keyed_service/core/keyed_service.h" |
| @@ -100,6 +101,16 @@ class InstantService : public KeyedService, |
| int omnibox_start_margin() const { return omnibox_start_margin_; } |
| private: |
| + class DefaultSearchEngineWatcher : public TemplateURLServiceObserver { |
|
Peter Kasting
2014/05/03 00:28:18
What do we gain by having this class instead of ma
erikwright (departed)
2014/05/03 00:54:08
It maintains encapsulation. OnTemplateURLServiceCh
Peter Kasting
2014/05/03 01:18:17
That's fine, you should be declaring that method p
erikwright (departed)
2014/05/03 01:24:59
It's not as though converting from an InstantServi
Peter Kasting
2014/05/03 01:31:01
It requires an explicit upcast or assignment. Tha
erikwright (departed)
2014/05/05 01:49:38
Done.
|
| + public: |
| + explicit DefaultSearchEngineWatcher(InstantService* outer); |
|
Peter Kasting
2014/05/03 00:28:18
Nit: I suggest explicitly declaring a virtual dest
erikwright (departed)
2014/05/05 01:49:38
Done.
|
| + virtual void OnTemplateURLServiceChanged() OVERRIDE; |
| + |
| + private: |
| + InstantService* outer_; |
| + DISALLOW_COPY_AND_ASSIGN(DefaultSearchEngineWatcher); |
|
Peter Kasting
2014/05/03 00:28:18
Tiny nit: I'd put a blank line above this. Also p
erikwright (departed)
2014/05/05 01:49:38
Done.
|
| + }; |
| + |
| friend class InstantExtendedTest; |
| friend class InstantServiceTest; |
| friend class InstantTestBase; |
| @@ -135,7 +146,7 @@ class InstantService : public KeyedService, |
| void OnGoogleURLUpdated(Profile* profile, |
| GoogleURLTracker::UpdatedDetails* details); |
| - void OnDefaultSearchProviderChanged(const std::string& pref_name); |
| + void OnTemplateURLServiceChanged(); |
| void ResetInstantSearchPrerenderer(); |
| @@ -168,6 +179,12 @@ class InstantService : public KeyedService, |
| // Used for Top Sites async retrieval. |
| base::WeakPtrFactory<InstantService> weak_ptr_factory_; |
| + // Used to avoid resetting the instant_prerenderer_ if an unrelated change to |
| + // the TemplateURLService occurs. |
| + GURL current_search_result_prefetch_base_url_; |
| + |
| + DefaultSearchEngineWatcher default_search_engine_watcher_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(InstantService); |
| }; |