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/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 2523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2534 RenderFrameHostImpl* render_frame_host, | 2534 RenderFrameHostImpl* render_frame_host, |
2535 const GURL& validated_url, | 2535 const GURL& validated_url, |
2536 bool is_error_page, | 2536 bool is_error_page, |
2537 bool is_iframe_srcdoc) { | 2537 bool is_iframe_srcdoc) { |
2538 // Notify observers about the start of the provisional load. | 2538 // Notify observers about the start of the provisional load. |
2539 FOR_EACH_OBSERVER( | 2539 FOR_EACH_OBSERVER( |
2540 WebContentsObserver, | 2540 WebContentsObserver, |
2541 observers_, | 2541 observers_, |
2542 DidStartProvisionalLoadForFrame( | 2542 DidStartProvisionalLoadForFrame( |
2543 render_frame_host, validated_url, is_error_page, is_iframe_srcdoc)); | 2543 render_frame_host, validated_url, is_error_page, is_iframe_srcdoc)); |
2544 | |
2545 // Notify accessibility if this is a reload. | |
2546 NavigationEntry* entry = controller_.GetVisibleEntry(); | |
2547 if (entry && ui::PageTransitionCoreTypeIs( | |
2548 entry->GetTransitionType(), ui::PAGE_TRANSITION_RELOAD)) { | |
2549 FrameTreeNode* ftn = render_frame_host->frame_tree_node(); | |
2550 BrowserAccessibilityManager* manager = | |
2551 ftn->current_frame_host()->browser_accessibility_manager(); | |
2552 if (manager) | |
2553 manager->UserIsReloading(); | |
2554 } | |
2544 } | 2555 } |
2545 | 2556 |
2546 void WebContentsImpl::DidStartNavigationTransition( | 2557 void WebContentsImpl::DidStartNavigationTransition( |
2547 RenderFrameHostImpl* render_frame_host) { | 2558 RenderFrameHostImpl* render_frame_host) { |
2548 #if defined(OS_ANDROID) | 2559 #if defined(OS_ANDROID) |
2549 int render_frame_id = render_frame_host->GetRoutingID(); | 2560 int render_frame_id = render_frame_host->GetRoutingID(); |
2550 GetWebContentsAndroid()->DidStartNavigationTransitionForFrame( | 2561 GetWebContentsAndroid()->DidStartNavigationTransitionForFrame( |
2551 render_frame_id); | 2562 render_frame_id); |
2552 #endif | 2563 #endif |
2553 } | 2564 } |
2554 | 2565 |
2555 void WebContentsImpl::DidFailProvisionalLoadWithError( | 2566 void WebContentsImpl::DidFailProvisionalLoadWithError( |
2556 RenderFrameHostImpl* render_frame_host, | 2567 RenderFrameHostImpl* render_frame_host, |
2557 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 2568 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
2558 GURL validated_url(params.url); | 2569 GURL validated_url(params.url); |
2559 FOR_EACH_OBSERVER(WebContentsObserver, | 2570 FOR_EACH_OBSERVER(WebContentsObserver, |
2560 observers_, | 2571 observers_, |
2561 DidFailProvisionalLoad(render_frame_host, | 2572 DidFailProvisionalLoad(render_frame_host, |
2562 validated_url, | 2573 validated_url, |
2563 params.error_code, | 2574 params.error_code, |
2564 params.error_description)); | 2575 params.error_description)); |
2576 | |
2577 BrowserAccessibilityManager* manager = | |
2578 render_frame_host->browser_accessibility_manager(); | |
nasko
2015/02/04 21:12:08
Don't you need the same code as above to get the m
dmazzoni
2015/02/04 22:23:10
Good catch, thanks.
| |
2579 if (manager) | |
2580 manager->NavigationFailed(); | |
2565 } | 2581 } |
2566 | 2582 |
2567 void WebContentsImpl::DidFailLoadWithError( | 2583 void WebContentsImpl::DidFailLoadWithError( |
2568 RenderFrameHostImpl* render_frame_host, | 2584 RenderFrameHostImpl* render_frame_host, |
2569 const GURL& url, | 2585 const GURL& url, |
2570 int error_code, | 2586 int error_code, |
2571 const base::string16& error_description) { | 2587 const base::string16& error_description) { |
2572 FOR_EACH_OBSERVER( | 2588 FOR_EACH_OBSERVER( |
2573 WebContentsObserver, | 2589 WebContentsObserver, |
2574 observers_, | 2590 observers_, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2630 | 2646 |
2631 void WebContentsImpl::DidCommitProvisionalLoad( | 2647 void WebContentsImpl::DidCommitProvisionalLoad( |
2632 RenderFrameHostImpl* render_frame_host, | 2648 RenderFrameHostImpl* render_frame_host, |
2633 const GURL& url, | 2649 const GURL& url, |
2634 ui::PageTransition transition_type) { | 2650 ui::PageTransition transition_type) { |
2635 // Notify observers about the commit of the provisional load. | 2651 // Notify observers about the commit of the provisional load. |
2636 FOR_EACH_OBSERVER(WebContentsObserver, | 2652 FOR_EACH_OBSERVER(WebContentsObserver, |
2637 observers_, | 2653 observers_, |
2638 DidCommitProvisionalLoadForFrame( | 2654 DidCommitProvisionalLoadForFrame( |
2639 render_frame_host, url, transition_type)); | 2655 render_frame_host, url, transition_type)); |
2656 | |
2657 BrowserAccessibilityManager* manager = | |
2658 render_frame_host->browser_accessibility_manager(); | |
nasko
2015/02/04 21:12:08
This however should be fine, as we have committed
| |
2659 if (manager) | |
2660 manager->NavigationSucceeded(); | |
2640 } | 2661 } |
2641 | 2662 |
2642 void WebContentsImpl::DidNavigateMainFramePreCommit( | 2663 void WebContentsImpl::DidNavigateMainFramePreCommit( |
2643 bool navigation_is_within_page) { | 2664 bool navigation_is_within_page) { |
2644 // Ensure fullscreen mode is exited before committing the navigation to a | 2665 // Ensure fullscreen mode is exited before committing the navigation to a |
2645 // different page. The next page will not start out assuming it is in | 2666 // different page. The next page will not start out assuming it is in |
2646 // fullscreen mode. | 2667 // fullscreen mode. |
2647 if (navigation_is_within_page) { | 2668 if (navigation_is_within_page) { |
2648 // No page change? Then, the renderer and browser can remain in fullscreen. | 2669 // No page change? Then, the renderer and browser can remain in fullscreen. |
2649 return; | 2670 return; |
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3801 | 3822 |
3802 void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { | 3823 void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { |
3803 if (delegate_ && delegate_->IsPopupOrPanel(this)) | 3824 if (delegate_ && delegate_->IsPopupOrPanel(this)) |
3804 delegate_->MoveContents(this, new_bounds); | 3825 delegate_->MoveContents(this, new_bounds); |
3805 } | 3826 } |
3806 | 3827 |
3807 void WebContentsImpl::DidStartLoading(RenderFrameHost* render_frame_host, | 3828 void WebContentsImpl::DidStartLoading(RenderFrameHost* render_frame_host, |
3808 bool to_different_document) { | 3829 bool to_different_document) { |
3809 SetIsLoading(render_frame_host->GetRenderViewHost(), true, | 3830 SetIsLoading(render_frame_host->GetRenderViewHost(), true, |
3810 to_different_document, NULL); | 3831 to_different_document, NULL); |
3832 | |
3833 // Notify accessibility that the user is navigating away from the | |
3834 // current RenderFrameHost. TODO(dmazzoni): do this using a | |
nasko
2015/02/04 21:12:08
It needn't navigate away from the current RFH. It
dmazzoni
2015/02/04 22:23:10
Done.
| |
3835 // WebContentsObserver in a future refactoring. | |
3836 FrameTreeNode* ftn = static_cast<RenderFrameHostImpl*>(render_frame_host)-> | |
3837 frame_tree_node(); | |
3838 BrowserAccessibilityManager* manager = | |
3839 ftn->current_frame_host()->browser_accessibility_manager(); | |
3840 if (manager) | |
3841 manager->UserIsNavigatingAway(); | |
3811 } | 3842 } |
3812 | 3843 |
3813 void WebContentsImpl::DidStopLoading(RenderFrameHost* render_frame_host) { | 3844 void WebContentsImpl::DidStopLoading(RenderFrameHost* render_frame_host) { |
3814 scoped_ptr<LoadNotificationDetails> details; | 3845 scoped_ptr<LoadNotificationDetails> details; |
3815 | 3846 |
3816 // Use the last committed entry rather than the active one, in case a | 3847 // Use the last committed entry rather than the active one, in case a |
3817 // pending entry has been created. | 3848 // pending entry has been created. |
3818 NavigationEntry* entry = controller_.GetLastCommittedEntry(); | 3849 NavigationEntry* entry = controller_.GetLastCommittedEntry(); |
3819 Navigator* navigator = frame_tree_.root()->navigator(); | 3850 Navigator* navigator = frame_tree_.root()->navigator(); |
3820 | 3851 |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4483 node->render_manager()->ResumeResponseDeferredAtStart(); | 4514 node->render_manager()->ResumeResponseDeferredAtStart(); |
4484 } | 4515 } |
4485 | 4516 |
4486 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4517 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4487 force_disable_overscroll_content_ = force_disable; | 4518 force_disable_overscroll_content_ = force_disable; |
4488 if (view_) | 4519 if (view_) |
4489 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4520 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4490 } | 4521 } |
4491 | 4522 |
4492 } // namespace content | 4523 } // namespace content |
OLD | NEW |