Chromium Code Reviews| Index: extensions/renderer/extension_frame_helper.cc |
| diff --git a/extensions/renderer/extension_frame_helper.cc b/extensions/renderer/extension_frame_helper.cc |
| index da47e687f5662c0d8eefb6830a860edf971c2689..524c960acce6023ae532e8fc8af14074d6b271fa 100644 |
| --- a/extensions/renderer/extension_frame_helper.cc |
| +++ b/extensions/renderer/extension_frame_helper.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/metrics/histogram_macros.h" |
| #include "base/strings/string_util.h" |
| #include "base/timer/elapsed_timer.h" |
| +#include "content/public/child/worker_thread.h" |
| #include "content/public/renderer/render_frame.h" |
| #include "extensions/common/api/messaging/message.h" |
| #include "extensions/common/api/messaging/port_id.h" |
| @@ -148,6 +149,14 @@ bool ExtensionFrameHelper::IsContextForEventPage(const ScriptContext* context) { |
| VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; |
| } |
| +bool ExtensionFrameHelper::IsContextForSW(const ScriptContext& context) { |
|
Devlin
2017/05/24 17:58:25
We already have context_type() on ScriptContext; d
lazyboy
2017/05/25 01:33:43
context_type() should be fine, thanks.
Done.
|
| + if (content::WorkerThread::GetCurrentId() != 0) { |
| + DCHECK(context.GetRenderFrame() == nullptr); |
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| void ExtensionFrameHelper::DidCreateDocumentElement() { |
| did_create_current_document_element_ = true; |
| extension_dispatcher_->DidCreateDocumentElement( |