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

Unified Diff: content/browser/service_worker/service_worker_utils.h

Issue 1259213002: Move Service Worker %2f path validation logic from browser into Blink (1) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix remaining nits. Created 5 years, 4 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
Index: content/browser/service_worker/service_worker_utils.h
diff --git a/content/browser/service_worker/service_worker_utils.h b/content/browser/service_worker/service_worker_utils.h
deleted file mode 100644
index c03f4f2dccdd99b0da60f00dac0ff4fbc191f7f3..0000000000000000000000000000000000000000
--- a/content/browser/service_worker/service_worker_utils.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2014 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_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_
-#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_
-
-#include "base/macros.h"
-#include "content/common/content_export.h"
-#include "content/common/service_worker/service_worker_status_code.h"
-#include "content/public/common/resource_type.h"
-#include "url/gurl.h"
-
-namespace content {
-
-class ServiceWorkerUtils {
- public:
- static bool IsMainResourceType(ResourceType type) {
- return IsResourceTypeFrame(type) || type == RESOURCE_TYPE_SHARED_WORKER;
- }
-
- // A helper for creating a do-nothing status callback.
- static void NoOpStatusCallback(ServiceWorkerStatusCode status) {}
-
- // Returns true if |scope| matches |url|.
- CONTENT_EXPORT static bool ScopeMatches(const GURL& scope, const GURL& url);
-
- // Returns true if the script at |script_url| is allowed to control |scope|
- // according to Service Worker's path restriction policy. If
- // |service_worker_allowed| is not null, it points to the
- // Service-Worker-Allowed header value.
- CONTENT_EXPORT static bool IsPathRestrictionSatisfied(
- const GURL& scope,
- const GURL& script_url,
- const std::string* service_worker_allowed_header_value,
- std::string* error_message);
-
- static bool ContainsDisallowedCharacter(const GURL& scope,
- const GURL& script_url,
- std::string* error_message);
-};
-
-class CONTENT_EXPORT LongestScopeMatcher {
- public:
- explicit LongestScopeMatcher(const GURL& url) : url_(url) {}
- virtual ~LongestScopeMatcher() {}
-
- // Returns true if |scope| matches |url_| longer than |match_|.
- bool MatchLongest(const GURL& scope);
-
- private:
- const GURL url_;
- GURL match_;
-
- DISALLOW_COPY_AND_ASSIGN(LongestScopeMatcher);
-};
-
-} // namespace content
-
-#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_

Powered by Google App Engine
This is Rietveld 408576698