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

Side by Side Diff: android_webview/browser/renderer_host/aw_render_view_host_ext.cc

Issue 2685553004: Convert AwRenderViewHostExt to use the new navigation callbacks. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « android_webview/browser/renderer_host/aw_render_view_host_ext.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/web_restrictions/browser/web_restrictions_mojo_implementati on.h"
15 #include "content/public/browser/android/content_view_core.h" 15 #include "content/public/browser/android/content_view_core.h"
16 #include "content/public/browser/navigation_handle.h"
16 #include "content/public/browser/render_frame_host.h" 17 #include "content/public/browser/render_frame_host.h"
17 #include "content/public/browser/render_process_host.h" 18 #include "content/public/browser/render_process_host.h"
18 #include "content/public/browser/render_view_host.h" 19 #include "content/public/browser/render_view_host.h"
19 #include "content/public/browser/user_metrics.h" 20 #include "content/public/browser/user_metrics.h"
20 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
21 #include "content/public/common/frame_navigate_params.h"
22 #include "services/service_manager/public/cpp/interface_registry.h" 22 #include "services/service_manager/public/cpp/interface_registry.h"
23 23
24 namespace android_webview { 24 namespace android_webview {
25 25
26 AwRenderViewHostExt::AwRenderViewHostExt( 26 AwRenderViewHostExt::AwRenderViewHostExt(
27 AwRenderViewHostExtClient* client, content::WebContents* contents) 27 AwRenderViewHostExtClient* client, content::WebContents* contents)
28 : content::WebContentsObserver(contents), 28 : content::WebContentsObserver(contents),
29 client_(client), 29 client_(client),
30 background_color_(SK_ColorWHITE), 30 background_color_(SK_ColorWHITE),
31 has_new_hit_test_data_(false) { 31 has_new_hit_test_data_(false) {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 image_requests_callback_map_.clear(); 145 image_requests_callback_map_.clear();
146 } 146 }
147 147
148 void AwRenderViewHostExt::RenderFrameCreated( 148 void AwRenderViewHostExt::RenderFrameCreated(
149 content::RenderFrameHost* frame_host) { 149 content::RenderFrameHost* frame_host) {
150 frame_host->GetInterfaceRegistry()->AddInterface( 150 frame_host->GetInterfaceRegistry()->AddInterface(
151 base::Bind(&web_restrictions::WebRestrictionsMojoImplementation::Create, 151 base::Bind(&web_restrictions::WebRestrictionsMojoImplementation::Create,
152 AwBrowserContext::GetDefault()->GetWebRestrictionProvider())); 152 AwBrowserContext::GetDefault()->GetWebRestrictionProvider()));
153 } 153 }
154 154
155 void AwRenderViewHostExt::DidNavigateAnyFrame( 155 void AwRenderViewHostExt::DidFinishNavigation(
156 content::RenderFrameHost* render_frame_host, 156 content::NavigationHandle* navigation_handle) {
157 const content::LoadCommittedDetails& details,
158 const content::FrameNavigateParams& params) {
159 DCHECK(CalledOnValidThread()); 157 DCHECK(CalledOnValidThread());
160 158
161 AwBrowserContext::FromWebContents(web_contents()) 159 AwBrowserContext::FromWebContents(web_contents())
162 ->AddVisitedURLs(params.redirects); 160 ->AddVisitedURLs(navigation_handle->GetRedirectChain());
163 } 161 }
164 162
165 void AwRenderViewHostExt::OnPageScaleFactorChanged(float page_scale_factor) { 163 void AwRenderViewHostExt::OnPageScaleFactorChanged(float page_scale_factor) {
166 client_->OnWebLayoutPageScaleFactorChanged(page_scale_factor); 164 client_->OnWebLayoutPageScaleFactorChanged(page_scale_factor);
167 } 165 }
168 166
169 bool AwRenderViewHostExt::OnMessageReceived( 167 bool AwRenderViewHostExt::OnMessageReceived(
170 const IPC::Message& message, 168 const IPC::Message& message,
171 content::RenderFrameHost* render_frame_host) { 169 content::RenderFrameHost* render_frame_host) {
172 bool handled = true; 170 bool handled = true;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 content::RenderFrameHost* render_frame_host, 225 content::RenderFrameHost* render_frame_host,
228 const gfx::Size& contents_size) { 226 const gfx::Size& contents_size) {
229 // Only makes sense coming from the main frame of the current frame tree. 227 // Only makes sense coming from the main frame of the current frame tree.
230 if (render_frame_host != web_contents()->GetMainFrame()) 228 if (render_frame_host != web_contents()->GetMainFrame())
231 return; 229 return;
232 230
233 client_->OnWebLayoutContentsSizeChanged(contents_size); 231 client_->OnWebLayoutContentsSizeChanged(contents_size);
234 } 232 }
235 233
236 } // namespace android_webview 234 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/renderer_host/aw_render_view_host_ext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698