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

Side by Side Diff: content/public/test/test_mojo_app.cc

Issue 1681813002: Rename Connection::AddService/ConnectToService to Connection::AddInterface/GetInterface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@interface_binder
Patch Set: . Created 4 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 unified diff | Download patch
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 "content/public/test/test_mojo_app.h" 5 #include "content/public/test/test_mojo_app.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "mojo/shell/public/cpp/connection.h" 10 #include "mojo/shell/public/cpp/connection.h"
11 #include "mojo/shell/public/cpp/shell.h" 11 #include "mojo/shell/public/cpp/shell.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 const char kTestMojoAppUrl[] = "system:content_mojo_test"; 15 const char kTestMojoAppUrl[] = "system:content_mojo_test";
16 16
17 TestMojoApp::TestMojoApp() : service_binding_(this), shell_(nullptr) { 17 TestMojoApp::TestMojoApp() : service_binding_(this), shell_(nullptr) {
18 } 18 }
19 19
20 TestMojoApp::~TestMojoApp() { 20 TestMojoApp::~TestMojoApp() {
21 } 21 }
22 22
23 void TestMojoApp::Initialize(mojo::Shell* shell, const std::string& url, 23 void TestMojoApp::Initialize(mojo::Shell* shell, const std::string& url,
24 uint32_t id) { 24 uint32_t id) {
25 shell_ = shell; 25 shell_ = shell;
26 } 26 }
27 27
28 bool TestMojoApp::AcceptConnection(mojo::Connection* connection) { 28 bool TestMojoApp::AcceptConnection(mojo::Connection* connection) {
29 requestor_url_ = GURL(connection->GetRemoteApplicationURL()); 29 requestor_url_ = GURL(connection->GetRemoteApplicationURL());
30 connection->AddService<TestMojoService>(this); 30 connection->AddInterface<TestMojoService>(this);
31 return true; 31 return true;
32 } 32 }
33 33
34 void TestMojoApp::Create(mojo::Connection* connection, 34 void TestMojoApp::Create(mojo::Connection* connection,
35 mojo::InterfaceRequest<TestMojoService> request) { 35 mojo::InterfaceRequest<TestMojoService> request) {
36 DCHECK(!service_binding_.is_bound()); 36 DCHECK(!service_binding_.is_bound());
37 service_binding_.Bind(std::move(request)); 37 service_binding_.Bind(std::move(request));
38 } 38 }
39 39
40 void TestMojoApp::DoSomething(const DoSomethingCallback& callback) { 40 void TestMojoApp::DoSomething(const DoSomethingCallback& callback) {
41 callback.Run(); 41 callback.Run();
42 DCHECK(shell_); 42 DCHECK(shell_);
43 shell_->Quit(); 43 shell_->Quit();
44 } 44 }
45 45
46 void TestMojoApp::GetRequestorURL(const GetRequestorURLCallback& callback) { 46 void TestMojoApp::GetRequestorURL(const GetRequestorURLCallback& callback) {
47 callback.Run(requestor_url_.spec()); 47 callback.Run(requestor_url_.spec());
48 } 48 }
49 49
50 } // namespace content 50 } // namespace content
OLDNEW
« no previous file with comments | « components/web_view/web_view_impl.cc ('k') | content/renderer/mus/render_widget_window_tree_client_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698