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/WebLocalFrame.h"
10 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
12 namespace android_webview
{
14 AwRenderFrameExt::AwRenderFrameExt(content::RenderFrame
* render_frame
)
15 : content::RenderFrameObserver(render_frame
) {
18 AwRenderFrameExt::~AwRenderFrameExt() {
21 void AwRenderFrameExt::DidCommitProvisionalLoad(bool is_new_navigation
,
22 bool is_same_page_navigation
) {
23 blink::WebLocalFrame
* frame
= render_frame()->GetWebFrame();
24 content::DocumentState
* document_state
=
25 content::DocumentState::FromDataSource(frame
->dataSource());
26 if (document_state
->can_load_local_resources()) {
27 blink::WebSecurityOrigin origin
= frame
->document().securityOrigin();
28 origin
.grantLoadLocalResources();