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

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 6 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/messaging/native_message_process_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..415d31e60940ee4c6173838a8229367dc961b098 100644
--- a/chrome/browser/extensions/api/messaging/message_service.cc
+++ b/chrome/browser/extensions/api/messaging/message_service.cc
@@ -63,6 +63,9 @@ 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 the native messaging host was disabled by the system "
+ "administrator.";
#endif
struct MessageService::MessageChannel {
@@ -358,6 +361,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));
« no previous file with comments | « no previous file | chrome/browser/extensions/api/messaging/native_message_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698