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

Side by Side Diff: webkit/appcache/appcache_interceptor.h

Issue 5384002: net: Remove typedef net::URLRequest URLRequest; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 10 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WEBKIT_APPCACHE_APPCACHE_INTERCEPTOR_H_ 5 #ifndef WEBKIT_APPCACHE_APPCACHE_INTERCEPTOR_H_
6 #define WEBKIT_APPCACHE_APPCACHE_INTERCEPTOR_H_ 6 #define WEBKIT_APPCACHE_APPCACHE_INTERCEPTOR_H_
7 7
8 #include "base/singleton.h" 8 #include "base/singleton.h"
9 #include "googleurl/src/gurl.h" 9 #include "googleurl/src/gurl.h"
10 #include "net/url_request/url_request.h" 10 #include "net/url_request/url_request.h"
11 #include "webkit/glue/resource_type.h" 11 #include "webkit/glue/resource_type.h"
12 12
13 namespace appcache { 13 namespace appcache {
14 14
15 class AppCacheRequestHandler; 15 class AppCacheRequestHandler;
16 class AppCacheService; 16 class AppCacheService;
17 17
18 // An interceptor to hijack requests and potentially service them out of 18 // An interceptor to hijack requests and potentially service them out of
19 // the appcache. 19 // the appcache.
20 class AppCacheInterceptor : public URLRequest::Interceptor { 20 class AppCacheInterceptor : public net::URLRequest::Interceptor {
21 public: 21 public:
22 // Registers a singleton instance with the net library. 22 // Registers a singleton instance with the net library.
23 // Should be called early in the IO thread prior to initiating requests. 23 // Should be called early in the IO thread prior to initiating requests.
24 static void EnsureRegistered() { 24 static void EnsureRegistered() {
25 CHECK(instance()); 25 CHECK(instance());
26 } 26 }
27 27
28 // Must be called to make a request eligible for retrieval from an appcache. 28 // Must be called to make a request eligible for retrieval from an appcache.
29 static void SetExtraRequestInfo(URLRequest* request, 29 static void SetExtraRequestInfo(net::URLRequest* request,
30 AppCacheService* service, 30 AppCacheService* service,
31 int process_id, 31 int process_id,
32 int host_id, 32 int host_id,
33 ResourceType::Type resource_type); 33 ResourceType::Type resource_type);
34 34
35 // May be called after response headers are complete to retrieve extra 35 // May be called after response headers are complete to retrieve extra
36 // info about the response. 36 // info about the response.
37 static void GetExtraResponseInfo(URLRequest* request, 37 static void GetExtraResponseInfo(net::URLRequest* request,
38 int64* cache_id, 38 int64* cache_id,
39 GURL* manifest_url); 39 GURL* manifest_url);
40 40
41 protected: 41 protected:
42 // URLRequest::Interceptor overrides 42 // Overridde from net::URLRequest::Interceptor:
43 virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request); 43 virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request);
44 virtual net::URLRequestJob* MaybeInterceptResponse(net::URLRequest* request); 44 virtual net::URLRequestJob* MaybeInterceptResponse(net::URLRequest* request);
45 virtual net::URLRequestJob* MaybeInterceptRedirect(net::URLRequest* request, 45 virtual net::URLRequestJob* MaybeInterceptRedirect(net::URLRequest* request,
46 const GURL& location); 46 const GURL& location);
47 47
48 private: 48 private:
49 friend struct DefaultSingletonTraits<AppCacheInterceptor>; 49 friend struct DefaultSingletonTraits<AppCacheInterceptor>;
50 50
51 static AppCacheInterceptor* instance() { 51 static AppCacheInterceptor* instance() {
52 return Singleton<AppCacheInterceptor>::get(); 52 return Singleton<AppCacheInterceptor>::get();
53 } 53 }
54 54
55 AppCacheInterceptor(); 55 AppCacheInterceptor();
56 virtual ~AppCacheInterceptor(); 56 virtual ~AppCacheInterceptor();
57 57
58 static void SetHandler(net::URLRequest* request, 58 static void SetHandler(net::URLRequest* request,
59 AppCacheRequestHandler* handler); 59 AppCacheRequestHandler* handler);
60 static AppCacheRequestHandler* GetHandler(net::URLRequest* request); 60 static AppCacheRequestHandler* GetHandler(net::URLRequest* request);
61 61
62 DISALLOW_COPY_AND_ASSIGN(AppCacheInterceptor); 62 DISALLOW_COPY_AND_ASSIGN(AppCacheInterceptor);
63 }; 63 };
64 64
65 } // namespace appcache 65 } // namespace appcache
66 66
67 #endif // WEBKIT_APPCACHE_APPCACHE_INTERCEPTOR_H_ 67 #endif // WEBKIT_APPCACHE_APPCACHE_INTERCEPTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698