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

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

Issue 12389041: Require manifests for native messaging hosts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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_process_launcher.h
diff --git a/chrome/browser/extensions/api/messaging/native_process_launcher.h b/chrome/browser/extensions/api/messaging/native_process_launcher.h
index f8188d4c97ea5b5c9826a966a68904650bd1bc4f..f1b6483b9d15a813653691661bfcd0896341ab39 100644
--- a/chrome/browser/extensions/api/messaging/native_process_launcher.h
+++ b/chrome/browser/extensions/api/messaging/native_process_launcher.h
@@ -8,12 +8,16 @@
#include "base/process.h"
#include "chrome/browser/extensions/api/messaging/native_message_process_host.h"
+class GURL;
+
namespace base {
class FilePath;
}
namespace extensions {
+class NativeMessagingHostManifest;
+
class NativeProcessLauncher {
public:
// Callback that's called after the process has been launched. |result| is
@@ -28,14 +32,26 @@ class NativeProcessLauncher {
NativeProcessLauncher() {}
virtual ~NativeProcessLauncher() {}
- // Launches native host with the specified name asynchronously. |callback| is
- // called after the process has been started. If the launcher is destroyed
- // before the callback is called then the call is canceled and the process is
- // stopped if it has been started already (by closing IO pipes).
- virtual void Launch(const std::string& native_host_name,
+ // Finds native messaging host with the specified name and launches it
+ // asynchronously. Also checks that the specified |origin| is permitted to
+ // access the host. |callback| is called after the process has been started.
+ // If the launcher is destroyed before the callback is called then the call is
+ // canceled and the process is stopped if it has been started already (by
+ // closing IO pipes).
+ virtual void Launch(const GURL& origin,
+ const std::string& native_host_name,
LaunchedCallback callback) const = 0;
protected:
+ // The following two methods are platform specific and are implemented in
+ // platform-specific .cc files.
+
+ // Loads manifest for the native messaging host |name|.
+ static scoped_ptr<NativeMessagingHostManifest> FindAndLoadManifest(
+ const std::string& native_host_name,
+ std::string* error_message);
+
+ // Launches native messaging process.
static bool LaunchNativeProcess(
const base::FilePath& path,
base::PlatformFile* read_file,

Powered by Google App Engine
This is Rietveld 408576698