| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 bindings->instance()->Forward(); | 278 bindings->instance()->Forward(); |
| 279 return true; | 279 return true; |
| 280 } | 280 } |
| 281 | 281 |
| 282 private: | 282 private: |
| 283 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingForward); | 283 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingForward); |
| 284 }; | 284 }; |
| 285 | 285 |
| 286 // Note: This is a method that is used internally by the <webview> shim only. | 286 // Note: This is a method that is used internally by the <webview> shim only. |
| 287 // This should not be exposed to developers. | 287 // This should not be exposed to developers. |
| 288 class BrowserPluginBindingGetInstanceID : public BrowserPluginMethodBinding { |
| 289 public: |
| 290 BrowserPluginBindingGetInstanceID() |
| 291 : BrowserPluginMethodBinding(browser_plugin::kMethodGetInstanceId, 0) { |
| 292 } |
| 293 |
| 294 virtual bool Invoke(BrowserPluginBindings* bindings, |
| 295 const NPVariant* args, |
| 296 NPVariant* result) OVERRIDE { |
| 297 int instance_id = bindings->instance()->instance_id(); |
| 298 INT32_TO_NPVARIANT(instance_id, *result); |
| 299 return true; |
| 300 } |
| 301 |
| 302 private: |
| 303 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingGetInstanceID); |
| 304 }; |
| 305 |
| 306 // Note: This is a method that is used internally by the <webview> shim only. |
| 307 // This should not be exposed to developers. |
| 288 class BrowserPluginBindingGetRouteID : public BrowserPluginMethodBinding { | 308 class BrowserPluginBindingGetRouteID : public BrowserPluginMethodBinding { |
| 289 public: | 309 public: |
| 290 BrowserPluginBindingGetRouteID() | 310 BrowserPluginBindingGetRouteID() |
| 291 : BrowserPluginMethodBinding(browser_plugin::kMethodGetRouteId, 0) { | 311 : BrowserPluginMethodBinding(browser_plugin::kMethodGetRouteId, 0) { |
| 292 } | 312 } |
| 293 | 313 |
| 294 virtual bool Invoke(BrowserPluginBindings* bindings, | 314 virtual bool Invoke(BrowserPluginBindings* bindings, |
| 295 const NPVariant* args, | 315 const NPVariant* args, |
| 296 NPVariant* result) OVERRIDE { | 316 NPVariant* result) OVERRIDE { |
| 297 int route_id = bindings->instance()->guest_route_id(); | 317 int route_id = bindings->instance()->guest_route_id(); |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { | 765 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { |
| 746 NPObject* obj = | 766 NPObject* obj = |
| 747 WebBindings::createObject(NULL, &browser_plugin_message_class); | 767 WebBindings::createObject(NULL, &browser_plugin_message_class); |
| 748 np_object_ = static_cast<BrowserPluginBindings::BrowserPluginNPObject*>(obj); | 768 np_object_ = static_cast<BrowserPluginBindings::BrowserPluginNPObject*>(obj); |
| 749 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr(); | 769 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr(); |
| 750 | 770 |
| 751 method_bindings_.push_back(new BrowserPluginBindingBack); | 771 method_bindings_.push_back(new BrowserPluginBindingBack); |
| 752 method_bindings_.push_back(new BrowserPluginBindingCanGoBack); | 772 method_bindings_.push_back(new BrowserPluginBindingCanGoBack); |
| 753 method_bindings_.push_back(new BrowserPluginBindingCanGoForward); | 773 method_bindings_.push_back(new BrowserPluginBindingCanGoForward); |
| 754 method_bindings_.push_back(new BrowserPluginBindingForward); | 774 method_bindings_.push_back(new BrowserPluginBindingForward); |
| 775 method_bindings_.push_back(new BrowserPluginBindingGetInstanceID); |
| 755 method_bindings_.push_back(new BrowserPluginBindingGetProcessID); | 776 method_bindings_.push_back(new BrowserPluginBindingGetProcessID); |
| 756 method_bindings_.push_back(new BrowserPluginBindingGetRouteID); | 777 method_bindings_.push_back(new BrowserPluginBindingGetRouteID); |
| 757 method_bindings_.push_back(new BrowserPluginBindingGo); | 778 method_bindings_.push_back(new BrowserPluginBindingGo); |
| 758 method_bindings_.push_back(new BrowserPluginBindingReload); | 779 method_bindings_.push_back(new BrowserPluginBindingReload); |
| 759 method_bindings_.push_back(new BrowserPluginBindingStop); | 780 method_bindings_.push_back(new BrowserPluginBindingStop); |
| 760 method_bindings_.push_back(new BrowserPluginBindingTerminate); | 781 method_bindings_.push_back(new BrowserPluginBindingTerminate); |
| 761 | 782 |
| 762 property_bindings_.push_back(new BrowserPluginPropertyBindingAutoSize); | 783 property_bindings_.push_back(new BrowserPluginPropertyBindingAutoSize); |
| 763 property_bindings_.push_back(new BrowserPluginPropertyBindingContentWindow); | 784 property_bindings_.push_back(new BrowserPluginPropertyBindingContentWindow); |
| 764 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxHeight); | 785 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxHeight); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 for (PropertyBindingList::iterator iter = property_bindings_.begin(); | 861 for (PropertyBindingList::iterator iter = property_bindings_.begin(); |
| 841 iter != property_bindings_.end(); | 862 iter != property_bindings_.end(); |
| 842 ++iter) { | 863 ++iter) { |
| 843 if ((*iter)->MatchesName(name)) | 864 if ((*iter)->MatchesName(name)) |
| 844 return (*iter)->GetProperty(this, result); | 865 return (*iter)->GetProperty(this, result); |
| 845 } | 866 } |
| 846 return false; | 867 return false; |
| 847 } | 868 } |
| 848 | 869 |
| 849 } // namespace content | 870 } // namespace content |
| OLD | NEW |