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

Side by Side Diff: content/browser/mojo/mojo_shell_client_host.cc

Issue 1461243002: [OLD ATTEMPT, DO NOT REVIEW] mustash: Enable connections to mus from the Chrome renderer Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Ben's comments Created 5 years 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 unified diff | Download patch
« no previous file with comments | « content/browser/mojo/mojo_shell_client_host.h ('k') | content/browser/mus_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/strings/string_number_conversions.h"
5 #include "base/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
6 #include "base/thread_task_runner_handle.h" 7 #include "base/thread_task_runner_handle.h"
7 #include "content/browser/mojo/mojo_shell_client_host.h" 8 #include "content/browser/mojo/mojo_shell_client_host.h"
8 #include "content/common/mojo/mojo_messages.h" 9 #include "content/common/mojo/mojo_messages.h"
9 #include "content/public/browser/render_process_host.h" 10 #include "content/public/browser/render_process_host.h"
10 #include "content/public/common/mojo_shell_connection.h" 11 #include "content/public/common/mojo_shell_connection.h"
11 #include "ipc/ipc_sender.h" 12 #include "ipc/ipc_sender.h"
13 #include "mojo/application/public/cpp/application_connection.h"
12 #include "mojo/application/public/cpp/application_impl.h" 14 #include "mojo/application/public/cpp/application_impl.h"
13 #include "mojo/converters/network/network_type_converters.h" 15 #include "mojo/converters/network/network_type_converters.h"
14 #include "mojo/shell/application_manager.mojom.h" 16 #include "mojo/shell/application_manager.mojom.h"
15 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" 17 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
16 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h" 18 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
17 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h" 19 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
18 20
19 namespace content { 21 namespace content {
20 namespace { 22 namespace {
21 23
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 SetMojoApplicationInstanceURL(render_process_host, url); 98 SetMojoApplicationInstanceURL(render_process_host, url);
97 } 99 }
98 100
99 std::string GetMojoApplicationInstanceURL( 101 std::string GetMojoApplicationInstanceURL(
100 RenderProcessHost* render_process_host) { 102 RenderProcessHost* render_process_host) {
101 InstanceURL* instance_url = static_cast<InstanceURL*>( 103 InstanceURL* instance_url = static_cast<InstanceURL*>(
102 render_process_host->GetUserData(kMojoShellInstanceURL)); 104 render_process_host->GetUserData(kMojoShellInstanceURL));
103 return instance_url ? instance_url->get() : std::string(); 105 return instance_url ? instance_url->get() : std::string();
104 } 106 }
105 107
108 int GetRenderProcessIDFromConnection(mojo::ApplicationConnection* connection) {
109 // Just use the host name for finding the string to avoid checking for
110 // slashes.
111 const char kChromeRenderer[] = "chrome_renderer";
112 const std::string& url = connection->GetRemoteApplicationURL();
113 size_t pos = url.find_last_of(kChromeRenderer);
114 std::string val(url.substr(pos + 1, url.size() - pos - 2));
115 int render_process_id = 0;
116 if (!base::StringToInt(val, &render_process_id))
117 return 0;
118 return render_process_id;
119 }
120
106 } // namespace content 121 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/mojo/mojo_shell_client_host.h ('k') | content/browser/mus_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698