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

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

Issue 1674903003: Extract shell methods from ApplicationImpl into a base class, and pass this to Initialize() instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojom
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
« no previous file with comments | « content/public/common/mojo_shell_connection.h ('k') | content/public/test/test_mojo_app.cc » ('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 #ifndef CONTENT_PUBLIC_TEST_TEST_MOJO_APP_H_ 5 #ifndef CONTENT_PUBLIC_TEST_TEST_MOJO_APP_H_
6 #define CONTENT_PUBLIC_TEST_TEST_MOJO_APP_H_ 6 #define CONTENT_PUBLIC_TEST_TEST_MOJO_APP_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "content/public/test/test_mojo_service.mojom.h" 9 #include "content/public/test/test_mojo_service.mojom.h"
10 #include "mojo/public/cpp/bindings/binding.h" 10 #include "mojo/public/cpp/bindings/binding.h"
11 #include "mojo/shell/public/cpp/application_delegate.h" 11 #include "mojo/shell/public/cpp/application_delegate.h"
12 #include "mojo/shell/public/cpp/interface_factory.h" 12 #include "mojo/shell/public/cpp/interface_factory.h"
13 #include "url/gurl.h" 13 #include "url/gurl.h"
14 14
15 namespace content { 15 namespace content {
16 16
17 extern const char kTestMojoAppUrl[]; 17 extern const char kTestMojoAppUrl[];
18 18
19 // Simple Mojo app which provides a TestMojoService impl. The app terminates 19 // Simple Mojo app which provides a TestMojoService impl. The app terminates
20 // itself after its TestService fulfills a single DoSomething call. 20 // itself after its TestService fulfills a single DoSomething call.
21 class TestMojoApp : public mojo::ApplicationDelegate, 21 class TestMojoApp : public mojo::ApplicationDelegate,
22 public mojo::InterfaceFactory<TestMojoService>, 22 public mojo::InterfaceFactory<TestMojoService>,
23 public TestMojoService { 23 public TestMojoService {
24 public: 24 public:
25 TestMojoApp(); 25 TestMojoApp();
26 ~TestMojoApp() override; 26 ~TestMojoApp() override;
27 27
28 private: 28 private:
29 // mojo::ApplicationDelegate: 29 // mojo::ApplicationDelegate:
30 void Initialize(mojo::ApplicationImpl* app) override; 30 void Initialize(mojo::Shell* shell, const std::string& url,
31 uint32_t id) override;
31 bool AcceptConnection( 32 bool AcceptConnection(
32 mojo::ApplicationConnection* connection) override; 33 mojo::ApplicationConnection* connection) override;
33 34
34 // mojo::InterfaceFactory<TestMojoService>: 35 // mojo::InterfaceFactory<TestMojoService>:
35 void Create(mojo::ApplicationConnection* connection, 36 void Create(mojo::ApplicationConnection* connection,
36 mojo::InterfaceRequest<TestMojoService> request) override; 37 mojo::InterfaceRequest<TestMojoService> request) override;
37 38
38 // TestMojoService: 39 // TestMojoService:
39 void DoSomething(const DoSomethingCallback& callback) override; 40 void DoSomething(const DoSomethingCallback& callback) override;
40 void GetRequestorURL(const GetRequestorURLCallback& callback) override; 41 void GetRequestorURL(const GetRequestorURLCallback& callback) override;
41 42
42 mojo::Binding<TestMojoService> service_binding_; 43 mojo::Binding<TestMojoService> service_binding_;
43 44
44 // Not owned. 45 // Not owned.
45 mojo::ApplicationImpl* app_; 46 mojo::Shell* shell_;
46 47
47 // The URL of the app connecting to us. 48 // The URL of the app connecting to us.
48 GURL requestor_url_; 49 GURL requestor_url_;
49 50
50 DISALLOW_COPY_AND_ASSIGN(TestMojoApp); 51 DISALLOW_COPY_AND_ASSIGN(TestMojoApp);
51 }; 52 };
52 53
53 } // namespace 54 } // namespace
54 55
55 #endif // CONTENT_PUBLIC_TEST_TEST_MOJO_APP_H_ 56 #endif // CONTENT_PUBLIC_TEST_TEST_MOJO_APP_H_
OLDNEW
« no previous file with comments | « content/public/common/mojo_shell_connection.h ('k') | content/public/test/test_mojo_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698