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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 bindings->instance()->Forward(); | 311 bindings->instance()->Forward(); |
312 return true; | 312 return true; |
313 } | 313 } |
314 | 314 |
315 private: | 315 private: |
316 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingForward); | 316 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingForward); |
317 }; | 317 }; |
318 | 318 |
319 // Note: This is a method that is used internally by the <webview> shim only. | 319 // Note: This is a method that is used internally by the <webview> shim only. |
320 // This should not be exposed to developers. | 320 // This should not be exposed to developers. |
| 321 class BrowserPluginBindingGetInstanceID : public BrowserPluginMethodBinding { |
| 322 public: |
| 323 BrowserPluginBindingGetInstanceID() |
| 324 : BrowserPluginMethodBinding(browser_plugin::kMethodGetInstanceId, 0) { |
| 325 } |
| 326 |
| 327 virtual bool Invoke(BrowserPluginBindings* bindings, |
| 328 const NPVariant* args, |
| 329 NPVariant* result) OVERRIDE { |
| 330 int instance_id = bindings->instance()->instance_id(); |
| 331 INT32_TO_NPVARIANT(instance_id, *result); |
| 332 return true; |
| 333 } |
| 334 |
| 335 private: |
| 336 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingGetInstanceID); |
| 337 }; |
| 338 |
| 339 // Note: This is a method that is used internally by the <webview> shim only. |
| 340 // This should not be exposed to developers. |
321 class BrowserPluginBindingGetRouteID : public BrowserPluginMethodBinding { | 341 class BrowserPluginBindingGetRouteID : public BrowserPluginMethodBinding { |
322 public: | 342 public: |
323 BrowserPluginBindingGetRouteID() | 343 BrowserPluginBindingGetRouteID() |
324 : BrowserPluginMethodBinding(browser_plugin::kMethodGetRouteId, 0) { | 344 : BrowserPluginMethodBinding(browser_plugin::kMethodGetRouteId, 0) { |
325 } | 345 } |
326 | 346 |
327 virtual bool Invoke(BrowserPluginBindings* bindings, | 347 virtual bool Invoke(BrowserPluginBindings* bindings, |
328 const NPVariant* args, | 348 const NPVariant* args, |
329 NPVariant* result) OVERRIDE { | 349 NPVariant* result) OVERRIDE { |
330 int route_id = bindings->instance()->guest_route_id(); | 350 int route_id = bindings->instance()->guest_route_id(); |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 NPObject* obj = | 839 NPObject* obj = |
820 WebBindings::createObject(NULL, &browser_plugin_message_class); | 840 WebBindings::createObject(NULL, &browser_plugin_message_class); |
821 np_object_ = static_cast<BrowserPluginBindings::BrowserPluginNPObject*>(obj); | 841 np_object_ = static_cast<BrowserPluginBindings::BrowserPluginNPObject*>(obj); |
822 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr(); | 842 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr(); |
823 | 843 |
824 method_bindings_.push_back(new BrowserPluginBindingAttachWindowTo); | 844 method_bindings_.push_back(new BrowserPluginBindingAttachWindowTo); |
825 method_bindings_.push_back(new BrowserPluginBindingBack); | 845 method_bindings_.push_back(new BrowserPluginBindingBack); |
826 method_bindings_.push_back(new BrowserPluginBindingCanGoBack); | 846 method_bindings_.push_back(new BrowserPluginBindingCanGoBack); |
827 method_bindings_.push_back(new BrowserPluginBindingCanGoForward); | 847 method_bindings_.push_back(new BrowserPluginBindingCanGoForward); |
828 method_bindings_.push_back(new BrowserPluginBindingForward); | 848 method_bindings_.push_back(new BrowserPluginBindingForward); |
| 849 method_bindings_.push_back(new BrowserPluginBindingGetInstanceID); |
829 method_bindings_.push_back(new BrowserPluginBindingGetProcessID); | 850 method_bindings_.push_back(new BrowserPluginBindingGetProcessID); |
830 method_bindings_.push_back(new BrowserPluginBindingGetRouteID); | 851 method_bindings_.push_back(new BrowserPluginBindingGetRouteID); |
831 method_bindings_.push_back(new BrowserPluginBindingGo); | 852 method_bindings_.push_back(new BrowserPluginBindingGo); |
832 method_bindings_.push_back(new BrowserPluginBindingPersistRequestObject); | 853 method_bindings_.push_back(new BrowserPluginBindingPersistRequestObject); |
833 method_bindings_.push_back(new BrowserPluginBindingReload); | 854 method_bindings_.push_back(new BrowserPluginBindingReload); |
834 method_bindings_.push_back(new BrowserPluginBindingSetPermission); | 855 method_bindings_.push_back(new BrowserPluginBindingSetPermission); |
835 method_bindings_.push_back(new BrowserPluginBindingStop); | 856 method_bindings_.push_back(new BrowserPluginBindingStop); |
836 method_bindings_.push_back(new BrowserPluginBindingTerminate); | 857 method_bindings_.push_back(new BrowserPluginBindingTerminate); |
837 | 858 |
838 property_bindings_.push_back(new BrowserPluginPropertyBindingAutoSize); | 859 property_bindings_.push_back(new BrowserPluginPropertyBindingAutoSize); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 for (PropertyBindingList::iterator iter = property_bindings_.begin(); | 937 for (PropertyBindingList::iterator iter = property_bindings_.begin(); |
917 iter != property_bindings_.end(); | 938 iter != property_bindings_.end(); |
918 ++iter) { | 939 ++iter) { |
919 if ((*iter)->MatchesName(name)) | 940 if ((*iter)->MatchesName(name)) |
920 return (*iter)->GetProperty(this, result); | 941 return (*iter)->GetProperty(this, result); |
921 } | 942 } |
922 return false; | 943 return false; |
923 } | 944 } |
924 | 945 |
925 } // namespace content | 946 } // namespace content |
OLD | NEW |