Index: chrome/browser/ui/search/new_tab_page_interceptor.h |
diff --git a/chrome/browser/ui/search/new_tab_page_interceptor.h b/chrome/browser/ui/search/new_tab_page_interceptor.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4afdc2f09ce1e43f598eb07bb765dcbb697f6684 |
--- /dev/null |
+++ b/chrome/browser/ui/search/new_tab_page_interceptor.h |
@@ -0,0 +1,39 @@ |
+// 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_H_ |
+#define CHROME_BROWSER_UI_SEARCH_NEW_TAB_PAGE_INTERCEPTOR_H_ |
+ |
+#include "base/memory/weak_ptr.h" |
+#include "net/url_request/url_request_interceptor.h" |
+#include "url/gurl.h" |
+ |
+class NewTabPageInterceptor : public net::URLRequestInterceptor { |
mmenke
2015/01/22 16:35:26
Should have class level documentation.
Mathieu
2015/01/22 19:21:59
Done.
|
+ public: |
+ // Constructs the interceptor. |
+ explicit NewTabPageInterceptor(const GURL& new_tab_url); |
+ |
+ // Destroys the interceptor. |
+ ~NewTabPageInterceptor() override; |
+ |
+ base::WeakPtr<NewTabPageInterceptor> GetWeakPtr(); |
mmenke
2015/01/22 16:35:26
It's generally consider a bad idea to expose these
Mathieu
2015/01/22 19:21:59
Done.
|
+ |
+ void SetNewTabPageURL(const GURL& new_tab_page_url); |
+ |
+ private: |
+ // Overrides from net::URLRequestInterceptor: |
+ net::URLRequestJob* MaybeInterceptRequest( |
+ net::URLRequest* request, |
+ net::NetworkDelegate* network_delegate) const override; |
+ net::URLRequestJob* MaybeInterceptResponse( |
+ net::URLRequest* request, |
+ net::NetworkDelegate* network_delegate) const override; |
+ |
+ GURL new_tab_url_; |
+ base::WeakPtrFactory<NewTabPageInterceptor> weak_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(NewTabPageInterceptor); |
+}; |
+ |
+#endif // CHROME_BROWSER_UI_SEARCH_NEW_TAB_PAGE_INTERCEPTOR_H_ |