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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1693353002: Reland #2 Remove the is_loading_ field from WebContentsImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nits + rebase Created 4 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 render_view_host_delegate_view_(NULL), 316 render_view_host_delegate_view_(NULL),
317 created_with_opener_(false), 317 created_with_opener_(false),
318 #if defined(OS_WIN) 318 #if defined(OS_WIN)
319 accessible_parent_(NULL), 319 accessible_parent_(NULL),
320 #endif 320 #endif
321 frame_tree_(new NavigatorImpl(&controller_, this), 321 frame_tree_(new NavigatorImpl(&controller_, this),
322 this, 322 this,
323 this, 323 this,
324 this, 324 this,
325 this), 325 this),
326 is_loading_(false),
327 is_load_to_different_document_(false), 326 is_load_to_different_document_(false),
328 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), 327 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING),
329 crashed_error_code_(0), 328 crashed_error_code_(0),
330 waiting_for_response_(false), 329 waiting_for_response_(false),
331 load_state_(net::LOAD_STATE_IDLE, base::string16()), 330 load_state_(net::LOAD_STATE_IDLE, base::string16()),
332 upload_size_(0), 331 upload_size_(0),
333 upload_position_(0), 332 upload_position_(0),
334 is_resume_pending_(false), 333 is_resume_pending_(false),
335 displayed_insecure_content_(false), 334 displayed_insecure_content_(false),
336 has_accessed_initial_document_(false), 335 has_accessed_initial_document_(false),
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 renderer_preferences_.user_agent_override = override; 874 renderer_preferences_.user_agent_override = override;
876 875
877 // Send the new override string to the renderer. 876 // Send the new override string to the renderer.
878 RenderViewHost* host = GetRenderViewHost(); 877 RenderViewHost* host = GetRenderViewHost();
879 if (host) 878 if (host)
880 host->SyncRendererPrefs(); 879 host->SyncRendererPrefs();
881 880
882 // Reload the page if a load is currently in progress to avoid having 881 // Reload the page if a load is currently in progress to avoid having
883 // different parts of the page loaded using different user agents. 882 // different parts of the page loaded using different user agents.
884 NavigationEntry* entry = controller_.GetVisibleEntry(); 883 NavigationEntry* entry = controller_.GetVisibleEntry();
885 if (is_loading_ && entry != NULL && entry->GetIsOverridingUserAgent()) 884 if (IsLoading() && entry != NULL && entry->GetIsOverridingUserAgent())
886 controller_.ReloadIgnoringCache(true); 885 controller_.ReloadIgnoringCache(true);
887 886
888 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 887 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
889 UserAgentOverrideSet(override)); 888 UserAgentOverrideSet(override));
890 } 889 }
891 890
892 const std::string& WebContentsImpl::GetUserAgentOverride() const { 891 const std::string& WebContentsImpl::GetUserAgentOverride() const {
893 return renderer_preferences_.user_agent_override; 892 return renderer_preferences_.user_agent_override;
894 } 893 }
895 894
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 1014
1016 SiteInstanceImpl* WebContentsImpl::GetPendingSiteInstance() const { 1015 SiteInstanceImpl* WebContentsImpl::GetPendingSiteInstance() const {
1017 RenderViewHostImpl* dest_rvh = 1016 RenderViewHostImpl* dest_rvh =
1018 GetRenderManager()->pending_render_view_host() ? 1017 GetRenderManager()->pending_render_view_host() ?
1019 GetRenderManager()->pending_render_view_host() : 1018 GetRenderManager()->pending_render_view_host() :
1020 GetRenderManager()->current_host(); 1019 GetRenderManager()->current_host();
1021 return dest_rvh->GetSiteInstance(); 1020 return dest_rvh->GetSiteInstance();
1022 } 1021 }
1023 1022
1024 bool WebContentsImpl::IsLoading() const { 1023 bool WebContentsImpl::IsLoading() const {
1025 return is_loading_; 1024 return frame_tree_.IsLoading() &&
1025 !(ShowingInterstitialPage() &&
1026 GetRenderManager()->interstitial_page()->pause_throbber());
1026 } 1027 }
1027 1028
1028 bool WebContentsImpl::IsLoadingToDifferentDocument() const { 1029 bool WebContentsImpl::IsLoadingToDifferentDocument() const {
1029 return is_loading_ && is_load_to_different_document_; 1030 return IsLoading() && is_load_to_different_document_;
1030 } 1031 }
1031 1032
1032 bool WebContentsImpl::IsWaitingForResponse() const { 1033 bool WebContentsImpl::IsWaitingForResponse() const {
1033 return waiting_for_response_ && is_load_to_different_document_; 1034 return waiting_for_response_ && is_load_to_different_document_;
1034 } 1035 }
1035 1036
1036 const net::LoadStateWithParam& WebContentsImpl::GetLoadState() const { 1037 const net::LoadStateWithParam& WebContentsImpl::GetLoadState() const {
1037 return load_state_; 1038 return load_state_;
1038 } 1039 }
1039 1040
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after
2294 InterstitialPageImpl* interstitial_page) { 2295 InterstitialPageImpl* interstitial_page) {
2295 DCHECK(interstitial_page); 2296 DCHECK(interstitial_page);
2296 GetRenderManager()->set_interstitial_page(interstitial_page); 2297 GetRenderManager()->set_interstitial_page(interstitial_page);
2297 2298
2298 // Cancel any visible dialogs so that they don't interfere with the 2299 // Cancel any visible dialogs so that they don't interfere with the
2299 // interstitial. 2300 // interstitial.
2300 CancelActiveAndPendingDialogs(); 2301 CancelActiveAndPendingDialogs();
2301 2302
2302 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2303 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2303 DidAttachInterstitialPage()); 2304 DidAttachInterstitialPage());
2305
2306 // Stop the throbber if needed while the interstitial page is shown.
2307 if (frame_tree_.IsLoading())
2308 LoadingStateChanged(true, true, nullptr);
2309 }
2310
2311 void WebContentsImpl::DidProceedOnInterstitial() {
2312 // The interstitial page should no longer be pausing the throbber.
2313 DCHECK(!(ShowingInterstitialPage() &&
2314 GetRenderManager()->interstitial_page()->pause_throbber()));
2315
2316 // Restart the throbber now that the interstitial page no longer pauses it.
2317 if (ShowingInterstitialPage() && frame_tree_.IsLoading())
2318 LoadingStateChanged(true, true, nullptr);
2304 } 2319 }
2305 2320
2306 void WebContentsImpl::DetachInterstitialPage() { 2321 void WebContentsImpl::DetachInterstitialPage() {
2322 bool interstitial_pausing_throbber =
2323 ShowingInterstitialPage() &&
2324 GetRenderManager()->interstitial_page()->pause_throbber();
2307 if (ShowingInterstitialPage()) 2325 if (ShowingInterstitialPage())
2308 GetRenderManager()->remove_interstitial_page(); 2326 GetRenderManager()->remove_interstitial_page();
2309 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2327 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2310 DidDetachInterstitialPage()); 2328 DidDetachInterstitialPage());
2329
2330 // Restart the throbber if needed now that the interstitial page is going
2331 // away.
2332 if (interstitial_pausing_throbber && frame_tree_.IsLoading())
2333 LoadingStateChanged(true, true, nullptr);
2311 } 2334 }
2312 2335
2313 void WebContentsImpl::SetHistoryOffsetAndLength(int history_offset, 2336 void WebContentsImpl::SetHistoryOffsetAndLength(int history_offset,
2314 int history_length) { 2337 int history_length) {
2315 SetHistoryOffsetAndLengthForView( 2338 SetHistoryOffsetAndLengthForView(
2316 GetRenderViewHost(), history_offset, history_length); 2339 GetRenderViewHost(), history_offset, history_length);
2317 } 2340 }
2318 2341
2319 void WebContentsImpl::SetHistoryOffsetAndLengthForView( 2342 void WebContentsImpl::SetHistoryOffsetAndLengthForView(
2320 RenderViewHost* render_view_host, 2343 RenderViewHost* render_view_host,
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
3574 void WebContentsImpl::ActivateAndShowRepostFormWarningDialog() { 3597 void WebContentsImpl::ActivateAndShowRepostFormWarningDialog() {
3575 Activate(); 3598 Activate();
3576 if (delegate_) 3599 if (delegate_)
3577 delegate_->ShowRepostFormWarningDialog(this); 3600 delegate_->ShowRepostFormWarningDialog(this);
3578 } 3601 }
3579 3602
3580 bool WebContentsImpl::HasAccessedInitialDocument() { 3603 bool WebContentsImpl::HasAccessedInitialDocument() {
3581 return has_accessed_initial_document_; 3604 return has_accessed_initial_document_;
3582 } 3605 }
3583 3606
3584 // Notifies the RenderWidgetHost instance about the fact that the page is
3585 // loading, or done loading.
3586 void WebContentsImpl::SetIsLoading(bool is_loading,
3587 bool to_different_document,
3588 LoadNotificationDetails* details) {
3589 if (is_loading == is_loading_)
3590 return;
3591
3592 if (!is_loading) {
3593 load_state_ = net::LoadStateWithParam(net::LOAD_STATE_IDLE,
3594 base::string16());
3595 load_state_host_.clear();
3596 upload_size_ = 0;
3597 upload_position_ = 0;
3598 }
3599
3600 GetRenderManager()->SetIsLoading(is_loading);
3601
3602 is_loading_ = is_loading;
3603 waiting_for_response_ = is_loading;
3604 is_load_to_different_document_ = to_different_document;
3605
3606 if (delegate_)
3607 delegate_->LoadingStateChanged(this, to_different_document);
3608 NotifyNavigationStateChanged(INVALIDATE_TYPE_LOAD);
3609
3610 std::string url = (details ? details->url.possibly_invalid_spec() : "NULL");
3611 if (is_loading) {
3612 TRACE_EVENT_ASYNC_BEGIN2("browser,navigation", "WebContentsImpl Loading",
3613 this, "URL", url, "Main FrameTreeNode id",
3614 GetFrameTree()->root()->frame_tree_node_id());
3615 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidStartLoading());
3616 } else {
3617 TRACE_EVENT_ASYNC_END1("browser,navigation", "WebContentsImpl Loading",
3618 this, "URL", url);
3619 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidStopLoading());
3620 }
3621
3622 // TODO(avi): Remove. http://crbug.com/170921
3623 int type = is_loading ? NOTIFICATION_LOAD_START : NOTIFICATION_LOAD_STOP;
3624 NotificationDetails det = NotificationService::NoDetails();
3625 if (details)
3626 det = Details<LoadNotificationDetails>(details);
3627 NotificationService::current()->Notify(
3628 type, Source<NavigationController>(&controller_), det);
3629 }
3630
3631 void WebContentsImpl::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) { 3607 void WebContentsImpl::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) {
3632 // If we are creating a RVH for a restored controller, then we need to make 3608 // If we are creating a RVH for a restored controller, then we need to make
3633 // sure the RenderView starts with a next_page_id_ larger than the number 3609 // sure the RenderView starts with a next_page_id_ larger than the number
3634 // of restored entries. This must be called before the RenderView starts 3610 // of restored entries. This must be called before the RenderView starts
3635 // navigating (to avoid a race between the browser updating max_page_id and 3611 // navigating (to avoid a race between the browser updating max_page_id and
3636 // the renderer updating next_page_id_). Because of this, we only call this 3612 // the renderer updating next_page_id_). Because of this, we only call this
3637 // from CreateRenderView and allow that to notify the RenderView for us. 3613 // from CreateRenderView and allow that to notify the RenderView for us.
3638 int max_restored_page_id = controller_.GetMaxRestoredPageID(); 3614 int max_restored_page_id = controller_.GetMaxRestoredPageID();
3639 if (max_restored_page_id > 3615 if (max_restored_page_id >
3640 GetMaxPageIDForSiteInstance(rvh->GetSiteInstance())) 3616 GetMaxPageIDForSiteInstance(rvh->GetSiteInstance()))
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
3686 if (delegate_) 3662 if (delegate_)
3687 delegate_->LoadProgressChanged(this, frame_tree_.load_progress()); 3663 delegate_->LoadProgressChanged(this, frame_tree_.load_progress());
3688 } 3664 }
3689 3665
3690 void WebContentsImpl::ResetLoadProgressState() { 3666 void WebContentsImpl::ResetLoadProgressState() {
3691 frame_tree_.ResetLoadProgress(); 3667 frame_tree_.ResetLoadProgress();
3692 loading_weak_factory_.InvalidateWeakPtrs(); 3668 loading_weak_factory_.InvalidateWeakPtrs();
3693 loading_last_progress_update_ = base::TimeTicks(); 3669 loading_last_progress_update_ = base::TimeTicks();
3694 } 3670 }
3695 3671
3672 // Notifies the RenderWidgetHost instance about the fact that the page is
3673 // loading, or done loading.
3674 void WebContentsImpl::LoadingStateChanged(bool to_different_document,
3675 bool due_to_interstitial,
3676 LoadNotificationDetails* details) {
3677 // Do not send notifications about loading changes in the FrameTree while the
3678 // interstitial page is pausing the throbber.
3679 if (ShowingInterstitialPage() &&
3680 GetRenderManager()->interstitial_page()->pause_throbber() &&
3681 !due_to_interstitial) {
3682 return;
3683 }
3684
3685 bool is_loading = IsLoading();
3686
3687 if (!is_loading) {
3688 load_state_ = net::LoadStateWithParam(net::LOAD_STATE_IDLE,
3689 base::string16());
3690 load_state_host_.clear();
3691 upload_size_ = 0;
3692 upload_position_ = 0;
3693 }
3694
3695 GetRenderManager()->SetIsLoading(is_loading);
3696
3697 waiting_for_response_ = is_loading;
3698 is_load_to_different_document_ = to_different_document;
3699
3700 if (delegate_)
3701 delegate_->LoadingStateChanged(this, to_different_document);
3702 NotifyNavigationStateChanged(INVALIDATE_TYPE_LOAD);
3703
3704 std::string url = (details ? details->url.possibly_invalid_spec() : "NULL");
3705 if (is_loading) {
3706 TRACE_EVENT_ASYNC_BEGIN2("browser,navigation", "WebContentsImpl Loading",
3707 this, "URL", url, "Main FrameTreeNode id",
3708 GetFrameTree()->root()->frame_tree_node_id());
3709 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidStartLoading());
3710 } else {
3711 TRACE_EVENT_ASYNC_END1("browser,navigation", "WebContentsImpl Loading",
3712 this, "URL", url);
3713 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidStopLoading());
3714 }
3715
3716 // TODO(avi): Remove. http://crbug.com/170921
3717 int type = is_loading ? NOTIFICATION_LOAD_START : NOTIFICATION_LOAD_STOP;
3718 NotificationDetails det = NotificationService::NoDetails();
3719 if (details)
3720 det = Details<LoadNotificationDetails>(details);
3721 NotificationService::current()->Notify(
3722 type, Source<NavigationController>(&controller_), det);
3723 }
3724
3696 void WebContentsImpl::NotifyViewSwapped(RenderViewHost* old_host, 3725 void WebContentsImpl::NotifyViewSwapped(RenderViewHost* old_host,
3697 RenderViewHost* new_host) { 3726 RenderViewHost* new_host) {
3698 // After sending out a swap notification, we need to send a disconnect 3727 // After sending out a swap notification, we need to send a disconnect
3699 // notification so that clients that pick up a pointer to |this| can NULL the 3728 // notification so that clients that pick up a pointer to |this| can NULL the
3700 // pointer. See Bug 1230284. 3729 // pointer. See Bug 1230284.
3701 notify_disconnection_ = true; 3730 notify_disconnection_ = true;
3702 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 3731 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
3703 RenderViewHostChanged(old_host, new_host)); 3732 RenderViewHostChanged(old_host, new_host));
3704 3733
3705 // Ensure that the associated embedder gets cleared after a RenderViewHost 3734 // Ensure that the associated embedder gets cleared after a RenderViewHost
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
3945 // renderer may not have made a clean exit. 3974 // renderer may not have made a clean exit.
3946 if (IsFullscreenForCurrentTab(GetRenderViewHost()->GetWidget())) 3975 if (IsFullscreenForCurrentTab(GetRenderViewHost()->GetWidget()))
3947 ExitFullscreenMode(false); 3976 ExitFullscreenMode(false);
3948 3977
3949 // Cancel any visible dialogs so they are not left dangling over the sad tab. 3978 // Cancel any visible dialogs so they are not left dangling over the sad tab.
3950 CancelActiveAndPendingDialogs(); 3979 CancelActiveAndPendingDialogs();
3951 3980
3952 if (delegate_) 3981 if (delegate_)
3953 delegate_->HideValidationMessage(this); 3982 delegate_->HideValidationMessage(this);
3954 3983
3955 SetIsLoading(false, true, nullptr);
3956 NotifyDisconnected();
3957 SetIsCrashed(status, error_code);
3958
3959 // Reset the loading progress. TODO(avi): What does it mean to have a 3984 // Reset the loading progress. TODO(avi): What does it mean to have a
3960 // "renderer crash" when there is more than one renderer process serving a 3985 // "renderer crash" when there is more than one renderer process serving a
3961 // webpage? Once this function is called at a more granular frame level, we 3986 // webpage? Once this function is called at a more granular frame level, we
3962 // probably will need to more granularly reset the state here. 3987 // probably will need to more granularly reset the state here.
3963 ResetLoadProgressState(); 3988 ResetLoadProgressState();
3989 NotifyDisconnected();
3990 SetIsCrashed(status, error_code);
3964 3991
3965 FOR_EACH_OBSERVER(WebContentsObserver, 3992 FOR_EACH_OBSERVER(WebContentsObserver,
3966 observers_, 3993 observers_,
3967 RenderProcessGone(GetCrashedStatus())); 3994 RenderProcessGone(GetCrashedStatus()));
3968 } 3995 }
3969 3996
3970 void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) { 3997 void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) {
3971 FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh)); 3998 FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh));
3972 } 3999 }
3973 4000
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
4047 delegate_->SwappedOut(this); 4074 delegate_->SwappedOut(this);
4048 } 4075 }
4049 4076
4050 void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { 4077 void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) {
4051 if (delegate_ && delegate_->IsPopupOrPanel(this)) 4078 if (delegate_ && delegate_->IsPopupOrPanel(this))
4052 delegate_->MoveContents(this, new_bounds); 4079 delegate_->MoveContents(this, new_bounds);
4053 } 4080 }
4054 4081
4055 void WebContentsImpl::DidStartLoading(FrameTreeNode* frame_tree_node, 4082 void WebContentsImpl::DidStartLoading(FrameTreeNode* frame_tree_node,
4056 bool to_different_document) { 4083 bool to_different_document) {
4057 SetIsLoading(true, to_different_document, nullptr); 4084 LoadingStateChanged(to_different_document, false, nullptr);
4058 4085
4059 // Notify accessibility that the user is navigating away from the 4086 // Notify accessibility that the user is navigating away from the
4060 // current document. 4087 // current document.
4061 // 4088 //
4062 // TODO(dmazzoni): do this using a WebContentsObserver. 4089 // TODO(dmazzoni): do this using a WebContentsObserver.
4063 BrowserAccessibilityManager* manager = 4090 BrowserAccessibilityManager* manager =
4064 frame_tree_node->current_frame_host()->browser_accessibility_manager(); 4091 frame_tree_node->current_frame_host()->browser_accessibility_manager();
4065 if (manager) 4092 if (manager)
4066 manager->UserIsNavigatingAway(); 4093 manager->UserIsNavigatingAway();
4067 } 4094 }
(...skipping 13 matching lines...) Expand all
4081 base::TimeTicks::Now() - navigator->GetCurrentLoadStart(); 4108 base::TimeTicks::Now() - navigator->GetCurrentLoadStart();
4082 4109
4083 details.reset(new LoadNotificationDetails( 4110 details.reset(new LoadNotificationDetails(
4084 entry->GetVirtualURL(), 4111 entry->GetVirtualURL(),
4085 entry->GetTransitionType(), 4112 entry->GetTransitionType(),
4086 elapsed, 4113 elapsed,
4087 &controller_, 4114 &controller_,
4088 controller_.GetCurrentEntryIndex())); 4115 controller_.GetCurrentEntryIndex()));
4089 } 4116 }
4090 4117
4091 SetIsLoading(false, true, details.get()); 4118 LoadingStateChanged(true, false, details.get());
4092 } 4119 }
4093 4120
4094 void WebContentsImpl::DidChangeLoadProgress() { 4121 void WebContentsImpl::DidChangeLoadProgress() {
4095 double load_progress = frame_tree_.load_progress(); 4122 double load_progress = frame_tree_.load_progress();
4096 4123
4097 // The delegate is notified immediately for the first and last updates. Also, 4124 // The delegate is notified immediately for the first and last updates. Also,
4098 // since the message loop may be pretty busy when a page is loaded, it might 4125 // since the message loop may be pretty busy when a page is loaded, it might
4099 // not execute a posted task in a timely manner so the progress report is sent 4126 // not execute a posted task in a timely manner so the progress report is sent
4100 // immediately if enough time has passed. 4127 // immediately if enough time has passed.
4101 base::TimeDelta min_delay = 4128 base::TimeDelta min_delay =
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
4632 int render_frame_id, 4659 int render_frame_id,
4633 IPC::Message* reply_msg, 4660 IPC::Message* reply_msg,
4634 bool dialog_was_suppressed, 4661 bool dialog_was_suppressed,
4635 bool success, 4662 bool success,
4636 const base::string16& user_input) { 4663 const base::string16& user_input) {
4637 RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(render_process_id, 4664 RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(render_process_id,
4638 render_frame_id); 4665 render_frame_id);
4639 last_dialog_suppressed_ = dialog_was_suppressed; 4666 last_dialog_suppressed_ = dialog_was_suppressed;
4640 4667
4641 if (is_showing_before_unload_dialog_ && !success) { 4668 if (is_showing_before_unload_dialog_ && !success) {
4642 // If a beforeunload dialog is canceled, we need to stop the throbber from
4643 // spinning, since we forced it to start spinning in Navigate.
4644 if (rfh) 4669 if (rfh)
4645 DidStopLoading(); 4670 rfh->frame_tree_node()->BeforeUnloadCanceled();
4646 controller_.DiscardNonCommittedEntries(); 4671 controller_.DiscardNonCommittedEntries();
4647 4672
4648 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 4673 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
4649 BeforeUnloadDialogCancelled()); 4674 BeforeUnloadDialogCancelled());
4650 } 4675 }
4651 4676
4652 is_showing_before_unload_dialog_ = false; 4677 is_showing_before_unload_dialog_ = false;
4653 if (rfh) { 4678 if (rfh) {
4654 rfh->JavaScriptDialogClosed(reply_msg, success, user_input, 4679 rfh->JavaScriptDialogClosed(reply_msg, success, user_input,
4655 dialog_was_suppressed); 4680 dialog_was_suppressed);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
4761 const WebContentsObserver::MediaPlayerId& id) { 4786 const WebContentsObserver::MediaPlayerId& id) {
4762 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); 4787 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id));
4763 } 4788 }
4764 4789
4765 void WebContentsImpl::MediaStoppedPlaying( 4790 void WebContentsImpl::MediaStoppedPlaying(
4766 const WebContentsObserver::MediaPlayerId& id) { 4791 const WebContentsObserver::MediaPlayerId& id) {
4767 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); 4792 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id));
4768 } 4793 }
4769 4794
4770 } // namespace content 4795 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/browser/web_contents/web_contents_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698