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

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

Issue 294593002: ServiceWorker: Support longest-prefix-match for registration scope (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 6 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 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
index 38669c4317648145870670961284df7a64f50aed..edb965050ed6610f45220e37dae68c22ed84ad5d 100644
--- a/content/browser/service_worker/service_worker_utils.h
+++ b/content/browser/service_worker/service_worker_utils.h
@@ -5,10 +5,14 @@
#ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_
#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_
+#include <vector>
jsbell 2014/06/03 18:48:30 Not needed any more?
nhiroki 2014/06/05 11:00:35 Done.
+
#include "content/common/content_export.h"
#include "content/common/service_worker/service_worker_status_code.h"
#include "webkit/common/resource_type.h"
+class GURL;
+
namespace content {
class ServiceWorkerUtils {
@@ -33,6 +37,21 @@ class ServiceWorkerUtils {
CONTENT_EXPORT static bool ScopeMatches(const GURL& scope, const GURL& url);
};
+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