Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6277)

Unified Diff: chrome/browser/ui/search/new_tab_page_interceptor_service.h

Issue 845973005: [New Tab Page] Change the mechanism to intercept online NTP errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moved to profile_io_data Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/search/new_tab_page_interceptor_service.h
diff --git a/chrome/browser/ui/search/new_tab_page_interceptor_service.h b/chrome/browser/ui/search/new_tab_page_interceptor_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..0226b13b65c9e11adef3f1a082bf26927e1bc4cf
--- /dev/null
+++ b/chrome/browser/ui/search/new_tab_page_interceptor_service.h
@@ -0,0 +1,45 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_SEARCH_NEW_TAB_PAGE_INTERCEPTOR_SERVICE_H_
+#define CHROME_BROWSER_UI_SEARCH_NEW_TAB_PAGE_INTERCEPTOR_SERVICE_H_
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "components/keyed_service/core/keyed_service.h"
+#include "components/search_engines/template_url_service_observer.h"
+
+class NewTabPageInterceptor;
+class Profile;
+class TemplateURLService;
+
+namespace net {
+class URLRequestInterceptor;
+}
+
+// Owns a NewTabPageInterceptor.
+class NewTabPageInterceptorService : public KeyedService,
+ public TemplateURLServiceObserver {
+ public:
+ explicit NewTabPageInterceptorService(Profile* profile);
+ ~NewTabPageInterceptorService() override;
+
+ // TemplateURLServiceObserver override.
+ void OnTemplateURLServiceChanged() override;
+
+ scoped_ptr<net::URLRequestInterceptor> CreateInterceptor();
+
+ private:
+ Profile* profile_;
+ base::WeakPtr<NewTabPageInterceptor> interceptor_;
+ // The TemplateURLService that we are observing. It will outlive this
+ // NewTabPageInterceptorService due to the dependency declared in
+ // NewTabPageInterceptorServiceFactory.
+ TemplateURLService* template_url_service_;
+
+ DISALLOW_COPY_AND_ASSIGN(NewTabPageInterceptorService);
+};
+
+#endif // CHROME_BROWSER_UI_SEARCH_NEW_TAB_PAGE_INTERCEPTOR_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698