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

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

Issue 17447005: <webview>: Move back, forward, canGoBack, canGoForward, go from content to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@filter_listener
Patch Set: Created 7 years, 6 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
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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 int window_id = IntFromNPVariant(args[1]); 241 int window_id = IntFromNPVariant(args[1]);
242 BOOLEAN_TO_NPVARIANT(BrowserPlugin::AttachWindowTo(node, window_id), 242 BOOLEAN_TO_NPVARIANT(BrowserPlugin::AttachWindowTo(node, window_id),
243 *result); 243 *result);
244 return true; 244 return true;
245 } 245 }
246 246
247 private: 247 private:
248 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingAttachWindowTo); 248 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingAttachWindowTo);
249 }; 249 };
250 250
251 class BrowserPluginBindingBack : public BrowserPluginMethodBinding {
252 public:
253 BrowserPluginBindingBack()
254 : BrowserPluginMethodBinding(browser_plugin::kMethodBack, 0) {
255 }
256
257 virtual bool Invoke(BrowserPluginBindings* bindings,
258 const NPVariant* args,
259 NPVariant* result) OVERRIDE {
260 bindings->instance()->Back();
261 return true;
262 }
263
264 private:
265 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingBack);
266 };
267
268 class BrowserPluginBindingCanGoBack : public BrowserPluginMethodBinding {
269 public:
270 BrowserPluginBindingCanGoBack()
271 : BrowserPluginMethodBinding(browser_plugin::kMethodCanGoBack, 0) {
272 }
273
274 virtual bool Invoke(BrowserPluginBindings* bindings,
275 const NPVariant* args,
276 NPVariant* result) OVERRIDE {
277 BOOLEAN_TO_NPVARIANT(bindings->instance()->CanGoBack(), *result);
278 return true;
279 }
280
281 private:
282 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingCanGoBack);
283 };
284
285 class BrowserPluginBindingCanGoForward : public BrowserPluginMethodBinding {
286 public:
287 BrowserPluginBindingCanGoForward()
288 : BrowserPluginMethodBinding(browser_plugin::kMethodCanGoForward, 0) {
289 }
290
291 virtual bool Invoke(BrowserPluginBindings* bindings,
292 const NPVariant* args,
293 NPVariant* result) OVERRIDE {
294 BOOLEAN_TO_NPVARIANT(bindings->instance()->CanGoForward(), *result);
295 return true;
296 }
297
298 private:
299 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingCanGoForward);
300 };
301
302 class BrowserPluginBindingForward : public BrowserPluginMethodBinding {
303 public:
304 BrowserPluginBindingForward()
305 : BrowserPluginMethodBinding(browser_plugin::kMethodForward, 0) {
306 }
307
308 virtual bool Invoke(BrowserPluginBindings* bindings,
309 const NPVariant* args,
310 NPVariant* result) OVERRIDE {
311 bindings->instance()->Forward();
312 return true;
313 }
314
315 private:
316 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingForward);
317 };
318
319 // Note: This is a method that is used internally by the <webview> shim only. 251 // Note: This is a method that is used internally by the <webview> shim only.
320 // This should not be exposed to developers. 252 // This should not be exposed to developers.
321 class BrowserPluginBindingGetInstanceID : public BrowserPluginMethodBinding { 253 class BrowserPluginBindingGetInstanceID : public BrowserPluginMethodBinding {
322 public: 254 public:
323 BrowserPluginBindingGetInstanceID() 255 BrowserPluginBindingGetInstanceID()
324 : BrowserPluginMethodBinding(browser_plugin::kMethodGetInstanceId, 0) { 256 : BrowserPluginMethodBinding(browser_plugin::kMethodGetInstanceId, 0) {
325 } 257 }
326 258
327 virtual bool Invoke(BrowserPluginBindings* bindings, 259 virtual bool Invoke(BrowserPluginBindings* bindings,
328 const NPVariant* args, 260 const NPVariant* args,
(...skipping 22 matching lines...) Expand all
351 NPVariant* result) OVERRIDE { 283 NPVariant* result) OVERRIDE {
352 int guest_instance_id = bindings->instance()->guest_instance_id(); 284 int guest_instance_id = bindings->instance()->guest_instance_id();
353 INT32_TO_NPVARIANT(guest_instance_id, *result); 285 INT32_TO_NPVARIANT(guest_instance_id, *result);
354 return true; 286 return true;
355 } 287 }
356 288
357 private: 289 private:
358 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingGetGuestInstanceID); 290 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingGetGuestInstanceID);
359 }; 291 };
360 292
361 class BrowserPluginBindingGo : public BrowserPluginMethodBinding {
362 public:
363 BrowserPluginBindingGo()
364 : BrowserPluginMethodBinding(browser_plugin::kMethodGo, 1) {
365 }
366
367 virtual bool Invoke(BrowserPluginBindings* bindings,
368 const NPVariant* args,
369 NPVariant* result) OVERRIDE {
370 bindings->instance()->Go(IntFromNPVariant(args[0]));
371 return true;
372 }
373
374 private:
375 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingGo);
376 };
377
378 // Note: This is a method that is used internally by the <webview> shim only. 293 // Note: This is a method that is used internally by the <webview> shim only.
379 // This should not be exposed to developers. 294 // This should not be exposed to developers.
380 class BrowserPluginBindingPersistRequestObject 295 class BrowserPluginBindingPersistRequestObject
381 : public BrowserPluginMethodBinding { 296 : public BrowserPluginMethodBinding {
382 public: 297 public:
383 BrowserPluginBindingPersistRequestObject() 298 BrowserPluginBindingPersistRequestObject()
384 : BrowserPluginMethodBinding(browser_plugin::kMethodInternalPersistObject, 299 : BrowserPluginMethodBinding(browser_plugin::kMethodInternalPersistObject,
385 3) { 300 3) {
386 } 301 }
387 302
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 : instance_(instance), 735 : instance_(instance),
821 np_object_(NULL), 736 np_object_(NULL),
822 weak_ptr_factory_(this) { 737 weak_ptr_factory_(this) {
823 NPObject* obj = 738 NPObject* obj =
824 WebBindings::createObject(instance->pluginNPP(), 739 WebBindings::createObject(instance->pluginNPP(),
825 &browser_plugin_message_class); 740 &browser_plugin_message_class);
826 np_object_ = static_cast<BrowserPluginBindings::BrowserPluginNPObject*>(obj); 741 np_object_ = static_cast<BrowserPluginBindings::BrowserPluginNPObject*>(obj);
827 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr(); 742 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr();
828 743
829 method_bindings_.push_back(new BrowserPluginBindingAttachWindowTo); 744 method_bindings_.push_back(new BrowserPluginBindingAttachWindowTo);
830 method_bindings_.push_back(new BrowserPluginBindingBack);
831 method_bindings_.push_back(new BrowserPluginBindingCanGoBack);
832 method_bindings_.push_back(new BrowserPluginBindingCanGoForward);
833 method_bindings_.push_back(new BrowserPluginBindingForward);
834 method_bindings_.push_back(new BrowserPluginBindingGetInstanceID); 745 method_bindings_.push_back(new BrowserPluginBindingGetInstanceID);
835 method_bindings_.push_back(new BrowserPluginBindingGetGuestInstanceID); 746 method_bindings_.push_back(new BrowserPluginBindingGetGuestInstanceID);
836 method_bindings_.push_back(new BrowserPluginBindingGo);
837 method_bindings_.push_back(new BrowserPluginBindingPersistRequestObject); 747 method_bindings_.push_back(new BrowserPluginBindingPersistRequestObject);
838 method_bindings_.push_back(new BrowserPluginBindingReload); 748 method_bindings_.push_back(new BrowserPluginBindingReload);
839 method_bindings_.push_back(new BrowserPluginBindingSetPermission); 749 method_bindings_.push_back(new BrowserPluginBindingSetPermission);
840 method_bindings_.push_back(new BrowserPluginBindingStop); 750 method_bindings_.push_back(new BrowserPluginBindingStop);
841 method_bindings_.push_back(new BrowserPluginBindingTerminate); 751 method_bindings_.push_back(new BrowserPluginBindingTerminate);
842 752
843 property_bindings_.push_back(new BrowserPluginPropertyBindingAutoSize); 753 property_bindings_.push_back(new BrowserPluginPropertyBindingAutoSize);
844 property_bindings_.push_back(new BrowserPluginPropertyBindingContentWindow); 754 property_bindings_.push_back(new BrowserPluginPropertyBindingContentWindow);
845 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxHeight); 755 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxHeight);
846 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxWidth); 756 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxWidth);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 for (PropertyBindingList::iterator iter = property_bindings_.begin(); 831 for (PropertyBindingList::iterator iter = property_bindings_.begin();
922 iter != property_bindings_.end(); 832 iter != property_bindings_.end();
923 ++iter) { 833 ++iter) {
924 if ((*iter)->MatchesName(name)) 834 if ((*iter)->MatchesName(name))
925 return (*iter)->GetProperty(this, result); 835 return (*iter)->GetProperty(this, result);
926 } 836 }
927 return false; 837 return false;
928 } 838 }
929 839
930 } // namespace content 840 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin.cc ('k') | content/test/data/browser_plugin_embedder.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698