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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 void AwRenderViewHostExt::RenderProcessGone(base::TerminationStatus status) { | 130 void AwRenderViewHostExt::RenderProcessGone(base::TerminationStatus status) { |
129 DCHECK(CalledOnValidThread()); | 131 DCHECK(CalledOnValidThread()); |
130 for (std::map<int, DocumentHasImagesResult>::iterator pending_req = | 132 for (std::map<int, DocumentHasImagesResult>::iterator pending_req = |
131 pending_document_has_images_requests_.begin(); | 133 pending_document_has_images_requests_.begin(); |
132 pending_req != pending_document_has_images_requests_.end(); | 134 pending_req != pending_document_has_images_requests_.end(); |
133 ++pending_req) { | 135 ++pending_req) { |
134 pending_req->second.Run(false); | 136 pending_req->second.Run(false); |
135 } | 137 } |
136 } | 138 } |
137 | 139 |
| 140 void AwRenderViewHostExt::RenderFrameCreated( |
| 141 content::RenderFrameHost* frame_host) { |
| 142 frame_host->GetServiceRegistry()->AddService( |
| 143 base::Bind(&web_restrictions::WebRestrictionsMojoImplementation::Create, |
| 144 AwBrowserContext::GetDefault()->GetWebRestrictionProvider())); |
| 145 } |
| 146 |
138 void AwRenderViewHostExt::DidNavigateAnyFrame( | 147 void AwRenderViewHostExt::DidNavigateAnyFrame( |
139 content::RenderFrameHost* render_frame_host, | 148 content::RenderFrameHost* render_frame_host, |
140 const content::LoadCommittedDetails& details, | 149 const content::LoadCommittedDetails& details, |
141 const content::FrameNavigateParams& params) { | 150 const content::FrameNavigateParams& params) { |
142 DCHECK(CalledOnValidThread()); | 151 DCHECK(CalledOnValidThread()); |
143 | 152 |
144 AwBrowserContext::FromWebContents(web_contents()) | 153 AwBrowserContext::FromWebContents(web_contents()) |
145 ->AddVisitedURLs(params.redirects); | 154 ->AddVisitedURLs(params.redirects); |
146 } | 155 } |
147 | 156 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 content::RenderFrameHost* render_frame_host, | 219 content::RenderFrameHost* render_frame_host, |
211 const gfx::Size& contents_size) { | 220 const gfx::Size& contents_size) { |
212 // Only makes sense coming from the main frame of the current frame tree. | 221 // Only makes sense coming from the main frame of the current frame tree. |
213 if (render_frame_host != web_contents()->GetMainFrame()) | 222 if (render_frame_host != web_contents()->GetMainFrame()) |
214 return; | 223 return; |
215 | 224 |
216 client_->OnWebLayoutContentsSizeChanged(contents_size); | 225 client_->OnWebLayoutContentsSizeChanged(contents_size); |
217 } | 226 } |
218 | 227 |
219 } // namespace android_webview | 228 } // namespace android_webview |
OLD | NEW |