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

Side by Side Diff: content/browser/appcache/appcache_interceptor.h

Issue 625433002: Pages controlled by ServiceWorkers should not participate in AppCaching (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CONTENT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_ 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_ 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_
7 7
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 #include "content/public/common/resource_type.h" 10 #include "content/public/common/resource_type.h"
11 #include "net/url_request/url_request.h" 11 #include "net/url_request/url_request.h"
12 #include "net/url_request/url_request_interceptor.h"
12 #include "url/gurl.h" 13 #include "url/gurl.h"
13 14
14 namespace content { 15 namespace content {
15 class AppCacheRequestHandler; 16 class AppCacheRequestHandler;
16 class AppCacheServiceImpl; 17 class AppCacheServiceImpl;
17 18
18 // An interceptor to hijack requests and potentially service them out of 19 // An interceptor to hijack requests and potentially service them out of
19 // the appcache. 20 // the appcache.
20 class CONTENT_EXPORT AppCacheInterceptor 21 class CONTENT_EXPORT AppCacheInterceptor
21 : public net::URLRequest::Interceptor { 22 : public net::URLRequest::Interceptor {
(...skipping 19 matching lines...) Expand all
41 42
42 // Methods to support cross site navigations. 43 // Methods to support cross site navigations.
43 static void PrepareForCrossSiteTransfer(net::URLRequest* request, 44 static void PrepareForCrossSiteTransfer(net::URLRequest* request,
44 int old_process_id); 45 int old_process_id);
45 static void CompleteCrossSiteTransfer(net::URLRequest* request, 46 static void CompleteCrossSiteTransfer(net::URLRequest* request,
46 int new_process_id, 47 int new_process_id,
47 int new_host_id); 48 int new_host_id);
48 49
49 static AppCacheInterceptor* GetInstance(); 50 static AppCacheInterceptor* GetInstance();
50 51
52 // The appcache system employs two different interceptors. The singleton
53 // AppCacheInterceptor derives URLRequest::Interceptor and is used
54 // to hijack request handling upon receipt of the response or a redirect.
55 // A separate URLRequestInterceptor derivative is used to hijack handling
56 // at the very start of request processing. The separate handler allows the
57 // content lib to order its collection of net::URLRequestInterceptors.
58 static scoped_ptr<net::URLRequestInterceptor> CreateStartInterceptor();
59
51 protected: 60 protected:
52 // Override from net::URLRequest::Interceptor: 61 // Override from net::URLRequest::Interceptor:
53 virtual net::URLRequestJob* MaybeIntercept( 62 virtual net::URLRequestJob* MaybeIntercept(
54 net::URLRequest* request, 63 net::URLRequest* request,
55 net::NetworkDelegate* network_delegate) override; 64 net::NetworkDelegate* network_delegate) override;
56 virtual net::URLRequestJob* MaybeInterceptResponse( 65 virtual net::URLRequestJob* MaybeInterceptResponse(
57 net::URLRequest* request, 66 net::URLRequest* request,
58 net::NetworkDelegate* network_delegate) override; 67 net::NetworkDelegate* network_delegate) override;
59 virtual net::URLRequestJob* MaybeInterceptRedirect( 68 virtual net::URLRequestJob* MaybeInterceptRedirect(
60 net::URLRequest* request, 69 net::URLRequest* request,
61 net::NetworkDelegate* network_delegate, 70 net::NetworkDelegate* network_delegate,
62 const GURL& location) override; 71 const GURL& location) override;
63 72
64 private: 73 private:
65 friend struct DefaultSingletonTraits<AppCacheInterceptor>; 74 friend struct DefaultSingletonTraits<AppCacheInterceptor>;
75 class StartInterceptor;
66 76
67 AppCacheInterceptor(); 77 AppCacheInterceptor();
68 virtual ~AppCacheInterceptor(); 78 virtual ~AppCacheInterceptor();
69 79
70 static void SetHandler(net::URLRequest* request, 80 static void SetHandler(net::URLRequest* request,
71 AppCacheRequestHandler* handler); 81 AppCacheRequestHandler* handler);
72 static AppCacheRequestHandler* GetHandler(net::URLRequest* request); 82 static AppCacheRequestHandler* GetHandler(net::URLRequest* request);
73 83
74 DISALLOW_COPY_AND_ASSIGN(AppCacheInterceptor); 84 DISALLOW_COPY_AND_ASSIGN(AppCacheInterceptor);
75 }; 85 };
76 86
77 } // namespace content 87 } // namespace content
78 88
79 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_ 89 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_host.cc ('k') | content/browser/appcache/appcache_interceptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698