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

Side by Side Diff: content/browser/mojo/mojo_application_host.h

Issue 1676913002: [mojo] Delete third_party/mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ 5 #ifndef CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_
6 #define CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ 6 #define CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/process/process_handle.h" 11 #include "base/process/process_handle.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "content/common/application_setup.mojom.h" 13 #include "content/common/application_setup.mojom.h"
14 #include "content/common/mojo/channel_init.h" 14 #include "content/common/mojo/channel_init.h"
15 #include "content/common/mojo/service_registry_impl.h" 15 #include "content/common/mojo/service_registry_impl.h"
16 #include "mojo/edk/embedder/scoped_platform_handle.h"
16 #include "mojo/public/cpp/system/message_pipe.h" 17 #include "mojo/public/cpp/system/message_pipe.h"
17 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
18 18
19 #if defined(OS_ANDROID) 19 #if defined(OS_ANDROID)
20 #include "content/browser/mojo/service_registry_android.h" 20 #include "content/browser/mojo/service_registry_android.h"
21 #endif 21 #endif
22 22
23 namespace IPC { 23 namespace IPC {
24 class Sender; 24 class Sender;
25 } 25 }
26 26
27 namespace content { 27 namespace content {
28 28
29 // MojoApplicationHost represents the code needed on the browser side to setup 29 // MojoApplicationHost represents the code needed on the browser side to setup
30 // a child process as a Mojo application via Chrome IPC. The child process 30 // a child process as a Mojo application via Chrome IPC. The child process
31 // should use MojoApplication to handle messages generated by an instance of 31 // should use MojoApplication to handle messages generated by an instance of
32 // MojoApplicationHost. MojoApplicationHost makes the ServiceRegistry interface 32 // MojoApplicationHost. MojoApplicationHost makes the ServiceRegistry interface
33 // available so that child-provided services can be invoked. 33 // available so that child-provided services can be invoked.
34 class CONTENT_EXPORT MojoApplicationHost { 34 class CONTENT_EXPORT MojoApplicationHost {
35 public: 35 public:
36 MojoApplicationHost(); 36 MojoApplicationHost();
37 ~MojoApplicationHost(); 37 ~MojoApplicationHost();
38 38
39 // Two-phase initialization: 39 // Two-phase initialization:
40 // 1- Init makes service_registry() available synchronously. 40 // 1- Init makes service_registry() available synchronously.
41 // 2- Activate establishes the actual connection to the peer process. 41 // 2- Activate establishes the actual connection to the peer process.
42 bool Init(); 42 bool Init();
43 void Activate(IPC::Sender* sender, base::ProcessHandle process_handle); 43 void Activate(IPC::Sender* sender, base::ProcessHandle process_handle);
44 44
45 void WillDestroySoon();
46
47 ServiceRegistry* service_registry() { return &service_registry_; } 45 ServiceRegistry* service_registry() { return &service_registry_; }
48 46
49 #if defined(OS_ANDROID) 47 #if defined(OS_ANDROID)
50 ServiceRegistryAndroid* service_registry_android() { 48 ServiceRegistryAndroid* service_registry_android() {
51 return service_registry_android_.get(); 49 return service_registry_android_.get();
52 } 50 }
53 #endif 51 #endif
54 52
55 void OverrideIOTaskRunnerForTest( 53 void OverrideIOTaskRunnerForTest(
56 scoped_refptr<base::TaskRunner> io_task_runner); 54 scoped_refptr<base::TaskRunner> io_task_runner);
57 55
58 private: 56 private:
59 void OnMessagePipeCreated(mojo::ScopedMessagePipeHandle pipe); 57 void OnMessagePipeCreated(mojo::ScopedMessagePipeHandle pipe);
60 58
61 ChannelInit channel_init_; 59 ChannelInit channel_init_;
62 mojo::embedder::ScopedPlatformHandle client_handle_; 60 mojo::edk::ScopedPlatformHandle client_handle_;
63 61
64 bool did_activate_; 62 bool did_activate_;
65 63
66 scoped_ptr<ApplicationSetup> application_setup_; 64 scoped_ptr<ApplicationSetup> application_setup_;
67 ServiceRegistryImpl service_registry_; 65 ServiceRegistryImpl service_registry_;
68 66
69 scoped_refptr<base::TaskRunner> io_task_runner_override_; 67 scoped_refptr<base::TaskRunner> io_task_runner_override_;
70 68
71 #if defined(OS_ANDROID) 69 #if defined(OS_ANDROID)
72 scoped_ptr<ServiceRegistryAndroid> service_registry_android_; 70 scoped_ptr<ServiceRegistryAndroid> service_registry_android_;
73 #endif 71 #endif
74 72
75 base::WeakPtrFactory<MojoApplicationHost> weak_factory_; 73 base::WeakPtrFactory<MojoApplicationHost> weak_factory_;
76 74
77 DISALLOW_COPY_AND_ASSIGN(MojoApplicationHost); 75 DISALLOW_COPY_AND_ASSIGN(MojoApplicationHost);
78 }; 76 };
79 77
80 } // namespace content 78 } // namespace content
81 79
82 #endif // CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ 80 #endif // CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698