Use multiline attribute to check for IA2_STATE_MULTILINE.
[chromium-blink-merge.git] / content / browser / appcache / appcache_interceptor.h
blobbe8110daabb2e2767f0fe96fb363fb6befee1bcb
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_
8 #include "base/basictypes.h"
9 #include "content/common/content_export.h"
10 #include "content/public/common/resource_type.h"
11 #include "net/url_request/url_request_interceptor.h"
13 class GURL;
15 namespace net {
16 class URLRequest;
19 namespace content {
20 class AppCacheRequestHandler;
21 class AppCacheServiceImpl;
23 // An interceptor to hijack requests and potentially service them out of
24 // the appcache.
25 class CONTENT_EXPORT AppCacheInterceptor : public net::URLRequestInterceptor {
26 public:
27 // Must be called to make a request eligible for retrieval from an appcache.
28 static void SetExtraRequestInfo(net::URLRequest* request,
29 AppCacheServiceImpl* service,
30 int process_id,
31 int host_id,
32 ResourceType resource_type,
33 bool should_reset_appcache);
35 // May be called after response headers are complete to retrieve extra
36 // info about the response.
37 static void GetExtraResponseInfo(net::URLRequest* request,
38 int64* cache_id,
39 GURL* manifest_url);
41 // Methods to support cross site navigations.
42 static void PrepareForCrossSiteTransfer(net::URLRequest* request,
43 int old_process_id);
44 static void CompleteCrossSiteTransfer(net::URLRequest* request,
45 int new_process_id,
46 int new_host_id);
47 static void MaybeCompleteCrossSiteTransferInOldProcess(
48 net::URLRequest* request,
49 int old_process_id);
51 AppCacheInterceptor();
52 ~AppCacheInterceptor() override;
54 protected:
55 // Override from net::URLRequestInterceptor:
56 net::URLRequestJob* MaybeInterceptRequest(
57 net::URLRequest* request,
58 net::NetworkDelegate* network_delegate) const override;
59 net::URLRequestJob* MaybeInterceptResponse(
60 net::URLRequest* request,
61 net::NetworkDelegate* network_delegate) const override;
62 net::URLRequestJob* MaybeInterceptRedirect(
63 net::URLRequest* request,
64 net::NetworkDelegate* network_delegate,
65 const GURL& location) const override;
67 private:
68 static void SetHandler(net::URLRequest* request,
69 AppCacheRequestHandler* handler);
70 static AppCacheRequestHandler* GetHandler(net::URLRequest* request);
72 DISALLOW_COPY_AND_ASSIGN(AppCacheInterceptor);
75 } // namespace content
77 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_