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 #include "content/renderer/browser_plugin/browser_plugin_bindings.h" | 5 #include "content/renderer/browser_plugin/browser_plugin_bindings.h" |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 *result); | 279 *result); |
280 return true; | 280 return true; |
281 } | 281 } |
282 | 282 |
283 private: | 283 private: |
284 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingAttachWindowTo); | 284 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingAttachWindowTo); |
285 }; | 285 }; |
286 | 286 |
287 // Note: This is a method that is used internally by the <webview> shim only. | 287 // Note: This is a method that is used internally by the <webview> shim only. |
288 // This should not be exposed to developers. | 288 // This should not be exposed to developers. |
289 class BrowserPluginBindingGetInstanceID : public BrowserPluginMethodBinding { | |
290 public: | |
291 BrowserPluginBindingGetInstanceID() | |
292 : BrowserPluginMethodBinding(browser_plugin::kMethodGetInstanceId, 0) { | |
293 } | |
294 | |
295 virtual bool Invoke(BrowserPluginBindings* bindings, | |
296 const NPVariant* args, | |
297 NPVariant* result) OVERRIDE { | |
298 int instance_id = bindings->instance()->instance_id(); | |
299 INT32_TO_NPVARIANT(instance_id, *result); | |
300 return true; | |
301 } | |
302 | |
303 private: | |
304 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingGetInstanceID); | |
305 }; | |
306 | |
307 // Note: This is a method that is used internally by the <webview> shim only. | |
308 // This should not be exposed to developers. | |
309 class BrowserPluginBindingGetGuestInstanceID : | 289 class BrowserPluginBindingGetGuestInstanceID : |
310 public BrowserPluginMethodBinding { | 290 public BrowserPluginMethodBinding { |
311 public: | 291 public: |
312 BrowserPluginBindingGetGuestInstanceID() | 292 BrowserPluginBindingGetGuestInstanceID() |
313 : BrowserPluginMethodBinding( | 293 : BrowserPluginMethodBinding( |
314 browser_plugin::kMethodGetGuestInstanceId, 0) { | 294 browser_plugin::kMethodGetGuestInstanceId, 0) { |
315 } | 295 } |
316 | 296 |
317 virtual bool Invoke(BrowserPluginBindings* bindings, | 297 virtual bool Invoke(BrowserPluginBindings* bindings, |
318 const NPVariant* args, | 298 const NPVariant* args, |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 np_object_(NULL), | 704 np_object_(NULL), |
725 weak_ptr_factory_(this) { | 705 weak_ptr_factory_(this) { |
726 NPObject* obj = | 706 NPObject* obj = |
727 WebBindings::createObject(instance->pluginNPP(), | 707 WebBindings::createObject(instance->pluginNPP(), |
728 &browser_plugin_message_class); | 708 &browser_plugin_message_class); |
729 np_object_ = static_cast<BrowserPluginBindings::BrowserPluginNPObject*>(obj); | 709 np_object_ = static_cast<BrowserPluginBindings::BrowserPluginNPObject*>(obj); |
730 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr(); | 710 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr(); |
731 | 711 |
732 method_bindings_.push_back(new BrowserPluginBindingAttach); | 712 method_bindings_.push_back(new BrowserPluginBindingAttach); |
733 method_bindings_.push_back(new BrowserPluginBindingAttachWindowTo); | 713 method_bindings_.push_back(new BrowserPluginBindingAttachWindowTo); |
734 method_bindings_.push_back(new BrowserPluginBindingGetInstanceID); | |
735 method_bindings_.push_back(new BrowserPluginBindingGetGuestInstanceID); | 714 method_bindings_.push_back(new BrowserPluginBindingGetGuestInstanceID); |
736 method_bindings_.push_back(new BrowserPluginBindingSetPermission); | 715 method_bindings_.push_back(new BrowserPluginBindingSetPermission); |
737 method_bindings_.push_back(new BrowserPluginBindingTrackObjectLifetime); | 716 method_bindings_.push_back(new BrowserPluginBindingTrackObjectLifetime); |
738 | 717 |
739 property_bindings_.push_back(new BrowserPluginPropertyBindingAutoSize); | 718 property_bindings_.push_back(new BrowserPluginPropertyBindingAutoSize); |
740 property_bindings_.push_back(new BrowserPluginPropertyBindingContentWindow); | 719 property_bindings_.push_back(new BrowserPluginPropertyBindingContentWindow); |
741 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxHeight); | 720 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxHeight); |
742 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxWidth); | 721 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxWidth); |
743 property_bindings_.push_back(new BrowserPluginPropertyBindingMinHeight); | 722 property_bindings_.push_back(new BrowserPluginPropertyBindingMinHeight); |
744 property_bindings_.push_back(new BrowserPluginPropertyBindingMinWidth); | 723 property_bindings_.push_back(new BrowserPluginPropertyBindingMinWidth); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 for (PropertyBindingList::iterator iter = property_bindings_.begin(); | 796 for (PropertyBindingList::iterator iter = property_bindings_.begin(); |
818 iter != property_bindings_.end(); | 797 iter != property_bindings_.end(); |
819 ++iter) { | 798 ++iter) { |
820 if ((*iter)->MatchesName(name)) | 799 if ((*iter)->MatchesName(name)) |
821 return (*iter)->GetProperty(this, result); | 800 return (*iter)->GetProperty(this, result); |
822 } | 801 } |
823 return false; | 802 return false; |
824 } | 803 } |
825 | 804 |
826 } // namespace content | 805 } // namespace content |
OLD | NEW |