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

Unified Diff: chrome/browser/component_updater/component_updater_interceptor.h

Issue 11293252: Change Interceptors into URLRequestJobFactory::ProtocolHandlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some cleanup Created 8 years, 1 month 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/component_updater/component_updater_interceptor.h
diff --git a/chrome/browser/component_updater/component_updater_interceptor.h b/chrome/browser/component_updater/component_updater_interceptor.h
index 67b91992782e6639d4ef41054635f55260f4f7c6..9b674b738ee001a34ae5b5807bdf2065dee4062a 100644
--- a/chrome/browser/component_updater/component_updater_interceptor.h
+++ b/chrome/browser/component_updater/component_updater_interceptor.h
@@ -10,8 +10,9 @@
#include "base/compiler_specific.h"
#include "base/file_path.h"
+#include "base/memory/ref_counted.h"
#include "googleurl/src/gurl.h"
-#include "net/url_request/url_request.h"
+#include "net/url_request/url_request_job_factory.h"
#if !defined(UNIT_TEST)
#error "use this class only in unit tests"
@@ -19,11 +20,10 @@
// This url request interceptor lets us respond to localhost http request urls
// with the contents of files on disk for use in tests.
-class ComponentUpdateInterceptor
- : public net::URLRequest::Interceptor,
- public base::RefCountedThreadSafe<ComponentUpdateInterceptor> {
+class ComponentUpdateInterceptor {
public:
ComponentUpdateInterceptor();
+ virtual ~ComponentUpdateInterceptor();
// When requests for |url| arrive, respond with the contents of |path|. The
// hostname of |url| must be "localhost" to avoid DNS lookups, and the scheme
@@ -33,26 +33,12 @@ class ComponentUpdateInterceptor
const FilePath& path);
// Returns how many requests have been issued that have a stored reply.
- int hit_count() const { return hit_count_; }
+ int GetHitCount();
private:
- // When computing matches, this ignores the query parameters of the url.
- virtual net::URLRequestJob* MaybeIntercept(
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate) OVERRIDE;
-
- friend class base::RefCountedThreadSafe<ComponentUpdateInterceptor>;
-
- virtual ~ComponentUpdateInterceptor();
-
- struct Response {
- FilePath data_path;
- std::string headers;
- };
+ class Delegate;
- typedef std::map<GURL, Response> ResponseMap;
- ResponseMap responses_;
- int hit_count_;
+ Delegate* delegate_;
DISALLOW_COPY_AND_ASSIGN(ComponentUpdateInterceptor);
};

Powered by Google App Engine
This is Rietveld 408576698