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

Unified Diff: chrome/browser/ui/search/new_tab_page_interceptor.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: template url service observer 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.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_

Powered by Google App Engine
This is Rietveld 408576698