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

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

Issue 5685007: Rename all methods accessing Singleton<T> as GetInstance(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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
« no previous file with comments | « views/widget/root_view.cc ('k') | webkit/appcache/appcache_interceptor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 net::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(GetInstance());
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(net::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(net::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 static AppCacheInterceptor* GetInstance();
42
41 protected: 43 protected:
42 // Overridde from net::URLRequest::Interceptor: 44 // Overridde from net::URLRequest::Interceptor:
43 virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request); 45 virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request);
44 virtual net::URLRequestJob* MaybeInterceptResponse(net::URLRequest* request); 46 virtual net::URLRequestJob* MaybeInterceptResponse(net::URLRequest* request);
45 virtual net::URLRequestJob* MaybeInterceptRedirect(net::URLRequest* request, 47 virtual net::URLRequestJob* MaybeInterceptRedirect(net::URLRequest* request,
46 const GURL& location); 48 const GURL& location);
47 49
48 private: 50 private:
49 friend struct DefaultSingletonTraits<AppCacheInterceptor>; 51 friend struct DefaultSingletonTraits<AppCacheInterceptor>;
50 52
51 static AppCacheInterceptor* instance() {
52 return Singleton<AppCacheInterceptor>::get();
53 }
54
55 AppCacheInterceptor(); 53 AppCacheInterceptor();
56 virtual ~AppCacheInterceptor(); 54 virtual ~AppCacheInterceptor();
57 55
58 static void SetHandler(net::URLRequest* request, 56 static void SetHandler(net::URLRequest* request,
59 AppCacheRequestHandler* handler); 57 AppCacheRequestHandler* handler);
60 static AppCacheRequestHandler* GetHandler(net::URLRequest* request); 58 static AppCacheRequestHandler* GetHandler(net::URLRequest* request);
61 59
62 DISALLOW_COPY_AND_ASSIGN(AppCacheInterceptor); 60 DISALLOW_COPY_AND_ASSIGN(AppCacheInterceptor);
63 }; 61 };
64 62
65 } // namespace appcache 63 } // namespace appcache
66 64
67 #endif // WEBKIT_APPCACHE_APPCACHE_INTERCEPTOR_H_ 65 #endif // WEBKIT_APPCACHE_APPCACHE_INTERCEPTOR_H_
OLDNEW
« no previous file with comments | « views/widget/root_view.cc ('k') | webkit/appcache/appcache_interceptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698