Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: android_webview/renderer/aw_render_frame_ext.cc

Issue 1785493002: Move cache clearing from AwRenderViewExt to AwRenderFrameExt. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "android_webview/common/aw_hit_test_data.h" 5 #include "android_webview/common/aw_hit_test_data.h"
6 #include "android_webview/common/render_view_messages.h" 6 #include "android_webview/common/render_view_messages.h"
7 #include "android_webview/renderer/aw_render_frame_ext.h" 7 #include "android_webview/renderer/aw_render_frame_ext.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "content/public/renderer/android_content_detection_prefixes.h" 9 #include "content/public/renderer/android_content_detection_prefixes.h"
10 #include "content/public/renderer/document_state.h" 10 #include "content/public/renderer/document_state.h"
11 #include "content/public/renderer/render_frame.h" 11 #include "content/public/renderer/render_frame.h"
12 #include "content/public/renderer/render_view.h" 12 #include "content/public/renderer/render_view.h"
13 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 13 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
14 #include "third_party/WebKit/public/platform/WebSize.h" 14 #include "third_party/WebKit/public/platform/WebSize.h"
15 #include "third_party/WebKit/public/web/WebDocument.h" 15 #include "third_party/WebKit/public/web/WebDocument.h"
16 #include "third_party/WebKit/public/web/WebElement.h" 16 #include "third_party/WebKit/public/web/WebElement.h"
17 #include "third_party/WebKit/public/web/WebElementCollection.h" 17 #include "third_party/WebKit/public/web/WebElementCollection.h"
18 #include "third_party/WebKit/public/web/WebFrameWidget.h" 18 #include "third_party/WebKit/public/web/WebFrameWidget.h"
19 #include "third_party/WebKit/public/web/WebHitTestResult.h" 19 #include "third_party/WebKit/public/web/WebHitTestResult.h"
20 #include "third_party/WebKit/public/web/WebImageCache.h"
20 #include "third_party/WebKit/public/web/WebLocalFrame.h" 21 #include "third_party/WebKit/public/web/WebLocalFrame.h"
21 #include "third_party/WebKit/public/web/WebMeaningfulLayout.h" 22 #include "third_party/WebKit/public/web/WebMeaningfulLayout.h"
22 #include "third_party/WebKit/public/web/WebNode.h" 23 #include "third_party/WebKit/public/web/WebNode.h"
23 #include "third_party/WebKit/public/web/WebView.h" 24 #include "third_party/WebKit/public/web/WebView.h"
24 #include "url/url_canon.h" 25 #include "url/url_canon.h"
25 #include "url/url_constants.h" 26 #include "url/url_constants.h"
26 #include "url/url_util.h" 27 #include "url/url_util.h"
27 28
28 namespace android_webview { 29 namespace android_webview {
29 30
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 140
140 void AwRenderFrameExt::DidCommitProvisionalLoad(bool is_new_navigation, 141 void AwRenderFrameExt::DidCommitProvisionalLoad(bool is_new_navigation,
141 bool is_same_page_navigation) { 142 bool is_same_page_navigation) {
142 blink::WebLocalFrame* frame = render_frame()->GetWebFrame(); 143 blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
143 content::DocumentState* document_state = 144 content::DocumentState* document_state =
144 content::DocumentState::FromDataSource(frame->dataSource()); 145 content::DocumentState::FromDataSource(frame->dataSource());
145 if (document_state->can_load_local_resources()) { 146 if (document_state->can_load_local_resources()) {
146 blink::WebSecurityOrigin origin = frame->document().getSecurityOrigin(); 147 blink::WebSecurityOrigin origin = frame->document().getSecurityOrigin();
147 origin.grantLoadLocalResources(); 148 origin.grantLoadLocalResources();
148 } 149 }
150
151 // Clear the cache when we cross site boundaries in the main frame.
boliu 2016/03/10 21:59:58 Can add what we found in the email thread as a com
Avi (use Gerrit) 2016/03/10 22:07:56 Done.
152 if (!frame->parent()) {
153 url::Origin new_origin(frame->document().url());
154 if (!new_origin.IsSameOriginWith(last_origin_)) {
155 last_origin_ = new_origin;
156 blink::WebImageCache::clear();
157 }
158 }
149 } 159 }
150 160
151 bool AwRenderFrameExt::OnMessageReceived(const IPC::Message& message) { 161 bool AwRenderFrameExt::OnMessageReceived(const IPC::Message& message) {
152 bool handled = true; 162 bool handled = true;
153 IPC_BEGIN_MESSAGE_MAP(AwRenderFrameExt, message) 163 IPC_BEGIN_MESSAGE_MAP(AwRenderFrameExt, message)
154 IPC_MESSAGE_HANDLER(AwViewMsg_DocumentHasImages, OnDocumentHasImagesRequest) 164 IPC_MESSAGE_HANDLER(AwViewMsg_DocumentHasImages, OnDocumentHasImagesRequest)
155 IPC_MESSAGE_HANDLER(AwViewMsg_DoHitTest, OnDoHitTest) 165 IPC_MESSAGE_HANDLER(AwViewMsg_DoHitTest, OnDoHitTest)
156 IPC_MESSAGE_HANDLER(AwViewMsg_SetTextZoomFactor, OnSetTextZoomFactor) 166 IPC_MESSAGE_HANDLER(AwViewMsg_SetTextZoomFactor, OnSetTextZoomFactor)
157 IPC_MESSAGE_HANDLER(AwViewMsg_ResetScrollAndScaleState, 167 IPC_MESSAGE_HANDLER(AwViewMsg_ResetScrollAndScaleState,
158 OnResetScrollAndScaleState) 168 OnResetScrollAndScaleState)
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 } 290 }
281 291
282 blink::WebFrameWidget* AwRenderFrameExt::GetWebFrameWidget() { 292 blink::WebFrameWidget* AwRenderFrameExt::GetWebFrameWidget() {
283 if (!render_frame() || !render_frame()->GetRenderView()) 293 if (!render_frame() || !render_frame()->GetRenderView())
284 return nullptr; 294 return nullptr;
285 295
286 return render_frame()->GetRenderView()->GetWebFrameWidget(); 296 return render_frame()->GetRenderView()->GetWebFrameWidget();
287 } 297 }
288 298
289 } // namespace android_webview 299 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/renderer/aw_render_frame_ext.h ('k') | android_webview/renderer/aw_render_view_ext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698