OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_frame_utils.h" | 5 #include "content/renderer/web_frame_utils.h" |
6 | 6 |
7 #include "content/renderer/render_frame_impl.h" | 7 #include "content/renderer/render_frame_impl.h" |
8 #include "content/renderer/render_frame_proxy.h" | 8 #include "content/renderer/render_frame_proxy.h" |
9 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
10 #include "third_party/WebKit/public/web/WebFrame.h" | 10 #include "third_party/WebKit/public/web/WebFrame.h" |
| 11 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 12 #include "third_party/WebKit/public/web/WebRemoteFrame.h" |
11 | 13 |
12 namespace content { | 14 namespace content { |
13 | 15 |
14 int GetRoutingIdForFrameOrProxy(blink::WebFrame* web_frame) { | 16 int GetRoutingIdForFrameOrProxy(blink::WebFrame* web_frame) { |
15 if (!web_frame) | 17 if (!web_frame) |
16 return MSG_ROUTING_NONE; | 18 return MSG_ROUTING_NONE; |
17 if (web_frame->isWebRemoteFrame()) | 19 if (web_frame->isWebRemoteFrame()) |
18 return RenderFrameProxy::FromWebFrame(web_frame)->routing_id(); | 20 return RenderFrameProxy::FromWebFrame(web_frame)->routing_id(); |
19 return RenderFrameImpl::FromWebFrame(web_frame)->GetRoutingID(); | 21 return RenderFrameImpl::FromWebFrame(web_frame)->GetRoutingID(); |
20 } | 22 } |
21 | 23 |
| 24 blink::WebFrame* GetWebFrameFromRoutingIdForFrameOrProxy(int routing_id) { |
| 25 auto* render_frame = RenderFrameImpl::FromRoutingID(routing_id); |
| 26 if (render_frame) |
| 27 return render_frame->GetWebFrame(); |
| 28 |
| 29 auto* render_frame_proxy = RenderFrameProxy::FromRoutingID(routing_id); |
| 30 if (render_frame_proxy) |
| 31 return render_frame_proxy->web_frame(); |
| 32 |
| 33 return nullptr; |
| 34 } |
| 35 |
22 } // namespace content | 36 } // namespace content |
OLD | NEW |