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

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

Issue 2943583002: [extension SW] Support lazy events from extension service workers. (Closed)
Patch Set: Address comments from falken@ 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
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 #include "extensions/renderer/script_context.h" 5 #include "extensions/renderer/script_context.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 std::string ScriptContext::GetContextTypeDescription() const { 247 std::string ScriptContext::GetContextTypeDescription() const {
248 DCHECK(thread_checker_.CalledOnValidThread()); 248 DCHECK(thread_checker_.CalledOnValidThread());
249 return GetContextTypeDescriptionString(context_type_); 249 return GetContextTypeDescriptionString(context_type_);
250 } 250 }
251 251
252 std::string ScriptContext::GetEffectiveContextTypeDescription() const { 252 std::string ScriptContext::GetEffectiveContextTypeDescription() const {
253 DCHECK(thread_checker_.CalledOnValidThread()); 253 DCHECK(thread_checker_.CalledOnValidThread());
254 return GetContextTypeDescriptionString(effective_context_type_); 254 return GetContextTypeDescriptionString(effective_context_type_);
255 } 255 }
256 256
257 const GURL& ScriptContext::service_worker_scope() const {
258 DCHECK_EQ(Feature::SERVICE_WORKER_CONTEXT, context_type());
259 return service_worker_scope_;
260 }
261
257 bool ScriptContext::IsAnyFeatureAvailableToContext( 262 bool ScriptContext::IsAnyFeatureAvailableToContext(
258 const Feature& api, 263 const Feature& api,
259 CheckAliasStatus check_alias) { 264 CheckAliasStatus check_alias) {
260 DCHECK(thread_checker_.CalledOnValidThread()); 265 DCHECK(thread_checker_.CalledOnValidThread());
261 // TODO(lazyboy): Decide what we should do for SERVICE_WORKER_CONTEXT, where 266 // TODO(lazyboy): Decide what we should do for SERVICE_WORKER_CONTEXT, where
262 // web_frame() is null. 267 // web_frame() is null.
263 GURL url = web_frame() ? GetDataSourceURLForFrame(web_frame()) : url_; 268 GURL url = web_frame() ? GetDataSourceURLForFrame(web_frame()) : url_;
264 return ExtensionAPI::GetSharedInstance()->IsAnyFeatureAvailableToContext( 269 return ExtensionAPI::GetSharedInstance()->IsAnyFeatureAvailableToContext(
265 api, extension(), context_type(), url, check_alias); 270 api, extension(), context_type(), url, check_alias);
266 } 271 }
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 526
522 v8::Local<v8::Object> global = v8_context()->Global(); 527 v8::Local<v8::Object> global = v8_context()->Global();
523 if (!web_frame_) 528 if (!web_frame_)
524 return handle_scope.Escape(function->Call(global, argc, argv)); 529 return handle_scope.Escape(function->Call(global, argc, argv));
525 return handle_scope.Escape( 530 return handle_scope.Escape(
526 v8::Local<v8::Value>(web_frame_->CallFunctionEvenIfScriptDisabled( 531 v8::Local<v8::Value>(web_frame_->CallFunctionEvenIfScriptDisabled(
527 function, global, argc, argv))); 532 function, global, argc, argv)));
528 } 533 }
529 534
530 } // namespace extensions 535 } // namespace extensions
OLDNEW
« content/public/test/service_worker_test_helpers.h ('K') | « extensions/renderer/script_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698