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

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

Issue 2848493007: Reduce/Remove URLRequest dependencies from AppCacheRequestHandler (Closed)
Patch Set: 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 virtual const std::string& GetMethod() const = 0;
33
34 virtual const GURL& GetFirstPartyForCookies() const = 0;
michaeln 2017/05/01 20:53:58 style nit: you could remove some blank lines and s
ananta 2017/05/03 00:16:47 The functions were supposed to have comments. Fixe
35
36 virtual const GURL GetReferrer() const = 0;
37
38 // Returns true if the request was successful.
39 virtual bool IsSuccess() const = 0;
40
41 // Returns true if the request was cancelled.
42 virtual bool IsCancelled() const = 0;
43
44 // Returns true if the request had an error.
45 virtual bool IsError() const = 0;
46
47 // Returns the HTTP response code.
48 virtual int GetResponseCode() const = 0;
49
50 // Get response header(s) by name. Returns an empty string if the header
51 // wasn't found,
52 virtual std::string GetResponseHeaderByName(
53 const std::string& name) const = 0;
54
55 // Getters for the request types we currently support.
michaeln 2017/05/01 20:53:58 It might be nice to make these private to dissuade
ananta 2017/05/03 00:16:47 Moved them to the protected section.
56 virtual net::URLRequest* GetURLRequest() const { return nullptr; }
57
58 virtual const ResourceRequest* GetResourceRequest() const { return nullptr; }
59
60 // Returns true if the scheme and method are supported for AppCache.
61 static bool IsSchemeAndMethodSupportedForAppCache(
62 const AppCacheRequest* request);
63
64 protected:
65 AppCacheRequest() {}
66
67 DISALLOW_COPY_AND_ASSIGN(AppCacheRequest);
68 };
69
70 } // namespace content
71
72 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698