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

Unified Diff: chrome/browser/extensions/api/tab_capture/tab_capture_api.cc

Issue 17298002: Allow tabCapture API to be granted for chrome:// pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use new permission instead Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
index ac0df0a4c59e45372400fac317638cdadc648857..e2067375dbf302f483540d8caed3f06ca8f0e5f7 100644
--- a/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
+++ b/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
@@ -13,13 +13,13 @@
#include "chrome/browser/extensions/api/tab_capture/tab_capture_registry_factory.h"
#include "chrome/browser/extensions/event_names.h"
#include "chrome/browser/extensions/extension_renderer_state.h"
-#include "chrome/browser/extensions/tab_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_tab_helper.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/extensions/permissions/permissions_data.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "extensions/common/features/feature.h"
@@ -73,10 +73,16 @@ bool TabCaptureCaptureFunction::RunImpl() {
const Extension* extension = GetExtension();
const std::string& extension_id = extension->id();
+ content::RenderViewHost* const rvh = target_contents->GetRenderViewHost();
+ int render_process_id = rvh->GetProcess()->GetID();
+ int routing_id = rvh->GetRoutingID();
not at google - send to devlin 2013/09/13 03:22:44 I don't see why you needed to move these up here,
justinlin 2013/09/13 19:27:32 Needed the tab_id.
+ int tab_id = SessionTabHelper::FromWebContents(target_contents)->
+ session_id().id();
+
// Make sure either we have been granted permission to capture through an
// extension icon click or our extension is whitelisted.
- if (!TabHelper::FromWebContents(target_contents)->
- active_tab_permission_granter()->IsGranted(extension) &&
+ if (!PermissionsData::HasAPIPermissionForTab(
+ extension, tab_id, APIPermission::kTabCaptureForTab) &&
CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kWhitelistedExtensionID) != extension_id &&
!FeatureProvider::GetByName("permission")->GetFeature("tabCapture")->
@@ -85,12 +91,6 @@ bool TabCaptureCaptureFunction::RunImpl() {
return false;
}
- content::RenderViewHost* const rvh = target_contents->GetRenderViewHost();
- int render_process_id = rvh->GetProcess()->GetID();
- int routing_id = rvh->GetRoutingID();
- int tab_id = SessionTabHelper::FromWebContents(target_contents)->
- session_id().id();
-
// Create a constraints vector. We will modify all the constraints in this
// vector to append our chrome specific constraints.
std::vector<MediaStreamConstraint*> constraints;

Powered by Google App Engine
This is Rietveld 408576698