Chromium Code Reviews| Index: chrome/browser/extensions/api/messaging/message_service.h |
| diff --git a/chrome/browser/extensions/api/messaging/message_service.h b/chrome/browser/extensions/api/messaging/message_service.h |
| index a8ca3231bb8db84c18a7c7c36bfde9d5bc2bcaca..d76a11b52a0266531f05c500313ffd3232b8e810 100644 |
| --- a/chrome/browser/extensions/api/messaging/message_service.h |
| +++ b/chrome/browser/extensions/api/messaging/message_service.h |
| @@ -14,9 +14,9 @@ |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/weak_ptr.h" |
| #include "chrome/browser/extensions/api/messaging/message_property_provider.h" |
| -#include "chrome/browser/extensions/api/messaging/native_message_process_host.h" |
| #include "content/public/browser/notification_observer.h" |
| #include "content/public/browser/notification_registrar.h" |
| +#include "extensions/browser/api/messaging/native_message_host.h" |
| #include "extensions/browser/browser_context_keyed_api_factory.h" |
| #include "extensions/common/api/messaging/message.h" |
| @@ -61,8 +61,15 @@ class LazyBackgroundTaskQueue; |
| // RenderProcessHost or a RenderViewHost. |
| class MessageService : public BrowserContextKeyedAPI, |
| public content::NotificationObserver, |
| - public NativeMessageProcessHost::Client { |
| + public NativeMessageHost::Client { |
| public: |
| + // Result returned from IsHostAllowed(). |
| + enum PolicyPermission { |
| + DISALLOW, // The host is not allowed. |
| + ALLOW_SYSTEM_ONLY, // Allowed only when installed on system level. |
| + ALLOW_ALL, // Allowed when installed on system or user level. |
| + }; |
| + |
| // A messaging channel. Note that the opening port can be the same as the |
| // receiver, if an extension background page wants to talk to its tab (for |
| // example). |
| @@ -153,12 +160,15 @@ class MessageService : public BrowserContextKeyedAPI, |
| // port if the channel isn't pending. |
| void PostMessage(int port_id, const Message& message); |
| - // NativeMessageProcessHost::Client |
| - virtual void PostMessageFromNativeProcess( |
| - int port_id, |
| - const std::string& message) OVERRIDE; |
| + // NativeMessageHost::Client implementation. |
| + virtual void PostMessageFromNativeHost(int port_id, |
| + const std::string& message) OVERRIDE; |
| private: |
| + // Returns policy permissions for the host with the specified name. |
| + static PolicyPermission IsHostAllowed(const PrefService* pref_service, |
|
Sergey Ulanov
2014/09/25 01:45:21
This doesn't really need to be part of the Message
kelvinp
2014/09/26 18:12:27
Done.
|
| + const std::string& native_host_name); |
| + |
| friend class MockMessageService; |
| friend class BrowserContextKeyedAPIFactory<MessageService>; |
| struct OpenChannelParams; |