| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/renderer_host/aw_render_view_host_ext.h" | 5 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/aw_browser_context.h" | 7 #include "android_webview/browser/aw_browser_context.h" |
| 8 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" | 8 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" |
| 9 #include "android_webview/common/render_view_messages.h" | 9 #include "android_webview/common/render_view_messages.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "components/web_restrictions/browser/web_restrictions_mojo_implementati
on.h" |
| 14 #include "content/public/browser/android/content_view_core.h" | 15 #include "content/public/browser/android/content_view_core.h" |
| 15 #include "content/public/browser/render_frame_host.h" | 16 #include "content/public/browser/render_frame_host.h" |
| 16 #include "content/public/browser/render_process_host.h" | 17 #include "content/public/browser/render_process_host.h" |
| 17 #include "content/public/browser/render_view_host.h" | 18 #include "content/public/browser/render_view_host.h" |
| 18 #include "content/public/browser/user_metrics.h" | 19 #include "content/public/browser/user_metrics.h" |
| 19 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 20 #include "content/public/common/frame_navigate_params.h" | 21 #include "content/public/common/frame_navigate_params.h" |
| 22 #include "content/public/common/service_registry.h" |
| 21 | 23 |
| 22 namespace android_webview { | 24 namespace android_webview { |
| 23 | 25 |
| 24 AwRenderViewHostExt::AwRenderViewHostExt( | 26 AwRenderViewHostExt::AwRenderViewHostExt( |
| 25 AwRenderViewHostExtClient* client, content::WebContents* contents) | 27 AwRenderViewHostExtClient* client, content::WebContents* contents) |
| 26 : content::WebContentsObserver(contents), | 28 : content::WebContentsObserver(contents), |
| 27 client_(client), | 29 client_(client), |
| 28 background_color_(SK_ColorWHITE), | 30 background_color_(SK_ColorWHITE), |
| 29 has_new_hit_test_data_(false) { | 31 has_new_hit_test_data_(false) { |
| 30 DCHECK(client_); | 32 DCHECK(client_); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 void AwRenderViewHostExt::RenderProcessGone(base::TerminationStatus status) { | 132 void AwRenderViewHostExt::RenderProcessGone(base::TerminationStatus status) { |
| 131 DCHECK(CalledOnValidThread()); | 133 DCHECK(CalledOnValidThread()); |
| 132 for (std::map<int, DocumentHasImagesResult>::iterator pending_req = | 134 for (std::map<int, DocumentHasImagesResult>::iterator pending_req = |
| 133 pending_document_has_images_requests_.begin(); | 135 pending_document_has_images_requests_.begin(); |
| 134 pending_req != pending_document_has_images_requests_.end(); | 136 pending_req != pending_document_has_images_requests_.end(); |
| 135 ++pending_req) { | 137 ++pending_req) { |
| 136 pending_req->second.Run(false); | 138 pending_req->second.Run(false); |
| 137 } | 139 } |
| 138 } | 140 } |
| 139 | 141 |
| 142 void AwRenderViewHostExt::RenderFrameCreated( |
| 143 content::RenderFrameHost* frame_host) { |
| 144 frame_host->GetServiceRegistry()->AddService( |
| 145 base::Bind(&web_restrictions::WebRestrictionsMojoImplementation::Create, |
| 146 AwBrowserContext::GetDefault()->GetWebRestrictionProvider())); |
| 147 } |
| 148 |
| 140 void AwRenderViewHostExt::DidNavigateAnyFrame( | 149 void AwRenderViewHostExt::DidNavigateAnyFrame( |
| 141 content::RenderFrameHost* render_frame_host, | 150 content::RenderFrameHost* render_frame_host, |
| 142 const content::LoadCommittedDetails& details, | 151 const content::LoadCommittedDetails& details, |
| 143 const content::FrameNavigateParams& params) { | 152 const content::FrameNavigateParams& params) { |
| 144 DCHECK(CalledOnValidThread()); | 153 DCHECK(CalledOnValidThread()); |
| 145 | 154 |
| 146 AwBrowserContext::FromWebContents(web_contents()) | 155 AwBrowserContext::FromWebContents(web_contents()) |
| 147 ->AddVisitedURLs(params.redirects); | 156 ->AddVisitedURLs(params.redirects); |
| 148 } | 157 } |
| 149 | 158 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 content::RenderFrameHost* render_frame_host, | 221 content::RenderFrameHost* render_frame_host, |
| 213 const gfx::Size& contents_size) { | 222 const gfx::Size& contents_size) { |
| 214 // Only makes sense coming from the main frame of the current frame tree. | 223 // Only makes sense coming from the main frame of the current frame tree. |
| 215 if (render_frame_host != web_contents()->GetMainFrame()) | 224 if (render_frame_host != web_contents()->GetMainFrame()) |
| 216 return; | 225 return; |
| 217 | 226 |
| 218 client_->OnWebLayoutContentsSizeChanged(contents_size); | 227 client_->OnWebLayoutContentsSizeChanged(contents_size); |
| 219 } | 228 } |
| 220 | 229 |
| 221 } // namespace android_webview | 230 } // namespace android_webview |
| OLD | NEW |