| Index: content/browser/mojo/mojo_shell_client_host.cc
|
| diff --git a/content/browser/mojo/mojo_shell_client_host.cc b/content/browser/mojo/mojo_shell_client_host.cc
|
| index 1bc85b51f168de0d8bc05c6909e59fe1d5f3771c..5ca93e03b34030307d93860f41aa847ffed816d5 100644
|
| --- a/content/browser/mojo/mojo_shell_client_host.cc
|
| +++ b/content/browser/mojo/mojo_shell_client_host.cc
|
| @@ -2,6 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include "base/strings/string_number_conversions.h"
|
| #include "base/strings/stringprintf.h"
|
| #include "base/thread_task_runner_handle.h"
|
| #include "content/browser/mojo/mojo_shell_client_host.h"
|
| @@ -9,6 +10,7 @@
|
| #include "content/public/browser/render_process_host.h"
|
| #include "content/public/common/mojo_shell_connection.h"
|
| #include "ipc/ipc_sender.h"
|
| +#include "mojo/application/public/cpp/application_connection.h"
|
| #include "mojo/application/public/cpp/application_impl.h"
|
| #include "mojo/converters/network/network_type_converters.h"
|
| #include "mojo/shell/application_manager.mojom.h"
|
| @@ -103,4 +105,17 @@ std::string GetMojoApplicationInstanceURL(
|
| return instance_url ? instance_url->get() : std::string();
|
| }
|
|
|
| +int GetRenderProcessIDFromConnection(mojo::ApplicationConnection* connection) {
|
| + // Just use the host name for finding the string to avoid checking for
|
| + // slashes.
|
| + const char kChromeRenderer[] = "chrome_renderer";
|
| + const std::string& url = connection->GetRemoteApplicationURL();
|
| + size_t pos = url.find_last_of(kChromeRenderer);
|
| + std::string val(url.substr(pos + 1, url.size() - pos - 2));
|
| + int render_process_id = 0;
|
| + if (!base::StringToInt(val, &render_process_id))
|
| + return 0;
|
| + return render_process_id;
|
| +}
|
| +
|
| } // namespace content
|
|
|