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.
5 #ifndef CHROME_BROWSER_UI_SEARCH_NEW_TAB_PAGE_INTERCEPTOR_SERVICE_H_
6 #define CHROME_BROWSER_UI_SEARCH_NEW_TAB_PAGE_INTERCEPTOR_SERVICE_H_
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"
14 class NewTabPageInterceptor
;
16 class TemplateURLService
;
19 class URLRequestInterceptor
;
22 // Owns a NewTabPageInterceptor.
23 class NewTabPageInterceptorService
: public KeyedService
,
24 public TemplateURLServiceObserver
{
26 explicit NewTabPageInterceptorService(Profile
* profile
);
27 ~NewTabPageInterceptorService() override
;
29 // TemplateURLServiceObserver override.
30 void OnTemplateURLServiceChanged() override
;
32 scoped_ptr
<net::URLRequestInterceptor
> CreateInterceptor();
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_
;
42 DISALLOW_COPY_AND_ASSIGN(NewTabPageInterceptorService
);
45 #endif // CHROME_BROWSER_UI_SEARCH_NEW_TAB_PAGE_INTERCEPTOR_SERVICE_H_