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