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

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

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_message_process_host.cc
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host.cc b/chrome/browser/extensions/api/messaging/native_message_process_host.cc
index bc7f725990f813b9f93688ea1a54b1ba9b7ade83..5a5fc4f8fd9723b3fcb207346704971724b9c7cf 100644
--- a/chrome/browser/extensions/api/messaging/native_message_process_host.cc
+++ b/chrome/browser/extensions/api/messaging/native_message_process_host.cc
@@ -11,6 +11,7 @@
#include "base/platform_file.h"
#include "base/process_util.h"
#include "base/values.h"
+#include "chrome/browser/extensions/api/messaging/native_messaging_host_manifest.h"
#include "chrome/browser/extensions/api/messaging/native_process_launcher.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
@@ -37,10 +38,12 @@ namespace extensions {
NativeMessageProcessHost::NativeMessageProcessHost(
base::WeakPtr<Client> weak_client_ui,
+ const std::string& source_extension_id,
const std::string& native_host_name,
int destination_port,
scoped_ptr<NativeProcessLauncher> launcher)
: weak_client_ui_(weak_client_ui),
+ source_extension_id_(source_extension_id),
native_host_name_(native_host_name),
destination_port_(destination_port),
launcher_(launcher.Pass()),
@@ -66,9 +69,11 @@ NativeMessageProcessHost::~NativeMessageProcessHost() {
// static
scoped_ptr<NativeMessageProcessHost> NativeMessageProcessHost::Create(
base::WeakPtr<Client> weak_client_ui,
+ const std::string& source_extension_id,
const std::string& native_host_name,
int destination_port) {
- return CreateWithLauncher(weak_client_ui, native_host_name, destination_port,
+ return CreateWithLauncher(weak_client_ui, source_extension_id,
+ native_host_name, destination_port,
NativeProcessLauncher::CreateDefault());
}
@@ -76,6 +81,7 @@ scoped_ptr<NativeMessageProcessHost> NativeMessageProcessHost::Create(
scoped_ptr<NativeMessageProcessHost>
NativeMessageProcessHost::CreateWithLauncher(
base::WeakPtr<Client> weak_client_ui,
+ const std::string& source_extension_id,
const std::string& native_host_name,
int destination_port,
scoped_ptr<NativeProcessLauncher> launcher) {
@@ -89,7 +95,8 @@ NativeMessageProcessHost::CreateWithLauncher(
}
process.reset(new NativeMessageProcessHost(
- weak_client_ui, native_host_name, destination_port, launcher.Pass()));
+ weak_client_ui, source_extension_id, native_host_name,
+ destination_port, launcher.Pass()));
return process.Pass();
}
@@ -98,7 +105,7 @@ void NativeMessageProcessHost::LaunchHostProcess() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
launcher_->Launch(
- native_host_name_, base::Bind(
+ source_extension_id_, native_host_name_, base::Bind(
&NativeMessageProcessHost::OnHostProcessLaunched,
base::Unretained(this)));
}

Powered by Google App Engine
This is Rietveld 408576698