OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_SEARCH_NEW_TAB_PAGE_INTERCEPTOR_SERVICE_H_ |
| 6 #define CHROME_BROWSER_UI_SEARCH_NEW_TAB_PAGE_INTERCEPTOR_SERVICE_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "components/keyed_service/core/keyed_service.h" |
| 12 #include "components/search_engines/template_url_service_observer.h" |
| 13 |
| 14 class NewTabPageInterceptor; |
| 15 class Profile; |
| 16 class TemplateURLService; |
| 17 |
| 18 namespace net { |
| 19 class URLRequestInterceptor; |
| 20 } |
| 21 |
| 22 // Owns a NewTabPageInterceptor. |
| 23 class NewTabPageInterceptorService : public KeyedService, |
| 24 public TemplateURLServiceObserver { |
| 25 public: |
| 26 explicit NewTabPageInterceptorService(Profile* profile); |
| 27 ~NewTabPageInterceptorService() override; |
| 28 |
| 29 // TemplateURLServiceObserver override. |
| 30 void OnTemplateURLServiceChanged() override; |
| 31 |
| 32 scoped_ptr<net::URLRequestInterceptor> CreateInterceptor(); |
| 33 |
| 34 private: |
| 35 Profile* profile_; |
| 36 base::WeakPtr<NewTabPageInterceptor> interceptor_; |
| 37 // The TemplateURLService that we are observing. It will outlive this |
| 38 // NewTabPageInterceptorService due to the dependency declared in |
| 39 // NewTabPageInterceptorServiceFactory. |
| 40 TemplateURLService* template_url_service_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(NewTabPageInterceptorService); |
| 43 }; |
| 44 |
| 45 #endif // CHROME_BROWSER_UI_SEARCH_NEW_TAB_PAGE_INTERCEPTOR_SERVICE_H_ |
OLD | NEW |