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

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

Issue 2848493007: Reduce/Remove URLRequest dependencies from AppCacheRequestHandler (Closed)
Patch Set: format changes Created 3 years, 7 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
(Empty)
1 // Copyright (c) 2017 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.
4
5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_H_
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_H_
7
8 #include "base/logging.h"
9 #include "base/strings/string16.h"
10 #include "base/threading/non_thread_safe.h"
11 #include "content/common/content_export.h"
12 #include "url/gurl.h"
13
14 namespace net {
15 class URLRequest;
16 }
17
18 namespace content {
19 struct ResourceRequest;
20
21 // Interface for an AppCache request. Subclasses implement this interface to
22 // wrap custom request objects like URLRequest, etc to ensure that these
23 // dependencies stay out of the AppCache code.
24 class CONTENT_EXPORT AppCacheRequest
25 : NON_EXPORTED_BASE(public base::NonThreadSafe) {
26 public:
27 virtual ~AppCacheRequest() {}
28
29 // The URL for this request.
30 virtual const GURL& GetURL() const = 0;
31
32 // The method for this request
33 virtual const std::string& GetMethod() const = 0;
34
35 // Used for cookie policy.
36 virtual const GURL& GetFirstPartyForCookies() const = 0;
37
38 // The referrer for this request.
39 virtual const GURL GetReferrer() const = 0;
40
41 // Returns true if the request was successful.
42 virtual bool IsSuccess() const = 0;
43
44 // Returns true if the request was cancelled.
45 virtual bool IsCancelled() const = 0;
46
47 // Returns true if the request had an error.
48 virtual bool IsError() const = 0;
49
50 // Returns the HTTP response code.
51 virtual int GetResponseCode() const = 0;
52
53 // Get response header(s) by name. Returns an empty string if the header
54 // wasn't found,
55 virtual std::string GetResponseHeaderByName(
56 const std::string& name) const = 0;
57
58 // Returns true if the scheme and method are supported for AppCache.
59 static bool IsSchemeAndMethodSupportedForAppCache(
60 const AppCacheRequest* request);
61
62 protected:
63 friend class AppCacheRequestHandler;
64
65 AppCacheRequest() {}
66
67 // Getters for the request types we currently support.
68 virtual net::URLRequest* GetURLRequest();
69
70 // Returns the underlying ResourceRequest. Please note that only one of
71 // GetURLRequest() and GetResourceRequest() should return valid results.
72 virtual ResourceRequest* GetResourceRequest();
73
74 DISALLOW_COPY_AND_ASSIGN(AppCacheRequest);
75 };
76
77 } // namespace content
78
79 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698