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 2511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2522 RenderFrameHostImpl* render_frame_host, | 2522 RenderFrameHostImpl* render_frame_host, |
2523 const GURL& validated_url, | 2523 const GURL& validated_url, |
2524 bool is_error_page, | 2524 bool is_error_page, |
2525 bool is_iframe_srcdoc) { | 2525 bool is_iframe_srcdoc) { |
2526 // Notify observers about the start of the provisional load. | 2526 // Notify observers about the start of the provisional load. |
2527 FOR_EACH_OBSERVER( | 2527 FOR_EACH_OBSERVER( |
2528 WebContentsObserver, | 2528 WebContentsObserver, |
2529 observers_, | 2529 observers_, |
2530 DidStartProvisionalLoadForFrame( | 2530 DidStartProvisionalLoadForFrame( |
2531 render_frame_host, validated_url, is_error_page, is_iframe_srcdoc)); | 2531 render_frame_host, validated_url, is_error_page, is_iframe_srcdoc)); |
| 2532 |
| 2533 // Notify accessibility if this is a reload. |
| 2534 NavigationEntry* entry = controller_.GetVisibleEntry(); |
| 2535 if (entry && ui::PageTransitionCoreTypeIs( |
| 2536 entry->GetTransitionType(), ui::PAGE_TRANSITION_RELOAD)) { |
| 2537 FrameTreeNode* ftn = render_frame_host->frame_tree_node(); |
| 2538 BrowserAccessibilityManager* manager = |
| 2539 ftn->current_frame_host()->browser_accessibility_manager(); |
| 2540 if (manager) |
| 2541 manager->UserIsReloading(); |
| 2542 } |
2532 } | 2543 } |
2533 | 2544 |
2534 void WebContentsImpl::DidStartNavigationTransition( | 2545 void WebContentsImpl::DidStartNavigationTransition( |
2535 RenderFrameHostImpl* render_frame_host) { | 2546 RenderFrameHostImpl* render_frame_host) { |
2536 #if defined(OS_ANDROID) | 2547 #if defined(OS_ANDROID) |
2537 int render_frame_id = render_frame_host->GetRoutingID(); | 2548 int render_frame_id = render_frame_host->GetRoutingID(); |
2538 GetWebContentsAndroid()->DidStartNavigationTransitionForFrame( | 2549 GetWebContentsAndroid()->DidStartNavigationTransitionForFrame( |
2539 render_frame_id); | 2550 render_frame_id); |
2540 #endif | 2551 #endif |
2541 } | 2552 } |
2542 | 2553 |
2543 void WebContentsImpl::DidFailProvisionalLoadWithError( | 2554 void WebContentsImpl::DidFailProvisionalLoadWithError( |
2544 RenderFrameHostImpl* render_frame_host, | 2555 RenderFrameHostImpl* render_frame_host, |
2545 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 2556 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
2546 GURL validated_url(params.url); | 2557 GURL validated_url(params.url); |
2547 FOR_EACH_OBSERVER(WebContentsObserver, | 2558 FOR_EACH_OBSERVER(WebContentsObserver, |
2548 observers_, | 2559 observers_, |
2549 DidFailProvisionalLoad(render_frame_host, | 2560 DidFailProvisionalLoad(render_frame_host, |
2550 validated_url, | 2561 validated_url, |
2551 params.error_code, | 2562 params.error_code, |
2552 params.error_description)); | 2563 params.error_description)); |
| 2564 |
| 2565 FrameTreeNode* ftn = render_frame_host->frame_tree_node(); |
| 2566 BrowserAccessibilityManager* manager = |
| 2567 ftn->current_frame_host()->browser_accessibility_manager(); |
| 2568 if (manager) |
| 2569 manager->NavigationFailed(); |
2553 } | 2570 } |
2554 | 2571 |
2555 void WebContentsImpl::DidFailLoadWithError( | 2572 void WebContentsImpl::DidFailLoadWithError( |
2556 RenderFrameHostImpl* render_frame_host, | 2573 RenderFrameHostImpl* render_frame_host, |
2557 const GURL& url, | 2574 const GURL& url, |
2558 int error_code, | 2575 int error_code, |
2559 const base::string16& error_description) { | 2576 const base::string16& error_description) { |
2560 FOR_EACH_OBSERVER( | 2577 FOR_EACH_OBSERVER( |
2561 WebContentsObserver, | 2578 WebContentsObserver, |
2562 observers_, | 2579 observers_, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2618 | 2635 |
2619 void WebContentsImpl::DidCommitProvisionalLoad( | 2636 void WebContentsImpl::DidCommitProvisionalLoad( |
2620 RenderFrameHostImpl* render_frame_host, | 2637 RenderFrameHostImpl* render_frame_host, |
2621 const GURL& url, | 2638 const GURL& url, |
2622 ui::PageTransition transition_type) { | 2639 ui::PageTransition transition_type) { |
2623 // Notify observers about the commit of the provisional load. | 2640 // Notify observers about the commit of the provisional load. |
2624 FOR_EACH_OBSERVER(WebContentsObserver, | 2641 FOR_EACH_OBSERVER(WebContentsObserver, |
2625 observers_, | 2642 observers_, |
2626 DidCommitProvisionalLoadForFrame( | 2643 DidCommitProvisionalLoadForFrame( |
2627 render_frame_host, url, transition_type)); | 2644 render_frame_host, url, transition_type)); |
| 2645 |
| 2646 BrowserAccessibilityManager* manager = |
| 2647 render_frame_host->browser_accessibility_manager(); |
| 2648 if (manager) |
| 2649 manager->NavigationSucceeded(); |
2628 } | 2650 } |
2629 | 2651 |
2630 void WebContentsImpl::DidNavigateMainFramePreCommit( | 2652 void WebContentsImpl::DidNavigateMainFramePreCommit( |
2631 bool navigation_is_within_page) { | 2653 bool navigation_is_within_page) { |
2632 // Ensure fullscreen mode is exited before committing the navigation to a | 2654 // Ensure fullscreen mode is exited before committing the navigation to a |
2633 // different page. The next page will not start out assuming it is in | 2655 // different page. The next page will not start out assuming it is in |
2634 // fullscreen mode. | 2656 // fullscreen mode. |
2635 if (navigation_is_within_page) { | 2657 if (navigation_is_within_page) { |
2636 // No page change? Then, the renderer and browser can remain in fullscreen. | 2658 // No page change? Then, the renderer and browser can remain in fullscreen. |
2637 return; | 2659 return; |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3793 | 3815 |
3794 void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { | 3816 void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { |
3795 if (delegate_ && delegate_->IsPopupOrPanel(this)) | 3817 if (delegate_ && delegate_->IsPopupOrPanel(this)) |
3796 delegate_->MoveContents(this, new_bounds); | 3818 delegate_->MoveContents(this, new_bounds); |
3797 } | 3819 } |
3798 | 3820 |
3799 void WebContentsImpl::DidStartLoading(RenderFrameHost* render_frame_host, | 3821 void WebContentsImpl::DidStartLoading(RenderFrameHost* render_frame_host, |
3800 bool to_different_document) { | 3822 bool to_different_document) { |
3801 SetIsLoading(render_frame_host->GetRenderViewHost(), true, | 3823 SetIsLoading(render_frame_host->GetRenderViewHost(), true, |
3802 to_different_document, NULL); | 3824 to_different_document, NULL); |
| 3825 |
| 3826 // Notify accessibility that the user is navigating away from the |
| 3827 // current document. |
| 3828 // |
| 3829 // TODO(dmazzoni): do this using a WebContentsObserver. |
| 3830 FrameTreeNode* ftn = static_cast<RenderFrameHostImpl*>(render_frame_host)-> |
| 3831 frame_tree_node(); |
| 3832 BrowserAccessibilityManager* manager = |
| 3833 ftn->current_frame_host()->browser_accessibility_manager(); |
| 3834 if (manager) |
| 3835 manager->UserIsNavigatingAway(); |
3803 } | 3836 } |
3804 | 3837 |
3805 void WebContentsImpl::DidStopLoading(RenderFrameHost* render_frame_host) { | 3838 void WebContentsImpl::DidStopLoading(RenderFrameHost* render_frame_host) { |
3806 scoped_ptr<LoadNotificationDetails> details; | 3839 scoped_ptr<LoadNotificationDetails> details; |
3807 | 3840 |
3808 // Use the last committed entry rather than the active one, in case a | 3841 // Use the last committed entry rather than the active one, in case a |
3809 // pending entry has been created. | 3842 // pending entry has been created. |
3810 NavigationEntry* entry = controller_.GetLastCommittedEntry(); | 3843 NavigationEntry* entry = controller_.GetLastCommittedEntry(); |
3811 Navigator* navigator = frame_tree_.root()->navigator(); | 3844 Navigator* navigator = frame_tree_.root()->navigator(); |
3812 | 3845 |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4476 node->render_manager()->ResumeResponseDeferredAtStart(); | 4509 node->render_manager()->ResumeResponseDeferredAtStart(); |
4477 } | 4510 } |
4478 | 4511 |
4479 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4512 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4480 force_disable_overscroll_content_ = force_disable; | 4513 force_disable_overscroll_content_ = force_disable; |
4481 if (view_) | 4514 if (view_) |
4482 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4515 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4483 } | 4516 } |
4484 | 4517 |
4485 } // namespace content | 4518 } // namespace content |
OLD | NEW |