OLD | NEW |
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_RENDERER_MOJO_MOJO_RENDER_PROCESS_OBSERVER_H_ | 5 #ifndef CONTENT_RENDERER_MOJO_MOJO_RENDER_PROCESS_OBSERVER_H_ |
6 #define CONTENT_RENDERER_MOJO_MOJO_RENDER_PROCESS_OBSERVER_H_ | 6 #define CONTENT_RENDERER_MOJO_MOJO_RENDER_PROCESS_OBSERVER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "content/common/mojo/render_process.mojom.h" | 9 #include "content/common/render_process.mojom.h" |
10 #include "content/public/renderer/render_process_observer.h" | 10 #include "content/public/renderer/render_process_observer.h" |
11 #include "ipc/ipc_platform_file.h" | 11 #include "ipc/ipc_platform_file.h" |
12 #include "mojo/public/cpp/bindings/remote_ptr.h" | 12 #include "mojo/public/cpp/bindings/remote_ptr.h" |
13 | 13 |
14 namespace mojo { | 14 namespace mojo { |
15 namespace embedder{ | 15 namespace embedder{ |
16 struct ChannelInfo; | 16 struct ChannelInfo; |
17 } | 17 } |
18 } | 18 } |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 class MojoChannelInit; | 22 class MojoChannelInit; |
23 class RenderThread; | 23 class RenderThread; |
24 | 24 |
25 // RenderProcessObserver implementation that initializes the mojo channel when | 25 // RenderProcessObserver implementation that initializes the mojo channel when |
26 // the right IPC is seen. | 26 // the right IPC is seen. |
27 // MojoRenderProcessObserver deletes itself when the RenderProcess is shutdown. | 27 // MojoRenderProcessObserver deletes itself when the RenderProcess is shutdown. |
28 class MojoRenderProcessObserver | 28 class MojoRenderProcessObserver |
29 : public content::RenderProcessObserver, | 29 : public content::RenderProcessObserver, |
30 public RenderProcessMojo { | 30 public IRenderProcess { |
31 public: | 31 public: |
32 MojoRenderProcessObserver(RenderThread* render_thread); | 32 MojoRenderProcessObserver(RenderThread* render_thread); |
33 | 33 |
34 // RenderProcessObserver overrides: | 34 // RenderProcessObserver methods: |
35 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; | 35 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; |
36 virtual void OnRenderProcessShutdown() OVERRIDE; | 36 virtual void OnRenderProcessShutdown() OVERRIDE; |
37 | 37 |
38 private: | 38 private: |
39 virtual ~MojoRenderProcessObserver(); | 39 virtual ~MojoRenderProcessObserver(); |
40 | 40 |
41 void OnChannelCreated(const IPC::PlatformFileForTransit& file); | 41 void OnActivate(const IPC::PlatformFileForTransit& file); |
42 | 42 |
43 // RenderProcessMojo overrides: | 43 // IRenderProcess methods: |
44 virtual void SetWebUIHandle( | 44 virtual void SetWebUIHandle( |
45 int32 view_routing_id, | 45 int32 view_routing_id, |
46 mojo::ScopedMessagePipeHandle web_ui_handle) OVERRIDE; | 46 mojo::ScopedMessagePipeHandle web_ui_handle) OVERRIDE; |
47 | 47 |
48 content::RenderThread* render_thread_; | 48 content::RenderThread* render_thread_; |
49 | 49 |
50 scoped_ptr<MojoChannelInit> channel_init_; | 50 scoped_ptr<MojoChannelInit> channel_init_; |
51 | 51 |
52 mojo::RemotePtr<content::RenderProcessHostMojo> render_process_host_mojo_; | 52 mojo::RemotePtr<IRenderProcessHost> render_process_host_; |
53 | 53 |
54 DISALLOW_COPY_AND_ASSIGN(MojoRenderProcessObserver); | 54 DISALLOW_COPY_AND_ASSIGN(MojoRenderProcessObserver); |
55 }; | 55 }; |
56 | 56 |
57 } // namespace content | 57 } // namespace content |
58 | 58 |
59 #endif // CONTENT_RENDERER_MOJO_MOJO_RENDER_PROCESS_OBSERVER_H_ | 59 #endif // CONTENT_RENDERER_MOJO_MOJO_RENDER_PROCESS_OBSERVER_H_ |
OLD | NEW |