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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2684143002: Remove deprecated navigation callbacks on WebContentsObserver that are now unused. (Closed)
Patch Set: call old RFH's BrowserAccessibilityManager 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
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 "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 3284 matching lines...) Expand 10 before | Expand all | Expand 10 after
3295 3295
3296 void WebContentsImpl::DidStartNavigation(NavigationHandle* navigation_handle) { 3296 void WebContentsImpl::DidStartNavigation(NavigationHandle* navigation_handle) {
3297 for (auto& observer : observers_) 3297 for (auto& observer : observers_)
3298 observer.DidStartNavigation(navigation_handle); 3298 observer.DidStartNavigation(navigation_handle);
3299 } 3299 }
3300 3300
3301 void WebContentsImpl::DidRedirectNavigation( 3301 void WebContentsImpl::DidRedirectNavigation(
3302 NavigationHandle* navigation_handle) { 3302 NavigationHandle* navigation_handle) {
3303 for (auto& observer : observers_) 3303 for (auto& observer : observers_)
3304 observer.DidRedirectNavigation(navigation_handle); 3304 observer.DidRedirectNavigation(navigation_handle);
3305
3306 // Notify accessibility if this is a reload. This has to called on the
3307 // BrowserAccessibilityManager associated with the old RFHI.
3308 if (navigation_handle->GetReloadType() != ReloadType::NONE) {
3309 NavigationHandleImpl* nhi =
3310 static_cast<NavigationHandleImpl*>(navigation_handle);
3311 BrowserAccessibilityManager* manager =
3312 nhi->frame_tree_node()
3313 ->current_frame_host()
3314 ->browser_accessibility_manager();
3315 if (manager)
3316 manager->UserIsReloading();
3317 }
3305 } 3318 }
3306 3319
3307 void WebContentsImpl::ReadyToCommitNavigation( 3320 void WebContentsImpl::ReadyToCommitNavigation(
3308 NavigationHandle* navigation_handle) { 3321 NavigationHandle* navigation_handle) {
3309 for (auto& observer : observers_) 3322 for (auto& observer : observers_)
3310 observer.ReadyToCommitNavigation(navigation_handle); 3323 observer.ReadyToCommitNavigation(navigation_handle);
3311 } 3324 }
3312 3325
3313 void WebContentsImpl::DidFinishNavigation(NavigationHandle* navigation_handle) { 3326 void WebContentsImpl::DidFinishNavigation(NavigationHandle* navigation_handle) {
3314 for (auto& observer : observers_) 3327 for (auto& observer : observers_)
3315 observer.DidFinishNavigation(navigation_handle); 3328 observer.DidFinishNavigation(navigation_handle);
3316 }
3317 3329
3318 void WebContentsImpl::DidStartProvisionalLoad( 3330 if (navigation_handle->HasCommitted()) {
3319 RenderFrameHostImpl* render_frame_host,
3320 const GURL& validated_url,
3321 bool is_error_page) {
3322 // Notify observers about the start of the provisional load.
3323 for (auto& observer : observers_) {
3324 observer.DidStartProvisionalLoadForFrame(render_frame_host, validated_url,
3325 is_error_page);
3326 }
3327
3328 // Notify accessibility if this is a reload.
3329 NavigationEntry* entry = controller_.GetVisibleEntry();
3330 if (entry && ui::PageTransitionCoreTypeIs(entry->GetTransitionType(),
3331 ui::PAGE_TRANSITION_RELOAD)) {
3332 FrameTreeNode* ftn = render_frame_host->frame_tree_node();
3333 BrowserAccessibilityManager* manager = 3331 BrowserAccessibilityManager* manager =
3334 ftn->current_frame_host()->browser_accessibility_manager(); 3332 static_cast<RenderFrameHostImpl*>(
3335 if (manager) 3333 navigation_handle->GetRenderFrameHost())
3336 manager->UserIsReloading(); 3334 ->browser_accessibility_manager();
3335 if (manager) {
3336 if (navigation_handle->IsErrorPage()) {
3337 manager->NavigationFailed();
3338 } else {
3339 manager->NavigationSucceeded();
3340 }
3341 }
3337 } 3342 }
3338 } 3343 }
3339 3344
3340 void WebContentsImpl::DidFailProvisionalLoadWithError(
3341 RenderFrameHostImpl* render_frame_host,
3342 const GURL& validated_url,
3343 int error_code,
3344 const base::string16& error_description,
3345 bool was_ignored_by_handler) {
3346 for (auto& observer : observers_) {
3347 observer.DidFailProvisionalLoad(render_frame_host, validated_url,
3348 error_code, error_description,
3349 was_ignored_by_handler);
3350 }
3351
3352 FrameTreeNode* ftn = render_frame_host->frame_tree_node();
3353 BrowserAccessibilityManager* manager =
3354 ftn->current_frame_host()->browser_accessibility_manager();
3355 if (manager)
3356 manager->NavigationFailed();
3357 }
3358
3359 void WebContentsImpl::DidFailLoadWithError( 3345 void WebContentsImpl::DidFailLoadWithError(
3360 RenderFrameHostImpl* render_frame_host, 3346 RenderFrameHostImpl* render_frame_host,
3361 const GURL& url, 3347 const GURL& url,
3362 int error_code, 3348 int error_code,
3363 const base::string16& error_description, 3349 const base::string16& error_description,
3364 bool was_ignored_by_handler) { 3350 bool was_ignored_by_handler) {
3365 for (auto& observer : observers_) { 3351 for (auto& observer : observers_) {
3366 observer.DidFailLoad(render_frame_host, url, error_code, error_description, 3352 observer.DidFailLoad(render_frame_host, url, error_code, error_description,
3367 was_ignored_by_handler); 3353 was_ignored_by_handler);
3368 } 3354 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3404 return true; 3390 return true;
3405 return delegate_->ShouldTransferNavigation(is_main_frame_navigation); 3391 return delegate_->ShouldTransferNavigation(is_main_frame_navigation);
3406 } 3392 }
3407 3393
3408 bool WebContentsImpl::ShouldPreserveAbortedURLs() { 3394 bool WebContentsImpl::ShouldPreserveAbortedURLs() {
3409 if (!delegate_) 3395 if (!delegate_)
3410 return false; 3396 return false;
3411 return delegate_->ShouldPreserveAbortedURLs(this); 3397 return delegate_->ShouldPreserveAbortedURLs(this);
3412 } 3398 }
3413 3399
3414 void WebContentsImpl::DidCommitProvisionalLoad(
3415 RenderFrameHostImpl* render_frame_host,
3416 const GURL& url,
3417 ui::PageTransition transition_type) {
3418 // Notify observers about the commit of the provisional load.
3419 for (auto& observer : observers_) {
3420 observer.DidCommitProvisionalLoadForFrame(render_frame_host, url,
3421 transition_type);
3422 }
3423
3424 BrowserAccessibilityManager* manager =
3425 render_frame_host->browser_accessibility_manager();
3426 if (manager)
3427 manager->NavigationSucceeded();
3428 }
3429
3430 void WebContentsImpl::DidNavigateMainFramePreCommit( 3400 void WebContentsImpl::DidNavigateMainFramePreCommit(
3431 bool navigation_is_within_page) { 3401 bool navigation_is_within_page) {
3432 // Ensure fullscreen mode is exited before committing the navigation to a 3402 // Ensure fullscreen mode is exited before committing the navigation to a
3433 // different page. The next page will not start out assuming it is in 3403 // different page. The next page will not start out assuming it is in
3434 // fullscreen mode. 3404 // fullscreen mode.
3435 if (navigation_is_within_page) { 3405 if (navigation_is_within_page) {
3436 // No page change? Then, the renderer and browser can remain in fullscreen. 3406 // No page change? Then, the renderer and browser can remain in fullscreen.
3437 return; 3407 return;
3438 } 3408 }
3439 if (IsFullscreenForCurrentTab()) 3409 if (IsFullscreenForCurrentTab())
(...skipping 18 matching lines...) Expand all
3458 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); 3428 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView());
3459 if (rwhvb) 3429 if (rwhvb)
3460 rwhvb->OnDidNavigateMainFrameToNewPage(); 3430 rwhvb->OnDidNavigateMainFrameToNewPage();
3461 3431
3462 did_first_visually_non_empty_paint_ = false; 3432 did_first_visually_non_empty_paint_ = false;
3463 3433
3464 // Reset theme color on navigation to new page. 3434 // Reset theme color on navigation to new page.
3465 theme_color_ = SK_ColorTRANSPARENT; 3435 theme_color_ = SK_ColorTRANSPARENT;
3466 } 3436 }
3467 3437
3468 // Notify observers about navigation.
3469 for (auto& observer : observers_)
3470 observer.DidNavigateMainFrame(details, params);
3471
3472 if (delegate_) 3438 if (delegate_)
3473 delegate_->DidNavigateMainFramePostCommit(this); 3439 delegate_->DidNavigateMainFramePostCommit(this);
3474 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 3440 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
3475 } 3441 }
3476 3442
3477 void WebContentsImpl::DidNavigateAnyFramePostCommit( 3443 void WebContentsImpl::DidNavigateAnyFramePostCommit(
3478 RenderFrameHostImpl* render_frame_host, 3444 RenderFrameHostImpl* render_frame_host,
3479 const LoadCommittedDetails& details, 3445 const LoadCommittedDetails& details,
3480 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { 3446 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
3481 // Now that something has committed, we don't need to track whether the 3447 // Now that something has committed, we don't need to track whether the
3482 // initial page has been accessed. 3448 // initial page has been accessed.
3483 has_accessed_initial_document_ = false; 3449 has_accessed_initial_document_ = false;
3484 3450
3485 // If we navigate off the page, close all JavaScript dialogs. 3451 // If we navigate off the page, close all JavaScript dialogs.
3486 if (!details.is_in_page) 3452 if (!details.is_in_page)
3487 CancelActiveAndPendingDialogs(); 3453 CancelActiveAndPendingDialogs();
3488 3454
3489 // If this is a user-initiated navigation, start allowing JavaScript dialogs 3455 // If this is a user-initiated navigation, start allowing JavaScript dialogs
3490 // again. 3456 // again.
3491 if (params.gesture == NavigationGestureUser && dialog_manager_) { 3457 if (params.gesture == NavigationGestureUser && dialog_manager_) {
3492 dialog_manager_->CancelDialogs(this, /*reset_state=*/true); 3458 dialog_manager_->CancelDialogs(this, /*reset_state=*/true);
3493 } 3459 }
3494
3495 // Notify observers about navigation.
3496 for (auto& observer : observers_)
3497 observer.DidNavigateAnyFrame(render_frame_host, details, params);
3498 } 3460 }
3499 3461
3500 void WebContentsImpl::SetMainFrameMimeType(const std::string& mime_type) { 3462 void WebContentsImpl::SetMainFrameMimeType(const std::string& mime_type) {
3501 contents_mime_type_ = mime_type; 3463 contents_mime_type_ = mime_type;
3502 } 3464 }
3503 3465
3504 bool WebContentsImpl::CanOverscrollContent() const { 3466 bool WebContentsImpl::CanOverscrollContent() const {
3505 // Disable overscroll when touch emulation is on. See crbug.com/369938. 3467 // Disable overscroll when touch emulation is on. See crbug.com/369938.
3506 if (force_disable_overscroll_content_) 3468 if (force_disable_overscroll_content_)
3507 return false; 3469 return false;
(...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after
5411 GetMainFrame()->AddMessageToConsole( 5373 GetMainFrame()->AddMessageToConsole(
5412 content::CONSOLE_MESSAGE_LEVEL_WARNING, 5374 content::CONSOLE_MESSAGE_LEVEL_WARNING,
5413 base::StringPrintf("This site does not have a valid SSL " 5375 base::StringPrintf("This site does not have a valid SSL "
5414 "certificate! Without SSL, your site's and " 5376 "certificate! Without SSL, your site's and "
5415 "visitors' data is vulnerable to theft and " 5377 "visitors' data is vulnerable to theft and "
5416 "tampering. Get a valid SSL certificate before" 5378 "tampering. Get a valid SSL certificate before"
5417 " releasing your website to the public.")); 5379 " releasing your website to the public."));
5418 } 5380 }
5419 5381
5420 } // namespace content 5382 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/public/browser/web_contents_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698