Chromium Code Reviews| 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 { |
| + public: |
| + // Constructs the interceptor. |
| + explicit NewTabPageInterceptor(const GURL& new_tab_url); |
| + |
| + // Destroys the interceptor. |
|
mmenke
2015/01/15 22:35:30
nit: Don't think these two comments add anything.
Mathieu
2015/01/22 19:21:58
Done.
|
| + ~NewTabPageInterceptor() override; |
| + |
| + base::WeakPtr<NewTabPageInterceptor> GetWeakPtr(); |
|
mmenke
2015/01/15 22:35:30
Making globally accessible weak pointers is strong
Mathieu
2015/01/22 19:21:58
Let me know if that is what you had in mind.
|
| + |
| + 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); |
|
mmenke
2015/01/15 22:35:30
Should include base/macros.h for DISALLOW_COPY_AND
Mathieu
2015/01/22 19:21:58
Done.
|
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_SEARCH_NEW_TAB_PAGE_INTERCEPTOR_H_ |