Dismiss autofill popup on screen orientation change.
[chromium-blink-merge.git] / webkit / browser / appcache / appcache_interceptor.h
blobb1db1c0628ec5e81eb52f6eab8b43bca2db3f336
1 // Copyright (c) 2011 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 WEBKIT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_
6 #define WEBKIT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_
8 #include "base/memory/singleton.h"
9 #include "net/url_request/url_request.h"
10 #include "url/gurl.h"
11 #include "webkit/browser/webkit_storage_browser_export.h"
12 #include "webkit/common/resource_type.h"
14 namespace appcache {
16 class AppCacheRequestHandler;
17 class AppCacheService;
19 // An interceptor to hijack requests and potentially service them out of
20 // the appcache.
21 class WEBKIT_STORAGE_BROWSER_EXPORT AppCacheInterceptor
22 : public net::URLRequest::Interceptor {
23 public:
24 // Registers a singleton instance with the net library.
25 // Should be called early in the IO thread prior to initiating requests.
26 static void EnsureRegistered() {
27 CHECK(GetInstance());
30 // Must be called to make a request eligible for retrieval from an appcache.
31 static void SetExtraRequestInfo(net::URLRequest* request,
32 AppCacheService* service,
33 int process_id,
34 int host_id,
35 ResourceType::Type resource_type);
37 // May be called after response headers are complete to retrieve extra
38 // info about the response.
39 static void GetExtraResponseInfo(net::URLRequest* request,
40 int64* cache_id,
41 GURL* manifest_url);
43 static AppCacheInterceptor* GetInstance();
45 protected:
46 // Override from net::URLRequest::Interceptor:
47 virtual net::URLRequestJob* MaybeIntercept(
48 net::URLRequest* request,
49 net::NetworkDelegate* network_delegate) OVERRIDE;
50 virtual net::URLRequestJob* MaybeInterceptResponse(
51 net::URLRequest* request,
52 net::NetworkDelegate* network_delegate) OVERRIDE;
53 virtual net::URLRequestJob* MaybeInterceptRedirect(
54 net::URLRequest* request,
55 net::NetworkDelegate* network_delegate,
56 const GURL& location) OVERRIDE;
58 private:
59 friend struct DefaultSingletonTraits<AppCacheInterceptor>;
61 AppCacheInterceptor();
62 virtual ~AppCacheInterceptor();
64 static void SetHandler(net::URLRequest* request,
65 AppCacheRequestHandler* handler);
66 static AppCacheRequestHandler* GetHandler(net::URLRequest* request);
68 DISALLOW_COPY_AND_ASSIGN(AppCacheInterceptor);
71 } // namespace appcache
73 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_