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

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

Issue 11093080: <webview>: First stab at implementing media permission request for guests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments from Fady. Created 7 years, 10 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 const NPVariant* args, 331 const NPVariant* args,
332 NPVariant* result) OVERRIDE { 332 NPVariant* result) OVERRIDE {
333 bindings->instance()->Go(Int32FromNPVariant(args[0])); 333 bindings->instance()->Go(Int32FromNPVariant(args[0]));
334 return true; 334 return true;
335 } 335 }
336 336
337 private: 337 private:
338 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingGo); 338 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingGo);
339 }; 339 };
340 340
341 // Note: This is a method that is used internally by the <webview> shim only.
342 // This should not be exposed to developers.
343 class BrowserPluginBindingPersistRequestObject
344 : public BrowserPluginMethodBinding {
345 public:
346 BrowserPluginBindingPersistRequestObject()
347 : BrowserPluginMethodBinding(browser_plugin::kMethodInternalPersistObject,
348 3) {
349 }
350
351 virtual bool Invoke(BrowserPluginBindings* bindings,
352 const NPVariant* args,
353 NPVariant* result) OVERRIDE {
354 bindings->instance()->PersistRequestObject(
355 &args[0], StringFromNPVariant(args[1]), Int32FromNPVariant(args[2]));
356 return true;
357 }
358
359 private:
360 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingPersistRequestObject);
361 };
362
341 class BrowserPluginBindingReload : public BrowserPluginMethodBinding { 363 class BrowserPluginBindingReload : public BrowserPluginMethodBinding {
342 public: 364 public:
343 BrowserPluginBindingReload() 365 BrowserPluginBindingReload()
344 : BrowserPluginMethodBinding(browser_plugin::kMethodReload, 0) { 366 : BrowserPluginMethodBinding(browser_plugin::kMethodReload, 0) {
345 } 367 }
346 368
347 virtual bool Invoke(BrowserPluginBindings* bindings, 369 virtual bool Invoke(BrowserPluginBindings* bindings,
348 const NPVariant* args, 370 const NPVariant* args,
349 NPVariant* result) OVERRIDE { 371 NPVariant* result) OVERRIDE {
350 bindings->instance()->Reload(); 372 bindings->instance()->Reload();
(...skipping 14 matching lines...) Expand all
365 const NPVariant* args, 387 const NPVariant* args,
366 NPVariant* result) OVERRIDE { 388 NPVariant* result) OVERRIDE {
367 bindings->instance()->Stop(); 389 bindings->instance()->Stop();
368 return true; 390 return true;
369 } 391 }
370 392
371 private: 393 private:
372 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingStop); 394 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingStop);
373 }; 395 };
374 396
397 // Note: This is a method that is used internally by the <webview> shim only.
398 // This should not be exposed to developers.
399 class BrowserPluginBindingSetPermission : public BrowserPluginMethodBinding {
400 public:
401 BrowserPluginBindingSetPermission()
402 : BrowserPluginMethodBinding(
403 browser_plugin::kMethodInternalSetPermission, 2) {
404 }
405
406 virtual bool Invoke(BrowserPluginBindings* bindings,
407 const NPVariant* args,
408 NPVariant* result) OVERRIDE {
409 int request_id = Int32FromNPVariant(args[0]);
410 bool allow = NPVARIANT_TO_BOOLEAN(args[1]);
411 bindings->instance()->OnEmbedderDecidedPermission(request_id, allow);
412 return true;
413 }
414
415 private:
416 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingSetPermission);
417 };
418
375 class BrowserPluginBindingTerminate : public BrowserPluginMethodBinding { 419 class BrowserPluginBindingTerminate : public BrowserPluginMethodBinding {
376 public: 420 public:
377 BrowserPluginBindingTerminate() 421 BrowserPluginBindingTerminate()
378 : BrowserPluginMethodBinding(browser_plugin::kMethodTerminate, 0) { 422 : BrowserPluginMethodBinding(browser_plugin::kMethodTerminate, 0) {
379 } 423 }
380 424
381 virtual bool Invoke(BrowserPluginBindings* bindings, 425 virtual bool Invoke(BrowserPluginBindings* bindings,
382 const NPVariant* args, 426 const NPVariant* args,
383 NPVariant* result) OVERRIDE { 427 NPVariant* result) OVERRIDE {
384 bindings->instance()->TerminateGuest(); 428 bindings->instance()->TerminateGuest();
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 np_object_ = static_cast<BrowserPluginBindings::BrowserPluginNPObject*>(obj); 792 np_object_ = static_cast<BrowserPluginBindings::BrowserPluginNPObject*>(obj);
749 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr(); 793 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr();
750 794
751 method_bindings_.push_back(new BrowserPluginBindingBack); 795 method_bindings_.push_back(new BrowserPluginBindingBack);
752 method_bindings_.push_back(new BrowserPluginBindingCanGoBack); 796 method_bindings_.push_back(new BrowserPluginBindingCanGoBack);
753 method_bindings_.push_back(new BrowserPluginBindingCanGoForward); 797 method_bindings_.push_back(new BrowserPluginBindingCanGoForward);
754 method_bindings_.push_back(new BrowserPluginBindingForward); 798 method_bindings_.push_back(new BrowserPluginBindingForward);
755 method_bindings_.push_back(new BrowserPluginBindingGetProcessID); 799 method_bindings_.push_back(new BrowserPluginBindingGetProcessID);
756 method_bindings_.push_back(new BrowserPluginBindingGetRouteID); 800 method_bindings_.push_back(new BrowserPluginBindingGetRouteID);
757 method_bindings_.push_back(new BrowserPluginBindingGo); 801 method_bindings_.push_back(new BrowserPluginBindingGo);
802 method_bindings_.push_back(new BrowserPluginBindingPersistRequestObject);
758 method_bindings_.push_back(new BrowserPluginBindingReload); 803 method_bindings_.push_back(new BrowserPluginBindingReload);
804 method_bindings_.push_back(new BrowserPluginBindingSetPermission);
759 method_bindings_.push_back(new BrowserPluginBindingStop); 805 method_bindings_.push_back(new BrowserPluginBindingStop);
760 method_bindings_.push_back(new BrowserPluginBindingTerminate); 806 method_bindings_.push_back(new BrowserPluginBindingTerminate);
761 807
762 property_bindings_.push_back(new BrowserPluginPropertyBindingAutoSize); 808 property_bindings_.push_back(new BrowserPluginPropertyBindingAutoSize);
763 property_bindings_.push_back(new BrowserPluginPropertyBindingContentWindow); 809 property_bindings_.push_back(new BrowserPluginPropertyBindingContentWindow);
764 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxHeight); 810 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxHeight);
765 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxWidth); 811 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxWidth);
766 property_bindings_.push_back(new BrowserPluginPropertyBindingMinHeight); 812 property_bindings_.push_back(new BrowserPluginPropertyBindingMinHeight);
767 property_bindings_.push_back(new BrowserPluginPropertyBindingMinWidth); 813 property_bindings_.push_back(new BrowserPluginPropertyBindingMinWidth);
768 property_bindings_.push_back(new BrowserPluginPropertyBindingName); 814 property_bindings_.push_back(new BrowserPluginPropertyBindingName);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 for (PropertyBindingList::iterator iter = property_bindings_.begin(); 886 for (PropertyBindingList::iterator iter = property_bindings_.begin();
841 iter != property_bindings_.end(); 887 iter != property_bindings_.end();
842 ++iter) { 888 ++iter) {
843 if ((*iter)->MatchesName(name)) 889 if ((*iter)->MatchesName(name))
844 return (*iter)->GetProperty(this, result); 890 return (*iter)->GetProperty(this, result);
845 } 891 }
846 return false; 892 return false;
847 } 893 }
848 894
849 } // namespace content 895 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698