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

Unified Diff: chrome/browser/extensions/api/messaging/message_service.cc

Issue 118253005: Add managed policies for Native Messaging (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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: chrome/browser/extensions/api/messaging/message_service.cc
diff --git a/chrome/browser/extensions/api/messaging/message_service.cc b/chrome/browser/extensions/api/messaging/message_service.cc
index 23cf172c4daf91ea7aad51f38e62cb18dca2c6cd..ac0ecc8f96a0f80a3199ca76c8303f46329bb007 100644
--- a/chrome/browser/extensions/api/messaging/message_service.cc
+++ b/chrome/browser/extensions/api/messaging/message_service.cc
@@ -63,6 +63,8 @@ const char kReceivingEndDoesntExistError[] =
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
const char kMissingPermissionError[] =
"Access to native messaging requires nativeMessaging permission.";
+const char kProhibitedByPoliciesError[] =
+ "Access to then native messaging host is prohibited by system policies.";
Joao da Silva 2013/12/29 23:25:28 *the We often blame these restrictions on the sys
Sergey Ulanov 2014/01/06 23:21:55 Done.
#endif
struct MessageService::MessageChannel {
@@ -358,6 +360,13 @@ void MessageService::OpenChannelToNativeApp(
return;
}
+ // Verify that the host is not blocked by policies.
+ if (!NativeMessageProcessHost::IsHostAllowed(profile->GetPrefs(),
+ native_app_name)) {
+ DispatchOnDisconnect(source, receiver_port_id, kProhibitedByPoliciesError);
+ return;
+ }
+
scoped_ptr<MessageChannel> channel(new MessageChannel());
channel->opener.reset(new ExtensionMessagePort(source, MSG_ROUTING_CONTROL,
source_extension_id));

Powered by Google App Engine
This is Rietveld 408576698