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