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

Side by Side Diff: extensions/renderer/script_context.h

Issue 2943583002: [extension SW] Support lazy events from extension service workers. (Closed)
Patch Set: sync @tott Created 3 years, 5 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
« no previous file with comments | « extensions/renderer/event_bindings.cc ('k') | extensions/renderer/script_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ 5 #ifndef EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_
6 #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ 6 #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // 142 //
143 // TODO(kalman): Remove this and replace with a GetOrigin() call which reads 143 // TODO(kalman): Remove this and replace with a GetOrigin() call which reads
144 // of WebDocument::getSecurityOrigin(): 144 // of WebDocument::getSecurityOrigin():
145 // - The URL can change (e.g. pushState) but the origin cannot. Luckily it 145 // - The URL can change (e.g. pushState) but the origin cannot. Luckily it
146 // appears as though callers don't make security decisions based on the 146 // appears as though callers don't make security decisions based on the
147 // result of url() so it's not a problem... yet. 147 // result of url() so it's not a problem... yet.
148 // - Origin is the correct check to be making. 148 // - Origin is the correct check to be making.
149 // - It might let us remove the about:blank resolving? 149 // - It might let us remove the about:blank resolving?
150 const GURL& url() const { return url_; } 150 const GURL& url() const { return url_; }
151 151
152 const GURL& service_worker_scope() const;
153
152 // Sets the URL of this ScriptContext. Usually this will automatically be set 154 // Sets the URL of this ScriptContext. Usually this will automatically be set
153 // on construction, unless this isn't constructed with enough information to 155 // on construction, unless this isn't constructed with enough information to
154 // determine the URL (e.g. frame was null). 156 // determine the URL (e.g. frame was null).
155 // TODO(kalman): Make this a constructor parameter (as an origin). 157 // TODO(kalman): Make this a constructor parameter (as an origin).
156 void set_url(const GURL& url) { url_ = url; } 158 void set_url(const GURL& url) { url_ = url; }
159 void set_service_worker_scope(const GURL& scope) {
160 service_worker_scope_ = scope;
161 }
157 162
158 // Returns whether the API |api| or any part of the API could be available in 163 // Returns whether the API |api| or any part of the API could be available in
159 // this context without taking into account the context's extension. 164 // this context without taking into account the context's extension.
160 // |check_alias| Whether the API should be considered available if it has an 165 // |check_alias| Whether the API should be considered available if it has an
161 // alias that is available. 166 // alias that is available.
162 bool IsAnyFeatureAvailableToContext(const extensions::Feature& api, 167 bool IsAnyFeatureAvailableToContext(const extensions::Feature& api,
163 CheckAliasStatus check_alias); 168 CheckAliasStatus check_alias);
164 169
165 // Utility to get the URL we will match against for a frame. If the frame has 170 // Utility to get the URL we will match against for a frame. If the frame has
166 // committed, this is the commited URL. Otherwise it is the provisional URL. 171 // committed, this is the commited URL. Otherwise it is the provisional URL.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 APIPermissionSet content_capabilities_; 267 APIPermissionSet content_capabilities_;
263 268
264 // A list of base::Closure instances as an observer interface for 269 // A list of base::Closure instances as an observer interface for
265 // invalidation. 270 // invalidation.
266 std::vector<base::Closure> invalidate_observers_; 271 std::vector<base::Closure> invalidate_observers_;
267 272
268 v8::Isolate* isolate_; 273 v8::Isolate* isolate_;
269 274
270 GURL url_; 275 GURL url_;
271 276
277 GURL service_worker_scope_;
278
272 std::unique_ptr<Runner> runner_; 279 std::unique_ptr<Runner> runner_;
273 280
274 base::ThreadChecker thread_checker_; 281 base::ThreadChecker thread_checker_;
275 282
276 DISALLOW_COPY_AND_ASSIGN(ScriptContext); 283 DISALLOW_COPY_AND_ASSIGN(ScriptContext);
277 }; 284 };
278 285
279 } // namespace extensions 286 } // namespace extensions
280 287
281 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ 288 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_
OLDNEW
« no previous file with comments | « extensions/renderer/event_bindings.cc ('k') | extensions/renderer/script_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698