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

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

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/script_context.h ('k') | no next file » | 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 #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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 530
526 v8::Local<v8::Object> global = v8_context()->Global(); 531 v8::Local<v8::Object> global = v8_context()->Global();
527 if (!web_frame_) 532 if (!web_frame_)
528 return handle_scope.Escape(function->Call(global, argc, argv)); 533 return handle_scope.Escape(function->Call(global, argc, argv));
529 return handle_scope.Escape( 534 return handle_scope.Escape(
530 v8::Local<v8::Value>(web_frame_->CallFunctionEvenIfScriptDisabled( 535 v8::Local<v8::Value>(web_frame_->CallFunctionEvenIfScriptDisabled(
531 function, global, argc, argv))); 536 function, global, argc, argv)));
532 } 537 }
533 538
534 } // namespace extensions 539 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/script_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698