| 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 |
| 49 // Returns true when '--disable-web-security' flag is set. Otherwise returns | 51 // Returns true when '--disable-web-security' flag is set. Otherwise returns |
| 50 // whether the all origins of |urls| are same as the origin of |url|. | 52 // whether the all origins of |urls| are same as the origin of |url|. |
| 51 template <typename... Args> | 53 template <typename... Args> |
| 52 static bool PassOriginEqualitySecurityCheck(const GURL& url, | 54 static bool PassOriginEqualitySecurityCheck(const GURL& url, |
| 53 const Args&... urls) { | 55 const Args&... urls) { |
| 54 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 56 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 55 switches::kDisableWebSecurity)) | 57 switches::kDisableWebSecurity)) |
| 56 return true; | 58 return true; |
| 57 for (const GURL& u : {urls...}) { | 59 for (const GURL& u : {urls...}) { |
| 58 if (url.GetOrigin() != u.GetOrigin()) | 60 if (url.GetOrigin() != u.GetOrigin()) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 79 private: | 81 private: |
| 80 const GURL url_; | 82 const GURL url_; |
| 81 GURL match_; | 83 GURL match_; |
| 82 | 84 |
| 83 DISALLOW_COPY_AND_ASSIGN(LongestScopeMatcher); | 85 DISALLOW_COPY_AND_ASSIGN(LongestScopeMatcher); |
| 84 }; | 86 }; |
| 85 | 87 |
| 86 } // namespace content | 88 } // namespace content |
| 87 | 89 |
| 88 #endif // CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_ | 90 #endif // CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_ |
| OLD | NEW |