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

Side by Side Diff: extensions/browser/app_window/app_web_contents_helper.cc

Issue 562263002: Check media permissions through RenderFrameHostDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@render_frame_get_sources
Patch Set: Rebase Created 6 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/app_window/app_web_contents_helper.h" 5 #include "extensions/browser/app_window/app_web_contents_helper.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "content/public/browser/native_web_keyboard_event.h" 8 #include "content/public/browser/native_web_keyboard_event.h"
9 #include "content/public/browser/page_navigator.h" 9 #include "content/public/browser/page_navigator.h"
10 #include "content/public/browser/render_view_host.h" 10 #include "content/public/browser/render_view_host.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 const content::MediaStreamRequest& request, 90 const content::MediaStreamRequest& request,
91 const content::MediaResponseCallback& callback) const { 91 const content::MediaResponseCallback& callback) const {
92 const Extension* extension = GetExtension(); 92 const Extension* extension = GetExtension();
93 if (!extension) 93 if (!extension)
94 return; 94 return;
95 95
96 app_delegate_->RequestMediaAccessPermission( 96 app_delegate_->RequestMediaAccessPermission(
97 web_contents_, request, callback, extension); 97 web_contents_, request, callback, extension);
98 } 98 }
99 99
100 bool AppWebContentsHelper::CheckMediaAccessPermission(
101 const GURL& security_origin,
102 content::MediaStreamType type) const {
103 const Extension* extension = GetExtension();
104 if (!extension)
105 return false;
106
107 return app_delegate_->CheckMediaAccessPermission(
108 web_contents_, security_origin, type, extension);
109 }
110
100 const Extension* AppWebContentsHelper::GetExtension() const { 111 const Extension* AppWebContentsHelper::GetExtension() const {
101 return ExtensionRegistry::Get(browser_context_) 112 return ExtensionRegistry::Get(browser_context_)
102 ->enabled_extensions() 113 ->enabled_extensions()
103 .GetByID(extension_id_); 114 .GetByID(extension_id_);
104 } 115 }
105 116
106 void AppWebContentsHelper::AddMessageToDevToolsConsole( 117 void AppWebContentsHelper::AddMessageToDevToolsConsole(
107 content::ConsoleMessageLevel level, 118 content::ConsoleMessageLevel level,
108 const std::string& message) const { 119 const std::string& message) const {
109 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost(); 120 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost();
110 rvh->Send(new ExtensionMsg_AddMessageToConsole( 121 rvh->Send(new ExtensionMsg_AddMessageToConsole(
111 rvh->GetRoutingID(), level, message)); 122 rvh->GetRoutingID(), level, message));
112 } 123 }
113 124
114 } // namespace extensions 125 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/app_window/app_web_contents_helper.h ('k') | extensions/browser/app_window/app_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698