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" |
11 #include "extensions/common/extension_api.h" | 11 #include "extensions/common/extension_api.h" |
12 #include "extensions/common/extension_messages.h" | 12 #include "extensions/common/extension_messages.h" |
13 #include "extensions/common/features/feature_provider.h" | 13 #include "extensions/common/features/feature_provider.h" |
14 #include "extensions/renderer/api_binding_bridge.h" | 14 #include "extensions/renderer/api_binding_bridge.h" |
15 #include "extensions/renderer/api_binding_hooks.h" | 15 #include "extensions/renderer/api_binding_hooks.h" |
16 #include "extensions/renderer/module_system.h" | 16 #include "extensions/renderer/module_system.h" |
17 #include "extensions/renderer/script_context.h" | 17 #include "extensions/renderer/script_context.h" |
18 #include "extensions/renderer/script_context_set.h" | 18 #include "extensions/renderer/script_context_set.h" |
| 19 #include "extensions/renderer/storage_area.h" |
19 #include "gin/converter.h" | 20 #include "gin/converter.h" |
20 #include "gin/handle.h" | 21 #include "gin/handle.h" |
21 #include "gin/per_context_data.h" | 22 #include "gin/per_context_data.h" |
22 #include "third_party/WebKit/public/web/WebDocument.h" | 23 #include "third_party/WebKit/public/web/WebDocument.h" |
23 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 24 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
24 | 25 |
25 namespace extensions { | 26 namespace extensions { |
26 | 27 |
27 namespace { | 28 namespace { |
28 | 29 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 send_event_listener_ipc_(send_event_listener_ipc), | 324 send_event_listener_ipc_(send_event_listener_ipc), |
324 api_system_( | 325 api_system_( |
325 base::Bind(&CallJsFunction), | 326 base::Bind(&CallJsFunction), |
326 base::Bind(&CallJsFunctionSync), | 327 base::Bind(&CallJsFunctionSync), |
327 base::Bind(&GetAPISchema), | 328 base::Bind(&GetAPISchema), |
328 base::Bind(&NativeExtensionBindingsSystem::SendRequest, | 329 base::Bind(&NativeExtensionBindingsSystem::SendRequest, |
329 base::Unretained(this)), | 330 base::Unretained(this)), |
330 base::Bind(&NativeExtensionBindingsSystem::OnEventListenerChanged, | 331 base::Bind(&NativeExtensionBindingsSystem::OnEventListenerChanged, |
331 base::Unretained(this)), | 332 base::Unretained(this)), |
332 APILastError(base::Bind(&GetRuntime))), | 333 APILastError(base::Bind(&GetRuntime))), |
333 weak_factory_(this) {} | 334 weak_factory_(this) { |
| 335 api_system_.RegisterCustomType("storage.StorageArea", |
| 336 base::Bind(&StorageArea::CreateStorageArea)); |
| 337 } |
334 | 338 |
335 NativeExtensionBindingsSystem::~NativeExtensionBindingsSystem() {} | 339 NativeExtensionBindingsSystem::~NativeExtensionBindingsSystem() {} |
336 | 340 |
337 void NativeExtensionBindingsSystem::DidCreateScriptContext( | 341 void NativeExtensionBindingsSystem::DidCreateScriptContext( |
338 ScriptContext* context) {} | 342 ScriptContext* context) {} |
339 | 343 |
340 void NativeExtensionBindingsSystem::WillReleaseScriptContext( | 344 void NativeExtensionBindingsSystem::WillReleaseScriptContext( |
341 ScriptContext* context) {} | 345 ScriptContext* context) {} |
342 | 346 |
343 void NativeExtensionBindingsSystem::UpdateBindingsForContext( | 347 void NativeExtensionBindingsSystem::UpdateBindingsForContext( |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 | 628 |
625 void NativeExtensionBindingsSystem::OnEventListenerChanged( | 629 void NativeExtensionBindingsSystem::OnEventListenerChanged( |
626 const std::string& event_name, | 630 const std::string& event_name, |
627 binding::EventListenersChanged change, | 631 binding::EventListenersChanged change, |
628 v8::Local<v8::Context> context) { | 632 v8::Local<v8::Context> context) { |
629 send_event_listener_ipc_.Run( | 633 send_event_listener_ipc_.Run( |
630 change, ScriptContextSet::GetContextByV8Context(context), event_name); | 634 change, ScriptContextSet::GetContextByV8Context(context), event_name); |
631 } | 635 } |
632 | 636 |
633 } // namespace extensions | 637 } // namespace extensions |
OLD | NEW |