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

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: Implement first allow/deny wins, still requires preventDefault impl + now tests pass. 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 const NPVariant* args, 362 const NPVariant* args,
363 NPVariant* result) OVERRIDE { 363 NPVariant* result) OVERRIDE {
364 bindings->instance()->Stop(); 364 bindings->instance()->Stop();
365 return true; 365 return true;
366 } 366 }
367 367
368 private: 368 private:
369 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingStop); 369 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingStop);
370 }; 370 };
371 371
372 // Note: This is a method that is used internally by the <webview> shim only.
373 // This should not be exposed to developers.
374 class BrowserPluginBindingSetMediaPermission
375 : public BrowserPluginMethodBinding {
376 public:
377 BrowserPluginBindingSetMediaPermission()
378 : BrowserPluginMethodBinding(browser_plugin::kMethodSetMediaPermission,
379 2) {
380 }
381
382 virtual bool Invoke(BrowserPluginBindings* bindings,
383 const NPVariant* args,
384 NPVariant* result) OVERRIDE {
385 int request_id = Int32FromNPVariant(args[0]);
386 bool allow = NPVARIANT_TO_BOOLEAN(args[1]);
387 bindings->instance()->OnListenerCallMediaAccess(request_id, allow);
388 return true;
389 }
390
391 private:
392 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingSetMediaPermission);
393 };
394
372 class BrowserPluginBindingTerminate : public BrowserPluginMethodBinding { 395 class BrowserPluginBindingTerminate : public BrowserPluginMethodBinding {
373 public: 396 public:
374 BrowserPluginBindingTerminate() 397 BrowserPluginBindingTerminate()
375 : BrowserPluginMethodBinding(browser_plugin::kMethodTerminate, 0) { 398 : BrowserPluginMethodBinding(browser_plugin::kMethodTerminate, 0) {
376 } 399 }
377 400
378 virtual bool Invoke(BrowserPluginBindings* bindings, 401 virtual bool Invoke(BrowserPluginBindings* bindings,
379 const NPVariant* args, 402 const NPVariant* args,
380 NPVariant* result) OVERRIDE { 403 NPVariant* result) OVERRIDE {
381 bindings->instance()->TerminateGuest(); 404 bindings->instance()->TerminateGuest();
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr(); 705 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr();
683 706
684 method_bindings_.push_back(new BrowserPluginBindingBack); 707 method_bindings_.push_back(new BrowserPluginBindingBack);
685 method_bindings_.push_back(new BrowserPluginBindingCanGoBack); 708 method_bindings_.push_back(new BrowserPluginBindingCanGoBack);
686 method_bindings_.push_back(new BrowserPluginBindingCanGoForward); 709 method_bindings_.push_back(new BrowserPluginBindingCanGoForward);
687 method_bindings_.push_back(new BrowserPluginBindingForward); 710 method_bindings_.push_back(new BrowserPluginBindingForward);
688 method_bindings_.push_back(new BrowserPluginBindingGetProcessID); 711 method_bindings_.push_back(new BrowserPluginBindingGetProcessID);
689 method_bindings_.push_back(new BrowserPluginBindingGetRouteID); 712 method_bindings_.push_back(new BrowserPluginBindingGetRouteID);
690 method_bindings_.push_back(new BrowserPluginBindingGo); 713 method_bindings_.push_back(new BrowserPluginBindingGo);
691 method_bindings_.push_back(new BrowserPluginBindingReload); 714 method_bindings_.push_back(new BrowserPluginBindingReload);
715 method_bindings_.push_back(new BrowserPluginBindingSetMediaPermission);
692 method_bindings_.push_back(new BrowserPluginBindingStop); 716 method_bindings_.push_back(new BrowserPluginBindingStop);
693 method_bindings_.push_back(new BrowserPluginBindingTerminate); 717 method_bindings_.push_back(new BrowserPluginBindingTerminate);
694 718
695 property_bindings_.push_back(new BrowserPluginPropertyBindingAutoSize); 719 property_bindings_.push_back(new BrowserPluginPropertyBindingAutoSize);
696 property_bindings_.push_back(new BrowserPluginPropertyBindingContentWindow); 720 property_bindings_.push_back(new BrowserPluginPropertyBindingContentWindow);
697 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxHeight); 721 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxHeight);
698 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxWidth); 722 property_bindings_.push_back(new BrowserPluginPropertyBindingMaxWidth);
699 property_bindings_.push_back(new BrowserPluginPropertyBindingMinHeight); 723 property_bindings_.push_back(new BrowserPluginPropertyBindingMinHeight);
700 property_bindings_.push_back(new BrowserPluginPropertyBindingMinWidth); 724 property_bindings_.push_back(new BrowserPluginPropertyBindingMinWidth);
701 property_bindings_.push_back(new BrowserPluginPropertyBindingName); 725 property_bindings_.push_back(new BrowserPluginPropertyBindingName);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 for (PropertyBindingList::iterator iter = property_bindings_.begin(); 784 for (PropertyBindingList::iterator iter = property_bindings_.begin();
761 iter != property_bindings_.end(); 785 iter != property_bindings_.end();
762 ++iter) { 786 ++iter) {
763 if ((*iter)->MatchesName(name)) 787 if ((*iter)->MatchesName(name))
764 return (*iter)->GetProperty(this, result); 788 return (*iter)->GetProperty(this, result);
765 } 789 }
766 return false; 790 return false;
767 } 791 }
768 792
769 } // namespace content 793 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698