| OLD | NEW |
| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 api_system_.RegisterCustomType("storage.StorageArea", | 336 api_system_.RegisterCustomType("storage.StorageArea", |
| 337 base::Bind(&StorageArea::CreateStorageArea)); | 337 base::Bind(&StorageArea::CreateStorageArea)); |
| 338 } | 338 } |
| 339 | 339 |
| 340 NativeExtensionBindingsSystem::~NativeExtensionBindingsSystem() {} | 340 NativeExtensionBindingsSystem::~NativeExtensionBindingsSystem() {} |
| 341 | 341 |
| 342 void NativeExtensionBindingsSystem::DidCreateScriptContext( | 342 void NativeExtensionBindingsSystem::DidCreateScriptContext( |
| 343 ScriptContext* context) {} | 343 ScriptContext* context) {} |
| 344 | 344 |
| 345 void NativeExtensionBindingsSystem::WillReleaseScriptContext( | 345 void NativeExtensionBindingsSystem::WillReleaseScriptContext( |
| 346 ScriptContext* context) {} | 346 ScriptContext* context) { |
| 347 v8::HandleScope handle_scope(context->isolate()); |
| 348 api_system_.WillReleaseContext(context->v8_context()); |
| 349 } |
| 347 | 350 |
| 348 void NativeExtensionBindingsSystem::UpdateBindingsForContext( | 351 void NativeExtensionBindingsSystem::UpdateBindingsForContext( |
| 349 ScriptContext* context) { | 352 ScriptContext* context) { |
| 350 v8::HandleScope handle_scope(context->isolate()); | 353 v8::HandleScope handle_scope(context->isolate()); |
| 351 v8::Local<v8::Context> v8_context = context->v8_context(); | 354 v8::Local<v8::Context> v8_context = context->v8_context(); |
| 352 v8::Local<v8::Object> chrome = GetOrCreateChrome(v8_context); | 355 v8::Local<v8::Object> chrome = GetOrCreateChrome(v8_context); |
| 353 if (chrome.IsEmpty()) | 356 if (chrome.IsEmpty()) |
| 354 return; | 357 return; |
| 355 | 358 |
| 356 gin::PerContextData* per_context_data = gin::PerContextData::From(v8_context); | 359 gin::PerContextData* per_context_data = gin::PerContextData::From(v8_context); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 | 632 |
| 630 void NativeExtensionBindingsSystem::OnEventListenerChanged( | 633 void NativeExtensionBindingsSystem::OnEventListenerChanged( |
| 631 const std::string& event_name, | 634 const std::string& event_name, |
| 632 binding::EventListenersChanged change, | 635 binding::EventListenersChanged change, |
| 633 v8::Local<v8::Context> context) { | 636 v8::Local<v8::Context> context) { |
| 634 send_event_listener_ipc_.Run( | 637 send_event_listener_ipc_.Run( |
| 635 change, ScriptContextSet::GetContextByV8Context(context), event_name); | 638 change, ScriptContextSet::GetContextByV8Context(context), event_name); |
| 636 } | 639 } |
| 637 | 640 |
| 638 } // namespace extensions | 641 } // namespace extensions |
| OLD | NEW |