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

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

Issue 12285015: 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 cbb9bd37fc29bc69b02905dd4f417f6a7ee34679..3922f1243f571bd570fec50f21b987822ddc6a52 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.
@@ -28,14 +32,25 @@ 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
- // killed if it has been started already.
- 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 killed if it has been started already.
+ 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::ProcessHandle* native_process_handle,

Powered by Google App Engine
This is Rietveld 408576698