OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_ | 5 #ifndef CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_ |
6 #define CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_ | 6 #define CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_ |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 std::string* error_message); | 39 std::string* error_message); |
40 | 40 |
41 static bool ContainsDisallowedCharacter(const GURL& scope, | 41 static bool ContainsDisallowedCharacter(const GURL& scope, |
42 const GURL& script_url, | 42 const GURL& script_url, |
43 std::string* error_message); | 43 std::string* error_message); |
44 | 44 |
45 static bool CanRegisterServiceWorker(const GURL& context_url, | 45 static bool CanRegisterServiceWorker(const GURL& context_url, |
46 const GURL& pattern, | 46 const GURL& pattern, |
47 const GURL& script_url); | 47 const GURL& script_url); |
48 | 48 |
49 static bool IsMojoForServiceWorkerEnabled(); | |
50 | |
51 // Returns true when '--disable-web-security' flag is set. Otherwise returns | 49 // Returns true when '--disable-web-security' flag is set. Otherwise returns |
52 // whether the all origins of |urls| are same as the origin of |url|. | 50 // whether the all origins of |urls| are same as the origin of |url|. |
53 template <typename... Args> | 51 template <typename... Args> |
54 static bool PassOriginEqualitySecurityCheck(const GURL& url, | 52 static bool PassOriginEqualitySecurityCheck(const GURL& url, |
55 const Args&... urls) { | 53 const Args&... urls) { |
56 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 54 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
57 switches::kDisableWebSecurity)) | 55 switches::kDisableWebSecurity)) |
58 return true; | 56 return true; |
59 for (const GURL& u : {urls...}) { | 57 for (const GURL& u : {urls...}) { |
60 if (url.GetOrigin() != u.GetOrigin()) | 58 if (url.GetOrigin() != u.GetOrigin()) |
(...skipping 20 matching lines...) Expand all Loading... |
81 private: | 79 private: |
82 const GURL url_; | 80 const GURL url_; |
83 GURL match_; | 81 GURL match_; |
84 | 82 |
85 DISALLOW_COPY_AND_ASSIGN(LongestScopeMatcher); | 83 DISALLOW_COPY_AND_ASSIGN(LongestScopeMatcher); |
86 }; | 84 }; |
87 | 85 |
88 } // namespace content | 86 } // namespace content |
89 | 87 |
90 #endif // CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_ | 88 #endif // CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_ |
OLD | NEW |