Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: content/renderer/browser_plugin/browser_plugin_bindings.cc

Issue 11968054: <webview>: Implement ExecuteScript (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated stale browser_plugin_messages.h Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 24 matching lines...) Expand all
35 namespace content { 35 namespace content {
36 36
37 namespace { 37 namespace {
38 38
39 // Method bindings. 39 // Method bindings.
40 const char kMethodBack[] = "back"; 40 const char kMethodBack[] = "back";
41 const char kMethodCanGoBack[] = "canGoBack"; 41 const char kMethodCanGoBack[] = "canGoBack";
42 const char kMethodCanGoForward[] = "canGoForward"; 42 const char kMethodCanGoForward[] = "canGoForward";
43 const char kMethodForward[] = "forward"; 43 const char kMethodForward[] = "forward";
44 const char kMethodGetProcessId[] = "getProcessId"; 44 const char kMethodGetProcessId[] = "getProcessId";
45 const char kMethodGetRouteId[] = "getRouteId";
45 const char kMethodGo[] = "go"; 46 const char kMethodGo[] = "go";
46 const char kMethodReload[] = "reload"; 47 const char kMethodReload[] = "reload";
47 const char kMethodStop[] = "stop"; 48 const char kMethodStop[] = "stop";
48 const char kMethodTerminate[] = "terminate"; 49 const char kMethodTerminate[] = "terminate";
49 50
50 // Attributes. 51 // Attributes.
51 const char kAttributeAutoSize[] = "autoSize"; 52 const char kAttributeAutoSize[] = "autoSize";
52 const char kAttributeContentWindow[] = "contentWindow"; 53 const char kAttributeContentWindow[] = "contentWindow";
53 const char kAttributeMaxHeight[] = "maxHeight"; 54 const char kAttributeMaxHeight[] = "maxHeight";
54 const char kAttributeMaxWidth[] = "maxWidth"; 55 const char kAttributeMaxWidth[] = "maxWidth";
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 const NPVariant* args, 295 const NPVariant* args,
295 NPVariant* result) OVERRIDE { 296 NPVariant* result) OVERRIDE {
296 bindings->instance()->Forward(); 297 bindings->instance()->Forward();
297 return true; 298 return true;
298 } 299 }
299 300
300 private: 301 private:
301 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingForward); 302 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingForward);
302 }; 303 };
303 304
305 // Note: This is a method that is used internally by the <webview> shim only.
306 // This should not be exposed to developers.
lazyboy 2013/01/23 20:42:55 I wish we could ensure that these types of methods
Fady Samuel 2013/01/23 20:54:32 As long as it's not exposed in the shim, it cannot
307 class BrowserPluginBindingGetRouteID : public BrowserPluginMethodBinding {
308 public:
309 BrowserPluginBindingGetRouteID()
310 : BrowserPluginMethodBinding(kMethodGetRouteId, 0) {
311 }
312
313 virtual bool Invoke(BrowserPluginBindings* bindings,
314 const NPVariant* args,
315 NPVariant* result) OVERRIDE {
316 int route_id = bindings->instance()->guest_route_id();
317 INT32_TO_NPVARIANT(route_id, *result);
318 return true;
319 }
320
321 private:
322 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingGetRouteID);
323 };
324
304 class BrowserPluginBindingGetProcessID : public BrowserPluginMethodBinding { 325 class BrowserPluginBindingGetProcessID : public BrowserPluginMethodBinding {
305 public: 326 public:
306 BrowserPluginBindingGetProcessID() 327 BrowserPluginBindingGetProcessID()
307 : BrowserPluginMethodBinding(kMethodGetProcessId, 0) { 328 : BrowserPluginMethodBinding(kMethodGetProcessId, 0) {
308 } 329 }
309 330
310 virtual bool Invoke(BrowserPluginBindings* bindings, 331 virtual bool Invoke(BrowserPluginBindings* bindings,
311 const NPVariant* args, 332 const NPVariant* args,
312 NPVariant* result) OVERRIDE { 333 NPVariant* result) OVERRIDE {
313 int process_id = bindings->instance()->process_id(); 334 int process_id = bindings->instance()->guest_process_id();
314 INT32_TO_NPVARIANT(process_id, *result); 335 INT32_TO_NPVARIANT(process_id, *result);
315 return true; 336 return true;
316 } 337 }
317 338
318 private: 339 private:
319 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingGetProcessID); 340 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingGetProcessID);
320 }; 341 };
321 342
322 class BrowserPluginBindingGo : public BrowserPluginMethodBinding { 343 class BrowserPluginBindingGo : public BrowserPluginMethodBinding {
323 public: 344 public:
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 NPObject* obj = 703 NPObject* obj =
683 WebBindings::createObject(NULL, &browser_plugin_message_class); 704 WebBindings::createObject(NULL, &browser_plugin_message_class);
684 np_object_ = static_cast<BrowserPluginBindings::BrowserPluginNPObject*>(obj); 705 np_object_ = static_cast<BrowserPluginBindings::BrowserPluginNPObject*>(obj);
685 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr(); 706 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr();
686 707
687 method_bindings_.push_back(new BrowserPluginBindingBack); 708 method_bindings_.push_back(new BrowserPluginBindingBack);
688 method_bindings_.push_back(new BrowserPluginBindingCanGoBack); 709 method_bindings_.push_back(new BrowserPluginBindingCanGoBack);
689 method_bindings_.push_back(new BrowserPluginBindingCanGoForward); 710 method_bindings_.push_back(new BrowserPluginBindingCanGoForward);
690 method_bindings_.push_back(new BrowserPluginBindingForward); 711 method_bindings_.push_back(new BrowserPluginBindingForward);
691 method_bindings_.push_back(new BrowserPluginBindingGetProcessID); 712 method_bindings_.push_back(new BrowserPluginBindingGetProcessID);
713 method_bindings_.push_back(new BrowserPluginBindingGetRouteID);
692 method_bindings_.push_back(new BrowserPluginBindingGo); 714 method_bindings_.push_back(new BrowserPluginBindingGo);
693 method_bindings_.push_back(new BrowserPluginBindingReload); 715 method_bindings_.push_back(new BrowserPluginBindingReload);
694 method_bindings_.push_back(new BrowserPluginBindingStop); 716 method_bindings_.push_back(new BrowserPluginBindingStop);
695 method_bindings_.push_back(new BrowserPluginBindingTerminate); 717 method_bindings_.push_back(new BrowserPluginBindingTerminate);
696 718
697 property_bindings_.push_back(new BrowserPluginPropertyBindingAutoSize); 719 property_bindings_.push_back(new BrowserPluginPropertyBindingAutoSize);
698 property_bindings_.push_back(new BrowserPluginPropertyBindingContentWindow); 720 property_bindings_.push_back(new BrowserPluginPropertyBindingContentWindow);
699 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxHeight); 721 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxHeight);
700 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxWidth); 722 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxWidth);
701 property_bindings_.push_back(new BrowserPluginPropertyBindingMinHeight); 723 property_bindings_.push_back(new BrowserPluginPropertyBindingMinHeight);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 for (PropertyBindingList::iterator iter = property_bindings_.begin(); 785 for (PropertyBindingList::iterator iter = property_bindings_.begin();
764 iter != property_bindings_.end(); 786 iter != property_bindings_.end();
765 ++iter) { 787 ++iter) {
766 if ((*iter)->MatchesName(name)) 788 if ((*iter)->MatchesName(name))
767 return (*iter)->GetProperty(this, result); 789 return (*iter)->GetProperty(this, result);
768 } 790 }
769 return false; 791 return false;
770 } 792 }
771 793
772 } // namespace content 794 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698