summaryrefslogtreecommitdiff
path: root/chromium/content/browser/mojo/mojo_app_connection_impl.cc
blob: 582da64dc5d7538ebc57120ed69717aeadc9788c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/mojo/mojo_app_connection_impl.h"

#include <stdint.h>
#include <utility>

#include "base/bind.h"
#include "content/browser/mojo/mojo_shell_context.h"

namespace content {

const char kBrowserMojoAppUrl[] = "system:content_browser";

namespace {
void OnGotInstanceID(shell::mojom::ConnectResult result,
                     const std::string& user_id,
                     uint32_t remote_id) {}
}  // namespace

// static
std::unique_ptr<MojoAppConnection> MojoAppConnection::Create(
    const std::string& user_id,
    const std::string& name,
    const std::string& requestor_name) {
  return std::unique_ptr<MojoAppConnection>(
      new MojoAppConnectionImpl(user_id, name, requestor_name));
}

MojoAppConnectionImpl::MojoAppConnectionImpl(
    const std::string& user_id,
    const std::string& name,
    const std::string& requestor_name) {
  MojoShellContext::ConnectToApplication(
      user_id, name, requestor_name, mojo::GetProxy(&interfaces_),
      shell::mojom::InterfaceProviderPtr(), base::Bind(&OnGotInstanceID));
}

MojoAppConnectionImpl::~MojoAppConnectionImpl() {
}

void MojoAppConnectionImpl::GetInterface(
    const std::string& interface_name,
    mojo::ScopedMessagePipeHandle handle) {
  interfaces_->GetInterface(interface_name, std::move(handle));
}

}  // namespace content