| 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/web_ui_mojo.h" | 5 #include "content/renderer/web_ui_mojo.h" |
| 6 | 6 |
| 7 #include "content/common/view_messages.h" | 7 #include "content/common/view_messages.h" |
| 8 #include "content/public/common/service_registry.h" | 8 #include "content/public/common/service_registry.h" |
| 9 #include "content/public/renderer/render_frame.h" | 9 #include "content/public/renderer/render_frame.h" |
| 10 #include "content/public/renderer/render_view.h" | 10 #include "content/public/renderer/render_view.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 return; | 82 return; |
| 83 context_data->RemoveUserData(kWebUIMojoContextStateKey); | 83 context_data->RemoveUserData(kWebUIMojoContextStateKey); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void WebUIMojo::OnDidFinishDocumentLoad() { | 86 void WebUIMojo::OnDidFinishDocumentLoad() { |
| 87 did_finish_document_load_ = true; | 87 did_finish_document_load_ = true; |
| 88 mojo::MessagePipe pipe; | 88 mojo::MessagePipe pipe; |
| 89 SetHandleOnContextState(pipe.handle0.Pass()); | 89 SetHandleOnContextState(pipe.handle0.Pass()); |
| 90 RenderFrame::FromWebFrame(render_view()->GetWebView()->mainFrame())-> | 90 RenderFrame::FromWebFrame(render_view()->GetWebView()->mainFrame())-> |
| 91 GetServiceRegistry()-> | 91 GetServiceRegistry()-> |
| 92 GetRemoteInterface("webui_controller", pipe.handle1.Pass()); | 92 ConnectToRemoteService("webui_controller", pipe.handle1.Pass()); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void WebUIMojo::SetHandleOnContextState(mojo::ScopedMessagePipeHandle handle) { | 95 void WebUIMojo::SetHandleOnContextState(mojo::ScopedMessagePipeHandle handle) { |
| 96 DCHECK(did_finish_document_load_); | 96 DCHECK(did_finish_document_load_); |
| 97 v8::HandleScope handle_scope(blink::mainThreadIsolate()); | 97 v8::HandleScope handle_scope(blink::mainThreadIsolate()); |
| 98 WebUIMojoContextState* state = GetContextState(); | 98 WebUIMojoContextState* state = GetContextState(); |
| 99 if (state) | 99 if (state) |
| 100 state->SetHandle(handle.Pass()); | 100 state->SetHandle(handle.Pass()); |
| 101 } | 101 } |
| 102 | 102 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 128 WebUIMojoContextState* state = GetContextState(); | 128 WebUIMojoContextState* state = GetContextState(); |
| 129 if (state && !state->module_added()) | 129 if (state && !state->module_added()) |
| 130 return; | 130 return; |
| 131 | 131 |
| 132 v8::HandleScope handle_scope(blink::mainThreadIsolate()); | 132 v8::HandleScope handle_scope(blink::mainThreadIsolate()); |
| 133 DestroyContextState(frame->mainWorldScriptContext()); | 133 DestroyContextState(frame->mainWorldScriptContext()); |
| 134 CreateContextState(); | 134 CreateContextState(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 } // namespace content | 137 } // namespace content |
| OLD | NEW |