Chromium Code Reviews| 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 #include "content/renderer/mojo/mojo_render_process_observer.h" | 5 #include "content/renderer/mojo/mojo_render_process_observer.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "content/child/child_process.h" | 8 #include "content/child/child_process.h" |
| 9 #include "content/common/mojo/mojo_channel_init.h" | 9 #include "content/common/mojo/mojo_channel_init.h" |
| 10 #include "content/common/mojo/mojo_messages.h" | 10 #include "content/common/mojo/mojo_messages.h" |
| 11 #include "content/public/renderer/render_thread.h" | 11 #include "content/public/renderer/render_thread.h" |
| 12 #include "content/public/renderer/render_view.h" | |
| 13 #include "content/renderer/web_ui_mojo.h" | |
| 12 | 14 |
| 13 namespace content { | 15 namespace content { |
| 14 | 16 |
| 15 MojoRenderProcessObserver::MojoRenderProcessObserver( | 17 MojoRenderProcessObserver::MojoRenderProcessObserver( |
| 16 RenderThread* render_thread) | 18 RenderThread* render_thread) |
| 17 : render_thread_(render_thread) { | 19 : render_thread_(render_thread) { |
| 18 render_thread_->AddObserver(this); | 20 render_thread_->AddObserver(this); |
| 19 } | 21 } |
| 20 | 22 |
| 21 bool MojoRenderProcessObserver::OnControlMessageReceived( | 23 bool MojoRenderProcessObserver::OnControlMessageReceived( |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 39 void MojoRenderProcessObserver::OnChannelCreated( | 41 void MojoRenderProcessObserver::OnChannelCreated( |
| 40 const IPC::PlatformFileForTransit& file) { | 42 const IPC::PlatformFileForTransit& file) { |
| 41 #if defined(OS_POSIX) | 43 #if defined(OS_POSIX) |
| 42 base::PlatformFile handle = file.fd; | 44 base::PlatformFile handle = file.fd; |
| 43 #elif defined(OS_WIN) | 45 #elif defined(OS_WIN) |
| 44 base::PlatformFile handle = file; | 46 base::PlatformFile handle = file; |
| 45 #endif | 47 #endif |
| 46 DCHECK(!channel_init_.get()); | 48 DCHECK(!channel_init_.get()); |
| 47 channel_init_.reset(new MojoChannelInit); | 49 channel_init_.reset(new MojoChannelInit); |
| 48 channel_init_->Init(handle, ChildProcess::current()->io_message_loop_proxy()); | 50 channel_init_->Init(handle, ChildProcess::current()->io_message_loop_proxy()); |
| 51 if (!channel_init_->is_handle_valid()) | |
| 52 return; | |
|
darin (slow to review)
2014/03/21 00:04:52
should there be an assertion here if the handle is
sky
2014/03/21 03:19:16
I think you're suggesting to make this a DCHECK, r
| |
| 53 | |
| 54 ScopedRenderProcessHostMojoHandle render_process_host_handle( | |
| 55 RenderProcessHostMojoHandle( | |
| 56 channel_init_->bootstrap_message_pipe().release().value())); | |
| 57 render_process_host_mojo_.reset(render_process_host_handle.Pass(), this); | |
| 58 } | |
| 59 | |
| 60 void MojoRenderProcessObserver::SetBrowserWebUIHandle( | |
|
darin (slow to review)
2014/03/21 00:04:52
I see why the view ID is needed now. Hmm, OK. Long
sky
2014/03/21 03:19:16
I agree. Long term it seems like we'll want an int
| |
| 61 int32 view_routing_id, | |
| 62 mojo::ScopedHandle web_ui_handle) { | |
| 63 RenderView* render_view = RenderView::FromRoutingID(view_routing_id); | |
| 64 if (!render_view) | |
| 65 return; | |
| 66 WebUIMojo* web_ui_mojo = WebUIMojo::Get(render_view); | |
| 67 if (!web_ui_mojo) | |
| 68 return; | |
| 69 web_ui_mojo->SetBrowserHandle(web_ui_handle.Pass()); | |
| 49 } | 70 } |
| 50 | 71 |
| 51 } // namespace content | 72 } // namespace content |
| OLD | NEW |