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

Unified Diff: content/browser/background_fetch/background_fetch_cross_origin_filter.h

Issue 2818703003: Consider the Access-Control-Allow-Origin header for Background Fetch (Closed)
Patch Set: Consider the Access-Control-Allow-Origin header for Background Fetch Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/background_fetch/background_fetch_cross_origin_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/background_fetch/background_fetch_cross_origin_filter.h
diff --git a/content/browser/background_fetch/background_fetch_cross_origin_filter.h b/content/browser/background_fetch/background_fetch_cross_origin_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..6fb1c4995bf8531be9106bbff5a000ba8c0ad482
--- /dev/null
+++ b/content/browser/background_fetch/background_fetch_cross_origin_filter.h
@@ -0,0 +1,43 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CROSS_ORIGIN_FILTER_H_
+#define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CROSS_ORIGIN_FILTER_H_
+
+#include "base/macros.h"
+#include "content/common/content_export.h"
+
+namespace url {
+class Origin;
+}
+
+namespace content {
+
+class BackgroundFetchRequestInfo;
+
+// A filter that decides the CORS rules based on the source of a request and the
+// response URL and headers included in the |request| info.
+class CONTENT_EXPORT BackgroundFetchCrossOriginFilter {
+ public:
+ BackgroundFetchCrossOriginFilter(const url::Origin& source_origin,
+ const BackgroundFetchRequestInfo& request);
+ ~BackgroundFetchCrossOriginFilter();
+
+ // Returns whether the Response object passed to the Service Worker event
+ // should include the body included in the response.
+ bool CanPopulateBody() const;
+
+ private:
+ // Whether the response comes from the same origin as the requester.
+ bool is_same_origin_ = false;
+
+ // Whether the Access-Control-Allow-Origin header includes the source origin.
+ bool access_control_allow_origin_ = false;
+
+ DISALLOW_COPY_AND_ASSIGN(BackgroundFetchCrossOriginFilter);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CROSS_ORIGIN_FILTER_H_
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/background_fetch/background_fetch_cross_origin_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698