summaryrefslogtreecommitdiff
path: root/chromium/content/renderer/web_frame_utils.cc
blob: cf07d9848ca5ce49b1f58dbff261e5f1fc3b9df6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/renderer/web_frame_utils.h"

#include "content/renderer/render_frame_impl.h"
#include "content/renderer/render_frame_proxy.h"
#include "ipc/ipc_message.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebRemoteFrame.h"

namespace content {

blink::WebFrame* GetWebFrameFromRoutingIdForFrameOrProxy(int routing_id) {
  auto* render_frame = RenderFrameImpl::FromRoutingID(routing_id);
  if (render_frame)
    return render_frame->GetWebFrame();

  auto* render_frame_proxy = RenderFrameProxy::FromRoutingID(routing_id);
  if (render_frame_proxy)
    return render_frame_proxy->web_frame();

  return nullptr;
}

}  // namespace content