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
3 // found in the LICENSE file.
5 #include "android_webview/renderer/aw_render_frame_ext.h"
6 #include "content/public/renderer/document_state.h"
7 #include "content/public/renderer/render_frame.h"
8 #include "third_party/WebKit/public/web/WebDocument.h"
9 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
11 namespace android_webview
{
13 AwRenderFrameExt::AwRenderFrameExt(content::RenderFrame
* render_frame
)
14 : content::RenderFrameObserver(render_frame
) {
17 AwRenderFrameExt::~AwRenderFrameExt() {
20 void AwRenderFrameExt::DidCommitProvisionalLoad(bool is_new_navigation
) {
21 blink::WebFrame
* frame
= render_frame()->GetWebFrame();
22 content::DocumentState
* document_state
=
23 content::DocumentState::FromDataSource(frame
->dataSource());
24 if (document_state
->can_load_local_resources()) {
25 blink::WebSecurityOrigin origin
= frame
->document().securityOrigin();
26 origin
.grantLoadLocalResources();