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

Unified Diff: extensions/renderer/script_context.cc

Issue 789063002: Implement clipboardRead/Write content capabilities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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: extensions/renderer/script_context.cc
diff --git a/extensions/renderer/script_context.cc b/extensions/renderer/script_context.cc
index 6a7629e300b6f88a322651fa459a815c7cae6eac..b51921955ef85b7f01649723f2bd82a38f7ee838 100644
--- a/extensions/renderer/script_context.cc
+++ b/extensions/renderer/script_context.cc
@@ -17,6 +17,7 @@
#include "extensions/common/extension_api.h"
#include "extensions/common/extension_urls.h"
#include "extensions/common/features/base_feature_provider.h"
+#include "extensions/common/permissions/permissions_data.h"
#include "gin/per_context_data.h"
#include "third_party/WebKit/public/web/WebDataSource.h"
#include "third_party/WebKit/public/web/WebDocument.h"
@@ -273,4 +274,20 @@ gin::ContextHolder* ScriptContext::GetContextHolder() {
return gin::PerContextData::From(v8_context())->context_holder();
}
+void ScriptContext::SetContentCapabilities(
+ const APIPermissionSet& permissions) {
+ content_capabilities_ = permissions;
not at google - send to devlin 2014/12/10 17:33:54 Can you just make ScriptContext (lazily, I suppose
Ken Rockot(use gerrit already) 2014/12/10 18:31:41 What about handling the case where an extension (w
+}
+
+bool ScriptContext::HasEffectiveAPIPermission(
+ APIPermission::ID permission) const {
+ if (content_capabilities_.find(permission) != content_capabilities_.end())
+ return true;
not at google - send to devlin 2014/12/10 17:33:54 Consider being a little conservative here, and che
+ if (effective_extension_.get()) {
+ return effective_extension_->permissions_data()->HasAPIPermission(
+ permission);
+ }
+ return false;
+}
+
} // namespace extensions
« extensions/renderer/script_context.h ('K') | « extensions/renderer/script_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698