Commit e054f2eb authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

RemoteMacViews: Add AppShimHostBootstrap::GetAppShimPid

This will be queried in ExtensionAppShimHandler::OnProfileLoaded, where
we will check that the pid's signature.

Bug: 913362
Change-Id: I6fd144b26fad182d040f302f078a343cd2ab6cd9
Reviewed-on: https://chromium-review.googlesource.com/c/1373433
Commit-Queue: ccameron <ccameron@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615930}
parent 618e62b5
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
#include "chrome/browser/apps/app_shim/app_shim_host_bootstrap_mac.h" #include "chrome/browser/apps/app_shim/app_shim_host_bootstrap_mac.h"
#include <sys/socket.h>
#include <sys/un.h>
#include <memory> #include <memory>
#include <utility> #include <utility>
...@@ -28,6 +31,15 @@ AppShimHostBootstrap::~AppShimHostBootstrap() { ...@@ -28,6 +31,15 @@ AppShimHostBootstrap::~AppShimHostBootstrap() {
void AppShimHostBootstrap::ServeChannel( void AppShimHostBootstrap::ServeChannel(
mojo::PlatformChannelEndpoint endpoint) { mojo::PlatformChannelEndpoint endpoint) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(endpoint.platform_handle().is_fd());
socklen_t pid_size = sizeof(pid_);
if (getsockopt(endpoint.platform_handle().GetFD().get(), SOL_LOCAL,
LOCAL_PEERPID, &pid_, &pid_size)) {
LOG(ERROR) << "Failed to get peer pid for app shim.";
return;
}
mojo::ScopedMessagePipeHandle message_pipe = mojo::ScopedMessagePipeHandle message_pipe =
bootstrap_mojo_connection_.Connect(std::move(endpoint)); bootstrap_mojo_connection_.Connect(std::move(endpoint));
host_bootstrap_binding_.Bind( host_bootstrap_binding_.Bind(
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/process/process_handle.h"
#include "base/threading/thread_checker.h" #include "base/threading/thread_checker.h"
#include "chrome/browser/apps/app_shim/app_shim_host_mac.h" #include "chrome/browser/apps/app_shim/app_shim_host_mac.h"
#include "chrome/common/mac/app_shim.mojom.h" #include "chrome/common/mac/app_shim.mojom.h"
...@@ -29,6 +30,7 @@ class AppShimHostBootstrap : public chrome::mojom::AppShimHostBootstrap { ...@@ -29,6 +30,7 @@ class AppShimHostBootstrap : public chrome::mojom::AppShimHostBootstrap {
void OnLaunchAppFailed(apps::AppShimLaunchResult result); void OnLaunchAppFailed(apps::AppShimLaunchResult result);
chrome::mojom::AppShimHostRequest GetLaunchAppShimHostRequest(); chrome::mojom::AppShimHostRequest GetLaunchAppShimHostRequest();
base::ProcessId GetAppShimPid() const { return pid_; }
const std::string& GetAppId() const { return app_id_; } const std::string& GetAppId() const { return app_id_; }
const base::FilePath& GetProfilePath() const { return profile_path_; } const base::FilePath& GetProfilePath() const { return profile_path_; }
...@@ -59,6 +61,7 @@ class AppShimHostBootstrap : public chrome::mojom::AppShimHostBootstrap { ...@@ -59,6 +61,7 @@ class AppShimHostBootstrap : public chrome::mojom::AppShimHostBootstrap {
// The arguments from the LaunchApp call, and whether or not it has happened // The arguments from the LaunchApp call, and whether or not it has happened
// yet. // yet.
bool has_received_launch_app_ = false; bool has_received_launch_app_ = false;
base::ProcessId pid_ = 0;
chrome::mojom::AppShimHostRequest app_shim_host_request_; chrome::mojom::AppShimHostRequest app_shim_host_request_;
base::FilePath profile_path_; base::FilePath profile_path_;
std::string app_id_; std::string app_id_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment