Chromium Code Reviews| 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 "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 2484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2495 void WebContentsImpl::DidFailProvisionalLoadWithError( | 2495 void WebContentsImpl::DidFailProvisionalLoadWithError( |
| 2496 RenderFrameHostImpl* render_frame_host, | 2496 RenderFrameHostImpl* render_frame_host, |
| 2497 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 2497 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
| 2498 GURL validated_url(params.url); | 2498 GURL validated_url(params.url); |
| 2499 FOR_EACH_OBSERVER(WebContentsObserver, | 2499 FOR_EACH_OBSERVER(WebContentsObserver, |
| 2500 observers_, | 2500 observers_, |
| 2501 DidFailProvisionalLoad(render_frame_host, | 2501 DidFailProvisionalLoad(render_frame_host, |
| 2502 validated_url, | 2502 validated_url, |
| 2503 params.error_code, | 2503 params.error_code, |
| 2504 params.error_description)); | 2504 params.error_description)); |
| 2505 | |
| 2506 BrowserAccessibilityManager* manager = | |
|
nasko
2015/02/03 17:28:05
nit: wrong indent.
dmazzoni
2015/02/04 20:56:06
Done.
| |
| 2507 render_frame_host->browser_accessibility_manager(); | |
| 2508 if (manager) | |
| 2509 manager->NavigationFailed(); | |
| 2505 } | 2510 } |
| 2506 | 2511 |
| 2507 void WebContentsImpl::DidFailLoadWithError( | 2512 void WebContentsImpl::DidFailLoadWithError( |
| 2508 RenderFrameHostImpl* render_frame_host, | 2513 RenderFrameHostImpl* render_frame_host, |
| 2509 const GURL& url, | 2514 const GURL& url, |
| 2510 int error_code, | 2515 int error_code, |
| 2511 const base::string16& error_description) { | 2516 const base::string16& error_description) { |
| 2512 FOR_EACH_OBSERVER( | 2517 FOR_EACH_OBSERVER( |
| 2513 WebContentsObserver, | 2518 WebContentsObserver, |
| 2514 observers_, | 2519 observers_, |
| 2515 DidFailLoad(render_frame_host, url, error_code, error_description)); | 2520 DidFailLoad(render_frame_host, url, error_code, error_description)); |
| 2516 } | 2521 } |
| 2517 | 2522 |
| 2518 void WebContentsImpl::NotifyChangedNavigationState( | 2523 void WebContentsImpl::NotifyChangedNavigationState( |
| 2519 InvalidateTypes changed_flags) { | 2524 InvalidateTypes changed_flags) { |
| 2520 NotifyNavigationStateChanged(changed_flags); | 2525 NotifyNavigationStateChanged(changed_flags); |
| 2521 } | 2526 } |
| 2522 | 2527 |
| 2523 void WebContentsImpl::AboutToNavigateRenderFrame( | 2528 void WebContentsImpl::AboutToNavigateRenderFrame( |
|
dmazzoni
2015/01/21 18:59:03
This function is called at the right time, but (1)
nasko
2015/02/03 17:28:05
It doesn't need to be the new RFH in all cases. If
dmazzoni
2015/02/03 17:40:54
So what should I use if I want to catch both brows
nasko
2015/02/03 18:05:19
Let's step back a second and clarify why is "reloa
dmazzoni
2015/02/03 18:20:27
As soon as a navigation starts we can fire a notif
| |
| 2524 RenderFrameHostImpl* render_frame_host) { | 2529 RenderFrameHostImpl* render_frame_host) { |
| 2525 // Notify observers that we will navigate in this RenderFrame. | 2530 // Notify observers that we will navigate in this RenderFrame. |
| 2526 FOR_EACH_OBSERVER( | 2531 FOR_EACH_OBSERVER( |
| 2527 WebContentsObserver, | 2532 WebContentsObserver, |
| 2528 observers_, | 2533 observers_, |
| 2529 AboutToNavigateRenderFrame(render_frame_host)); | 2534 AboutToNavigateRenderFrame(render_frame_host)); |
| 2530 } | 2535 } |
| 2531 | 2536 |
| 2532 void WebContentsImpl::DidStartNavigationToPendingEntry( | 2537 void WebContentsImpl::DidStartNavigationToPendingEntry( |
| 2533 RenderFrameHostImpl* render_frame_host, | 2538 RenderFrameHostImpl* render_frame_host, |
| 2534 const GURL& url, | 2539 const GURL& url, |
| 2535 NavigationController::ReloadType reload_type) { | 2540 NavigationController::ReloadType reload_type) { |
| 2536 // Notify observers about navigation. | 2541 // Notify observers about navigation. |
| 2537 FOR_EACH_OBSERVER( | 2542 FOR_EACH_OBSERVER( |
| 2538 WebContentsObserver, | 2543 WebContentsObserver, |
| 2539 observers_, | 2544 observers_, |
| 2540 DidStartNavigationToPendingEntry(url, reload_type)); | 2545 DidStartNavigationToPendingEntry(url, reload_type)); |
| 2546 | |
| 2547 // Notify accessibility that the user is navigating away from the | |
| 2548 // current RenderFrameHost. | |
| 2549 FrameTreeNode* ftn = render_frame_host->frame_tree_node(); | |
|
dmazzoni
2015/01/21 18:59:04
This is the only function that gets called early e
nasko
2015/02/03 17:28:05
Architecturally, we can't notify before commit tim
dmazzoni
2015/02/03 17:40:54
What I'm observing is that for a browser-initiated
nasko
2015/02/03 18:05:18
What you are observing is correct for this very sp
dmazzoni
2015/02/03 18:20:27
That's true.
The point is that I need a notificat
| |
| 2550 BrowserAccessibilityManager* manager = | |
| 2551 ftn->current_frame_host()->browser_accessibility_manager(); | |
| 2552 if (manager) { | |
| 2553 bool is_reload = reload_type != NavigationController::NO_RELOAD; | |
| 2554 manager->UserIsNavigatingAway(is_reload); | |
| 2555 } | |
| 2541 } | 2556 } |
| 2542 | 2557 |
| 2543 void WebContentsImpl::RequestOpenURL(RenderFrameHostImpl* render_frame_host, | 2558 void WebContentsImpl::RequestOpenURL(RenderFrameHostImpl* render_frame_host, |
| 2544 const OpenURLParams& params) { | 2559 const OpenURLParams& params) { |
| 2545 // OpenURL can blow away the source RFH. Use the process/frame routing ID as a | 2560 // OpenURL can blow away the source RFH. Use the process/frame routing ID as a |
| 2546 // weak pointer of sorts. | 2561 // weak pointer of sorts. |
| 2547 const int32_t process_id = render_frame_host->GetProcess()->GetID(); | 2562 const int32_t process_id = render_frame_host->GetProcess()->GetID(); |
| 2548 const int32_t frame_id = render_frame_host->GetRoutingID(); | 2563 const int32_t frame_id = render_frame_host->GetRoutingID(); |
| 2549 | 2564 |
| 2550 WebContents* new_contents = OpenURL(params); | 2565 WebContents* new_contents = OpenURL(params); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 2569 | 2584 |
| 2570 void WebContentsImpl::DidCommitProvisionalLoad( | 2585 void WebContentsImpl::DidCommitProvisionalLoad( |
| 2571 RenderFrameHostImpl* render_frame_host, | 2586 RenderFrameHostImpl* render_frame_host, |
| 2572 const GURL& url, | 2587 const GURL& url, |
| 2573 ui::PageTransition transition_type) { | 2588 ui::PageTransition transition_type) { |
| 2574 // Notify observers about the commit of the provisional load. | 2589 // Notify observers about the commit of the provisional load. |
| 2575 FOR_EACH_OBSERVER(WebContentsObserver, | 2590 FOR_EACH_OBSERVER(WebContentsObserver, |
| 2576 observers_, | 2591 observers_, |
| 2577 DidCommitProvisionalLoadForFrame( | 2592 DidCommitProvisionalLoadForFrame( |
| 2578 render_frame_host, url, transition_type)); | 2593 render_frame_host, url, transition_type)); |
| 2594 | |
| 2595 BrowserAccessibilityManager* manager = | |
| 2596 render_frame_host->browser_accessibility_manager(); | |
| 2597 if (manager) | |
| 2598 manager->NavigationSucceeded(); | |
| 2579 } | 2599 } |
| 2580 | 2600 |
| 2581 void WebContentsImpl::DidNavigateMainFramePreCommit( | 2601 void WebContentsImpl::DidNavigateMainFramePreCommit( |
| 2582 bool navigation_is_within_page) { | 2602 bool navigation_is_within_page) { |
| 2583 // Ensure fullscreen mode is exited before committing the navigation to a | 2603 // Ensure fullscreen mode is exited before committing the navigation to a |
| 2584 // different page. The next page will not start out assuming it is in | 2604 // different page. The next page will not start out assuming it is in |
| 2585 // fullscreen mode. | 2605 // fullscreen mode. |
| 2586 if (navigation_is_within_page) { | 2606 if (navigation_is_within_page) { |
| 2587 // No page change? Then, the renderer and browser can remain in fullscreen. | 2607 // No page change? Then, the renderer and browser can remain in fullscreen. |
| 2588 return; | 2608 return; |
| (...skipping 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4407 node->render_manager()->ResumeResponseDeferredAtStart(); | 4427 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4408 } | 4428 } |
| 4409 | 4429 |
| 4410 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4430 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4411 force_disable_overscroll_content_ = force_disable; | 4431 force_disable_overscroll_content_ = force_disable; |
| 4412 if (view_) | 4432 if (view_) |
| 4413 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4433 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4414 } | 4434 } |
| 4415 | 4435 |
| 4416 } // namespace content | 4436 } // namespace content |
| OLD | NEW |