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

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

Issue 2722463006: [Extensions Bindings] Notify of event unregistration on invalidation (Closed)
Patch Set: Rebase Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/native_extension_bindings_system.h" 5 #include "extensions/renderer/native_extension_bindings_system.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "content/public/common/content_switches.h" 9 #include "content/public/common/content_switches.h"
10 #include "extensions/common/constants.h" 10 #include "extensions/common/constants.h"
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 } 361 }
362 362
363 // Note: it's a shame we can't delay this (until, say, we knew an API would 363 // Note: it's a shame we can't delay this (until, say, we knew an API would
364 // actually be used), but it's needed for some of our crazier hooks, like 364 // actually be used), but it's needed for some of our crazier hooks, like
365 // web/guest view. 365 // web/guest view.
366 context->module_system()->SetGetInternalAPIHook( 366 context->module_system()->SetGetInternalAPIHook(
367 get_internal_api_.Get(isolate)); 367 get_internal_api_.Get(isolate));
368 } 368 }
369 369
370 void NativeExtensionBindingsSystem::WillReleaseScriptContext( 370 void NativeExtensionBindingsSystem::WillReleaseScriptContext(
371 ScriptContext* context) {} 371 ScriptContext* context) {
372 v8::HandleScope handle_scope(context->isolate());
373 api_system_.WillReleaseContext(context->v8_context());
374 }
372 375
373 void NativeExtensionBindingsSystem::UpdateBindingsForContext( 376 void NativeExtensionBindingsSystem::UpdateBindingsForContext(
374 ScriptContext* context) { 377 ScriptContext* context) {
375 v8::HandleScope handle_scope(context->isolate()); 378 v8::HandleScope handle_scope(context->isolate());
376 v8::Local<v8::Context> v8_context = context->v8_context(); 379 v8::Local<v8::Context> v8_context = context->v8_context();
377 v8::Local<v8::Object> chrome = GetOrCreateChrome(v8_context); 380 v8::Local<v8::Object> chrome = GetOrCreateChrome(v8_context);
378 if (chrome.IsEmpty()) 381 if (chrome.IsEmpty())
379 return; 382 return;
380 383
381 BindingsSystemPerContextData* data = GetBindingsDataFromContext(v8_context); 384 BindingsSystemPerContextData* data = GetBindingsDataFromContext(v8_context);
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 627
625 void NativeExtensionBindingsSystem::OnEventListenerChanged( 628 void NativeExtensionBindingsSystem::OnEventListenerChanged(
626 const std::string& event_name, 629 const std::string& event_name,
627 binding::EventListenersChanged change, 630 binding::EventListenersChanged change,
628 v8::Local<v8::Context> context) { 631 v8::Local<v8::Context> context) {
629 send_event_listener_ipc_.Run( 632 send_event_listener_ipc_.Run(
630 change, ScriptContextSet::GetContextByV8Context(context), event_name); 633 change, ScriptContextSet::GetContextByV8Context(context), event_name);
631 } 634 }
632 635
633 } // namespace extensions 636 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/event_emitter.cc ('k') | extensions/renderer/native_extension_bindings_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698