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

Unified Diff: chrome/browser/extensions/api/messaging/native_message_process_host.h

Issue 591463003: Remote Assistance on Chrome OS Part III - NativeMessageHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@native_messaging
Patch Set: Created 6 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/messaging/native_message_process_host.h
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host.h b/chrome/browser/extensions/api/messaging/native_message_process_host.h
index 47fe8723fd34a8809bb6da1d98bb30eaf5405160..5f7c1340ac3f8ff5ae2a56730cae181faa5299ae 100644
--- a/chrome/browser/extensions/api/messaging/native_message_process_host.h
+++ b/chrome/browser/extensions/api/messaging/native_message_process_host.h
@@ -14,6 +14,7 @@
#include "base/message_loop/message_loop.h"
#include "base/process/process.h"
#include "chrome/browser/extensions/api/messaging/native_process_launcher.h"
+#include "extensions/browser/api/messaging/native_message_host.h"
#include "ui/gfx/native_widget_types.h"
class PrefService;
Sergey Ulanov 2014/09/22 23:42:59 this can be removed
kelvinp 2014/09/23 20:16:42 Done.
@@ -35,46 +36,18 @@ namespace extensions {
// This class must only be created, called, and deleted on the IO thread.
// Public methods typically accept callbacks which will be invoked on the UI
// thread.
-class NativeMessageProcessHost
+class NativeMessageProcessHost :
#if defined(OS_POSIX)
- : public base::MessageLoopForIO::Watcher
+ public base::MessageLoopForIO::Watcher,
#endif // !defined(OS_POSIX)
-{
+ public NativeMessageHost {
public:
- // Interface for the object that receives messages from the native process.
- class Client {
- public:
- virtual ~Client() {}
- // Called on the UI thread.
- virtual void PostMessageFromNativeProcess(int port_id,
- const std::string& message) = 0;
- virtual void CloseChannel(int port_id,
- const std::string& error_message) = 0;
- };
-
- // 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.
- };
+ typedef NativeMessageHost::Client Client;
virtual ~NativeMessageProcessHost();
- // Returns policy permissions for the host with the specified name.
- static PolicyPermission IsHostAllowed(const PrefService* pref_service,
- const std::string& native_host_name);
-
- static scoped_ptr<NativeMessageProcessHost> Create(
- gfx::NativeView native_view,
- base::WeakPtr<Client> weak_client_ui,
- const std::string& source_extension_id,
- const std::string& native_host_name,
- int destination_port,
- bool allow_user_level);
-
// Create using specified |launcher|. Used in tests.
- static scoped_ptr<NativeMessageProcessHost> CreateWithLauncher(
+ static scoped_ptr<NativeMessageHost> CreateWithLauncher(
base::WeakPtr<Client> weak_client_ui,
const std::string& source_extension_id,
const std::string& native_host_name,
@@ -82,7 +55,7 @@ class NativeMessageProcessHost
scoped_ptr<NativeProcessLauncher> launcher);
// Send a message with the specified payload.
Sergey Ulanov 2014/09/22 23:42:59 Replace this comment with // NativeMessageHost imp
kelvinp 2014/09/23 20:16:42 Done.
- void Send(const std::string& json);
+ virtual void Send(const std::string& json) OVERRIDE;
#if defined(OS_POSIX)
// MessageLoopForIO::Watcher interface

Powered by Google App Engine
This is Rietveld 408576698