| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_BINDINGS_H__ | 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_BINDINGS_H__ |
| 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_BINDINGS_H__ | 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_BINDINGS_H__ |
| 7 | 7 |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "ppapi/shared_impl/resource.h" | 10 #include "ppapi/shared_impl/resource.h" |
| 11 #include "third_party/npapi/bindings/npruntime.h" | 11 #include "third_party/npapi/bindings/npruntime.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 class BrowserPlugin; | 15 class BrowserPlugin; |
| 16 class BrowserPluginMethodBinding; | |
| 17 class BrowserPluginPropertyBinding; | 16 class BrowserPluginPropertyBinding; |
| 18 | 17 |
| 19 class BrowserPluginBindings { | 18 class BrowserPluginBindings { |
| 20 public: | 19 public: |
| 21 // BrowserPluginNPObject is a simple struct that adds a pointer back to a | 20 // BrowserPluginNPObject is a simple struct that adds a pointer back to a |
| 22 // BrowserPluginBindings instance. This way, we can use an NPObject to allow | 21 // BrowserPluginBindings instance. This way, we can use an NPObject to allow |
| 23 // JavaScript interactions without forcing BrowserPluginBindings to inherit | 22 // JavaScript interactions without forcing BrowserPluginBindings to inherit |
| 24 // from NPObject. | 23 // from NPObject. |
| 25 struct BrowserPluginNPObject : public NPObject { | 24 struct BrowserPluginNPObject : public NPObject { |
| 26 BrowserPluginNPObject(); | 25 BrowserPluginNPObject(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 47 bool SetProperty(NPObject* np_obj, | 46 bool SetProperty(NPObject* np_obj, |
| 48 NPIdentifier name, | 47 NPIdentifier name, |
| 49 const NPVariant* variant); | 48 const NPVariant* variant); |
| 50 bool GetProperty(NPIdentifier name, NPVariant* result); | 49 bool GetProperty(NPIdentifier name, NPVariant* result); |
| 51 bool RemoveProperty(NPObject *np_obj, NPIdentifier name); | 50 bool RemoveProperty(NPObject *np_obj, NPIdentifier name); |
| 52 private: | 51 private: |
| 53 BrowserPlugin* instance_; | 52 BrowserPlugin* instance_; |
| 54 // The NPObject we use to expose postMessage to JavaScript. | 53 // The NPObject we use to expose postMessage to JavaScript. |
| 55 BrowserPluginNPObject* np_object_; | 54 BrowserPluginNPObject* np_object_; |
| 56 | 55 |
| 57 typedef ScopedVector<BrowserPluginMethodBinding> BindingList; | |
| 58 BindingList method_bindings_; | |
| 59 typedef ScopedVector<BrowserPluginPropertyBinding> PropertyBindingList; | 56 typedef ScopedVector<BrowserPluginPropertyBinding> PropertyBindingList; |
| 60 PropertyBindingList property_bindings_; | 57 PropertyBindingList property_bindings_; |
| 61 | 58 |
| 62 // This is used to ensure pending tasks will not fire after this object is | 59 // This is used to ensure pending tasks will not fire after this object is |
| 63 // destroyed. | 60 // destroyed. |
| 64 base::WeakPtrFactory<BrowserPluginBindings> weak_ptr_factory_; | 61 base::WeakPtrFactory<BrowserPluginBindings> weak_ptr_factory_; |
| 65 | 62 |
| 66 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindings); | 63 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindings); |
| 67 }; | 64 }; |
| 68 | 65 |
| 69 } // namespace content | 66 } // namespace content |
| 70 | 67 |
| 71 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_BINDINGS_H__ | 68 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_BINDINGS_H__ |
| OLD | NEW |