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

Unified Diff: chrome/browser/renderer_host/ignore_navigation_resource_throttle.h

Issue 10310124: Implement a ResourceThrottle for URL overriding in Chrome on Android. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix layering problem with unittest Created 8 years, 7 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/renderer_host/ignore_navigation_resource_throttle.h
diff --git a/chrome/browser/renderer_host/ignore_navigation_resource_throttle.h b/chrome/browser/renderer_host/ignore_navigation_resource_throttle.h
new file mode 100644
index 0000000000000000000000000000000000000000..429a964cabbaf7b6d4c5234e717b715620c35f36
--- /dev/null
+++ b/chrome/browser/renderer_host/ignore_navigation_resource_throttle.h
@@ -0,0 +1,41 @@
+// Copyright (c) 2012 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_RENDERER_HOST_IGNORE_NAVIGATION_RESOURCE_THROTTLE_H_
+#define CHROME_BROWSER_RENDERER_HOST_IGNORE_NAVIGATION_RESOURCE_THROTTLE_H_
+#pragma once
+
+#include <string>
+
+#include "base/memory/weak_ptr.h"
+#include "content/public/browser/resource_throttle.h"
+
+namespace net {
+class URLRequest;
+} // namespace net
+
+// This class allows the embedder (via WebContentsDelegate) to selectively
+// ignore top level navigations.
+class IgnoreNavigationResourceThrottle
darin (slow to review) 2012/05/23 18:18:29 nit: this class name suggests unconditional ignori
mkosiba (inactive) 2012/05/28 16:06:52 Done.
+ : public content::ResourceThrottle {
+ public:
+ explicit IgnoreNavigationResourceThrottle(net::URLRequest* request);
+ virtual ~IgnoreNavigationResourceThrottle();
+
+ // content::ResourceThrottle implementation:
+ virtual void WillStartRequest(bool* defer) OVERRIDE;
+ virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE;
+
+ private:
+ bool ShouldDeferRequestForUrl(const GURL& url);
+ void OnResultObtained(bool should_ignore_navigation);
+
+ net::URLRequest* request_;
+ base::WeakPtrFactory<IgnoreNavigationResourceThrottle>
+ weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(IgnoreNavigationResourceThrottle);
+};
+
+#endif // CHROME_BROWSER_RENDERER_HOST_IGNORE_NAVIGATION_RESOURCE_THROTTLE_H_

Powered by Google App Engine
This is Rietveld 408576698