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

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: 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 3290 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 } 3305 }
3306 3306
3307 void WebContentsImpl::ReadyToCommitNavigation( 3307 void WebContentsImpl::ReadyToCommitNavigation(
3308 NavigationHandle* navigation_handle) { 3308 NavigationHandle* navigation_handle) {
3309 for (auto& observer : observers_) 3309 for (auto& observer : observers_)
3310 observer.ReadyToCommitNavigation(navigation_handle); 3310 observer.ReadyToCommitNavigation(navigation_handle);
3311
3312 // Notify accessibility if this is a reload.
nasko 2017/02/10 19:44:58 This used to be at navigation start. This makes mo
jam 2017/02/10 20:00:34 I moved it because of the GetRenderFrameHost call,
dmazzoni 2017/02/10 20:47:45 BrowserAccessibilityManager::UserIsReloading() is
jam 2017/02/10 20:52:40 With a reload, we wouldn't be changing the RFH so
nasko 2017/02/10 21:28:39 This isn't quite correct, there are cases where th
jam1 2017/02/13 15:40:25 ok on second thought, I've maintainted the old beh
dmazzoni 2017/02/13 19:05:46 Digging in some more, the call to UserIsNavigating
3313 if (navigation_handle->GetReloadType() != ReloadType::NONE) {
3314 BrowserAccessibilityManager* manager =
3315 static_cast<RenderFrameHostImpl*>(
3316 navigation_handle->GetRenderFrameHost())
3317 ->browser_accessibility_manager();
3318 if (manager)
3319 manager->UserIsReloading();
3320 }
3311 } 3321 }
3312 3322
3313 void WebContentsImpl::DidFinishNavigation(NavigationHandle* navigation_handle) { 3323 void WebContentsImpl::DidFinishNavigation(NavigationHandle* navigation_handle) {
3314 for (auto& observer : observers_) 3324 for (auto& observer : observers_)
3315 observer.DidFinishNavigation(navigation_handle); 3325 observer.DidFinishNavigation(navigation_handle);
3316 }
3317 3326
3318 void WebContentsImpl::DidStartProvisionalLoad( 3327 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 = 3328 BrowserAccessibilityManager* manager =
3334 ftn->current_frame_host()->browser_accessibility_manager(); 3329 static_cast<RenderFrameHostImpl*>(
3335 if (manager) 3330 navigation_handle->GetRenderFrameHost())
3336 manager->UserIsReloading(); 3331 ->browser_accessibility_manager();
3332 if (manager) {
3333 if (navigation_handle->IsErrorPage()) {
3334 manager->NavigationFailed();
3335 } else {
3336 manager->NavigationSucceeded();
3337 }
3338 }
3337 } 3339 }
3338 } 3340 }
3339 3341
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( 3342 void WebContentsImpl::DidFailLoadWithError(
3360 RenderFrameHostImpl* render_frame_host, 3343 RenderFrameHostImpl* render_frame_host,
3361 const GURL& url, 3344 const GURL& url,
3362 int error_code, 3345 int error_code,
3363 const base::string16& error_description, 3346 const base::string16& error_description,
3364 bool was_ignored_by_handler) { 3347 bool was_ignored_by_handler) {
3365 for (auto& observer : observers_) { 3348 for (auto& observer : observers_) {
3366 observer.DidFailLoad(render_frame_host, url, error_code, error_description, 3349 observer.DidFailLoad(render_frame_host, url, error_code, error_description,
3367 was_ignored_by_handler); 3350 was_ignored_by_handler);
3368 } 3351 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3404 return true; 3387 return true;
3405 return delegate_->ShouldTransferNavigation(is_main_frame_navigation); 3388 return delegate_->ShouldTransferNavigation(is_main_frame_navigation);
3406 } 3389 }
3407 3390
3408 bool WebContentsImpl::ShouldPreserveAbortedURLs() { 3391 bool WebContentsImpl::ShouldPreserveAbortedURLs() {
3409 if (!delegate_) 3392 if (!delegate_)
3410 return false; 3393 return false;
3411 return delegate_->ShouldPreserveAbortedURLs(this); 3394 return delegate_->ShouldPreserveAbortedURLs(this);
3412 } 3395 }
3413 3396
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( 3397 void WebContentsImpl::DidNavigateMainFramePreCommit(
3431 bool navigation_is_within_page) { 3398 bool navigation_is_within_page) {
3432 // Ensure fullscreen mode is exited before committing the navigation to a 3399 // 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 3400 // different page. The next page will not start out assuming it is in
3434 // fullscreen mode. 3401 // fullscreen mode.
3435 if (navigation_is_within_page) { 3402 if (navigation_is_within_page) {
3436 // No page change? Then, the renderer and browser can remain in fullscreen. 3403 // No page change? Then, the renderer and browser can remain in fullscreen.
3437 return; 3404 return;
3438 } 3405 }
3439 if (IsFullscreenForCurrentTab()) 3406 if (IsFullscreenForCurrentTab())
(...skipping 18 matching lines...) Expand all
3458 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); 3425 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView());
3459 if (rwhvb) 3426 if (rwhvb)
3460 rwhvb->OnDidNavigateMainFrameToNewPage(); 3427 rwhvb->OnDidNavigateMainFrameToNewPage();
3461 3428
3462 did_first_visually_non_empty_paint_ = false; 3429 did_first_visually_non_empty_paint_ = false;
3463 3430
3464 // Reset theme color on navigation to new page. 3431 // Reset theme color on navigation to new page.
3465 theme_color_ = SK_ColorTRANSPARENT; 3432 theme_color_ = SK_ColorTRANSPARENT;
3466 } 3433 }
3467 3434
3468 // Notify observers about navigation.
3469 for (auto& observer : observers_)
3470 observer.DidNavigateMainFrame(details, params);
3471
3472 if (delegate_) 3435 if (delegate_)
3473 delegate_->DidNavigateMainFramePostCommit(this); 3436 delegate_->DidNavigateMainFramePostCommit(this);
3474 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 3437 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
3475 } 3438 }
3476 3439
3477 void WebContentsImpl::DidNavigateAnyFramePostCommit( 3440 void WebContentsImpl::DidNavigateAnyFramePostCommit(
3478 RenderFrameHostImpl* render_frame_host, 3441 RenderFrameHostImpl* render_frame_host,
3479 const LoadCommittedDetails& details, 3442 const LoadCommittedDetails& details,
3480 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { 3443 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
3481 // Now that something has committed, we don't need to track whether the 3444 // Now that something has committed, we don't need to track whether the
3482 // initial page has been accessed. 3445 // initial page has been accessed.
3483 has_accessed_initial_document_ = false; 3446 has_accessed_initial_document_ = false;
3484 3447
3485 // If we navigate off the page, close all JavaScript dialogs. 3448 // If we navigate off the page, close all JavaScript dialogs.
3486 if (!details.is_in_page) 3449 if (!details.is_in_page)
3487 CancelActiveAndPendingDialogs(); 3450 CancelActiveAndPendingDialogs();
3488 3451
3489 // If this is a user-initiated navigation, start allowing JavaScript dialogs 3452 // If this is a user-initiated navigation, start allowing JavaScript dialogs
3490 // again. 3453 // again.
3491 if (params.gesture == NavigationGestureUser && dialog_manager_) { 3454 if (params.gesture == NavigationGestureUser && dialog_manager_) {
3492 dialog_manager_->CancelDialogs(this, /*reset_state=*/true); 3455 dialog_manager_->CancelDialogs(this, /*reset_state=*/true);
3493 } 3456 }
3494
3495 // Notify observers about navigation.
3496 for (auto& observer : observers_)
3497 observer.DidNavigateAnyFrame(render_frame_host, details, params);
3498 } 3457 }
3499 3458
3500 void WebContentsImpl::SetMainFrameMimeType(const std::string& mime_type) { 3459 void WebContentsImpl::SetMainFrameMimeType(const std::string& mime_type) {
3501 contents_mime_type_ = mime_type; 3460 contents_mime_type_ = mime_type;
3502 } 3461 }
3503 3462
3504 bool WebContentsImpl::CanOverscrollContent() const { 3463 bool WebContentsImpl::CanOverscrollContent() const {
3505 // Disable overscroll when touch emulation is on. See crbug.com/369938. 3464 // Disable overscroll when touch emulation is on. See crbug.com/369938.
3506 if (force_disable_overscroll_content_) 3465 if (force_disable_overscroll_content_)
3507 return false; 3466 return false;
(...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after
5411 GetMainFrame()->AddMessageToConsole( 5370 GetMainFrame()->AddMessageToConsole(
5412 content::CONSOLE_MESSAGE_LEVEL_WARNING, 5371 content::CONSOLE_MESSAGE_LEVEL_WARNING,
5413 base::StringPrintf("This site does not have a valid SSL " 5372 base::StringPrintf("This site does not have a valid SSL "
5414 "certificate! Without SSL, your site's and " 5373 "certificate! Without SSL, your site's and "
5415 "visitors' data is vulnerable to theft and " 5374 "visitors' data is vulnerable to theft and "
5416 "tampering. Get a valid SSL certificate before" 5375 "tampering. Get a valid SSL certificate before"
5417 " releasing your website to the public.")); 5376 " releasing your website to the public."));
5418 } 5377 }
5419 5378
5420 } // namespace content 5379 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698