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

Side by Side Diff: content/common/service_worker/service_worker_utils.h

Issue 2931033005: Small fixes for Servicified SW code path (Closed)
Patch Set: . Created 3 years, 6 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 unified diff | Download patch
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 std::string* error_message); 43 std::string* error_message);
44 44
45 static bool IsMojoForServiceWorkerEnabled(); 45 static bool IsMojoForServiceWorkerEnabled();
46 46
47 // Returns true if all members of |urls| have the same origin, and 47 // Returns true if all members of |urls| have the same origin, and
48 // OriginCanAccessServiceWorkers is true for this origin. 48 // OriginCanAccessServiceWorkers is true for this origin.
49 // If --disable-web-security is enabled, the same origin check is 49 // If --disable-web-security is enabled, the same origin check is
50 // not performed. 50 // not performed.
51 CONTENT_EXPORT static bool AllOriginsMatchAndCanAccessServiceWorkers( 51 CONTENT_EXPORT static bool AllOriginsMatchAndCanAccessServiceWorkers(
52 const std::vector<GURL>& urls); 52 const std::vector<GURL>& urls);
53 53
falken 2017/06/12 01:10:36 Maybe a lightweight comment like: "Returns true if
kinuko 2017/06/12 02:16:51 Done.
54 CONTENT_EXPORT static bool IsServicificationEnabled();
55
54 // PlzNavigate 56 // PlzNavigate
55 // Returns true if the |provider_id| was assigned by the browser process. 57 // Returns true if the |provider_id| was assigned by the browser process.
56 static bool IsBrowserAssignedProviderId(int provider_id) { 58 static bool IsBrowserAssignedProviderId(int provider_id) {
57 return provider_id < kInvalidServiceWorkerProviderId; 59 return provider_id < kInvalidServiceWorkerProviderId;
58 } 60 }
59 }; 61 };
60 62
61 class CONTENT_EXPORT LongestScopeMatcher { 63 class CONTENT_EXPORT LongestScopeMatcher {
62 public: 64 public:
63 explicit LongestScopeMatcher(const GURL& url) : url_(url) {} 65 explicit LongestScopeMatcher(const GURL& url) : url_(url) {}
64 virtual ~LongestScopeMatcher() {} 66 virtual ~LongestScopeMatcher() {}
65 67
66 // Returns true if |scope| matches |url_| longer than |match_|. 68 // Returns true if |scope| matches |url_| longer than |match_|.
67 bool MatchLongest(const GURL& scope); 69 bool MatchLongest(const GURL& scope);
68 70
69 private: 71 private:
70 const GURL url_; 72 const GURL url_;
71 GURL match_; 73 GURL match_;
72 74
73 DISALLOW_COPY_AND_ASSIGN(LongestScopeMatcher); 75 DISALLOW_COPY_AND_ASSIGN(LongestScopeMatcher);
74 }; 76 };
75 77
76 } // namespace content 78 } // namespace content
77 79
78 #endif // CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_ 80 #endif // CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698