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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 367 render_view_host_delegate_view_(NULL), | 367 render_view_host_delegate_view_(NULL), |
| 368 created_with_opener_(false), | 368 created_with_opener_(false), |
| 369 #if defined(OS_WIN) | 369 #if defined(OS_WIN) |
| 370 accessible_parent_(NULL), | 370 accessible_parent_(NULL), |
| 371 #endif | 371 #endif |
| 372 frame_tree_(new NavigatorImpl(&controller_, this), | 372 frame_tree_(new NavigatorImpl(&controller_, this), |
| 373 this, | 373 this, |
| 374 this, | 374 this, |
| 375 this, | 375 this, |
| 376 this), | 376 this), |
| 377 is_loading_(false), | |
| 378 is_load_to_different_document_(false), | 377 is_load_to_different_document_(false), |
| 379 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 378 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
| 380 crashed_error_code_(0), | 379 crashed_error_code_(0), |
| 381 waiting_for_response_(false), | 380 waiting_for_response_(false), |
| 382 load_state_(net::LOAD_STATE_IDLE, base::string16()), | 381 load_state_(net::LOAD_STATE_IDLE, base::string16()), |
| 383 upload_size_(0), | 382 upload_size_(0), |
| 384 upload_position_(0), | 383 upload_position_(0), |
| 385 is_resume_pending_(false), | 384 is_resume_pending_(false), |
| 385 paused_throbber_for_interstitial_(false), | |
| 386 displayed_insecure_content_(false), | 386 displayed_insecure_content_(false), |
| 387 has_accessed_initial_document_(false), | 387 has_accessed_initial_document_(false), |
| 388 theme_color_(SK_ColorTRANSPARENT), | 388 theme_color_(SK_ColorTRANSPARENT), |
| 389 last_sent_theme_color_(SK_ColorTRANSPARENT), | 389 last_sent_theme_color_(SK_ColorTRANSPARENT), |
| 390 did_first_visually_non_empty_paint_(false), | 390 did_first_visually_non_empty_paint_(false), |
| 391 capturer_count_(0), | 391 capturer_count_(0), |
| 392 should_normally_be_visible_(true), | 392 should_normally_be_visible_(true), |
| 393 is_being_destroyed_(false), | 393 is_being_destroyed_(false), |
| 394 notify_disconnection_(false), | 394 notify_disconnection_(false), |
| 395 dialog_manager_(NULL), | 395 dialog_manager_(NULL), |
| 396 is_showing_before_unload_dialog_(false), | 396 is_showing_before_unload_dialog_(false), |
| 397 last_active_time_(base::TimeTicks::Now()), | 397 last_active_time_(base::TimeTicks::Now()), |
| 398 closed_by_user_gesture_(false), | 398 closed_by_user_gesture_(false), |
| 399 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), | 399 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), |
| 400 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), | 400 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), |
| 401 zoom_scroll_remainder_(0), | 401 zoom_scroll_remainder_(0), |
| 402 render_view_message_source_(NULL), | 402 render_view_message_source_(NULL), |
| 403 render_frame_message_source_(NULL), | 403 render_frame_message_source_(NULL), |
| 404 fullscreen_widget_routing_id_(MSG_ROUTING_NONE), | 404 fullscreen_widget_routing_id_(MSG_ROUTING_NONE), |
| 405 fullscreen_widget_had_focus_at_shutdown_(false), | 405 fullscreen_widget_had_focus_at_shutdown_(false), |
| 406 is_subframe_(false), | 406 is_subframe_(false), |
| 407 force_disable_overscroll_content_(false), | 407 force_disable_overscroll_content_(false), |
| 408 last_dialog_suppressed_(false), | 408 last_dialog_suppressed_(false), |
| 409 geolocation_service_context_(new GeolocationServiceContext()), | 409 geolocation_service_context_(new GeolocationServiceContext()), |
| 410 accessibility_mode_( | 410 accessibility_mode_(BrowserAccessibilityStateImpl::GetInstance() |
| 411 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), | 411 ->accessibility_mode()), |
| 412 audio_stream_monitor_(this), | 412 audio_stream_monitor_(this), |
| 413 virtual_keyboard_requested_(false), | 413 virtual_keyboard_requested_(false), |
| 414 page_scale_factor_is_one_(true), | 414 page_scale_factor_is_one_(true), |
| 415 loading_weak_factory_(this) { | 415 loading_weak_factory_(this) { |
| 416 frame_tree_.SetFrameRemoveListener( | 416 frame_tree_.SetFrameRemoveListener( |
| 417 base::Bind(&WebContentsImpl::OnFrameRemoved, | 417 base::Bind(&WebContentsImpl::OnFrameRemoved, |
| 418 base::Unretained(this))); | 418 base::Unretained(this))); |
| 419 #if defined(OS_ANDROID) | 419 #if defined(OS_ANDROID) |
| 420 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); | 420 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); |
| 421 #else | 421 #else |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 891 renderer_preferences_.user_agent_override = override; | 891 renderer_preferences_.user_agent_override = override; |
| 892 | 892 |
| 893 // Send the new override string to the renderer. | 893 // Send the new override string to the renderer. |
| 894 RenderViewHost* host = GetRenderViewHost(); | 894 RenderViewHost* host = GetRenderViewHost(); |
| 895 if (host) | 895 if (host) |
| 896 host->SyncRendererPrefs(); | 896 host->SyncRendererPrefs(); |
| 897 | 897 |
| 898 // Reload the page if a load is currently in progress to avoid having | 898 // Reload the page if a load is currently in progress to avoid having |
| 899 // different parts of the page loaded using different user agents. | 899 // different parts of the page loaded using different user agents. |
| 900 NavigationEntry* entry = controller_.GetVisibleEntry(); | 900 NavigationEntry* entry = controller_.GetVisibleEntry(); |
| 901 if (is_loading_ && entry != NULL && entry->GetIsOverridingUserAgent()) | 901 if (IsLoading() && entry != NULL && entry->GetIsOverridingUserAgent()) |
| 902 controller_.ReloadIgnoringCache(true); | 902 controller_.ReloadIgnoringCache(true); |
| 903 | 903 |
| 904 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 904 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 905 UserAgentOverrideSet(override)); | 905 UserAgentOverrideSet(override)); |
| 906 } | 906 } |
| 907 | 907 |
| 908 const std::string& WebContentsImpl::GetUserAgentOverride() const { | 908 const std::string& WebContentsImpl::GetUserAgentOverride() const { |
| 909 return renderer_preferences_.user_agent_override; | 909 return renderer_preferences_.user_agent_override; |
| 910 } | 910 } |
| 911 | 911 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1029 | 1029 |
| 1030 SiteInstanceImpl* WebContentsImpl::GetPendingSiteInstance() const { | 1030 SiteInstanceImpl* WebContentsImpl::GetPendingSiteInstance() const { |
| 1031 RenderViewHostImpl* dest_rvh = | 1031 RenderViewHostImpl* dest_rvh = |
| 1032 GetRenderManager()->pending_render_view_host() ? | 1032 GetRenderManager()->pending_render_view_host() ? |
| 1033 GetRenderManager()->pending_render_view_host() : | 1033 GetRenderManager()->pending_render_view_host() : |
| 1034 GetRenderManager()->current_host(); | 1034 GetRenderManager()->current_host(); |
| 1035 return dest_rvh->GetSiteInstance(); | 1035 return dest_rvh->GetSiteInstance(); |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 bool WebContentsImpl::IsLoading() const { | 1038 bool WebContentsImpl::IsLoading() const { |
| 1039 return is_loading_; | 1039 return frame_tree_.IsLoading() && !paused_throbber_for_interstitial_; |
| 1040 } | 1040 } |
| 1041 | 1041 |
| 1042 bool WebContentsImpl::IsLoadingToDifferentDocument() const { | 1042 bool WebContentsImpl::IsLoadingToDifferentDocument() const { |
| 1043 return is_loading_ && is_load_to_different_document_; | 1043 return IsLoading() && is_load_to_different_document_; |
| 1044 } | 1044 } |
| 1045 | 1045 |
| 1046 bool WebContentsImpl::IsWaitingForResponse() const { | 1046 bool WebContentsImpl::IsWaitingForResponse() const { |
| 1047 return waiting_for_response_ && is_load_to_different_document_; | 1047 return waiting_for_response_ && is_load_to_different_document_; |
| 1048 } | 1048 } |
| 1049 | 1049 |
| 1050 const net::LoadStateWithParam& WebContentsImpl::GetLoadState() const { | 1050 const net::LoadStateWithParam& WebContentsImpl::GetLoadState() const { |
| 1051 return load_state_; | 1051 return load_state_; |
| 1052 } | 1052 } |
| 1053 | 1053 |
| (...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2292 InterstitialPageImpl* interstitial_page) { | 2292 InterstitialPageImpl* interstitial_page) { |
| 2293 DCHECK(interstitial_page); | 2293 DCHECK(interstitial_page); |
| 2294 GetRenderManager()->set_interstitial_page(interstitial_page); | 2294 GetRenderManager()->set_interstitial_page(interstitial_page); |
| 2295 | 2295 |
| 2296 // Cancel any visible dialogs so that they don't interfere with the | 2296 // Cancel any visible dialogs so that they don't interfere with the |
| 2297 // interstitial. | 2297 // interstitial. |
| 2298 CancelActiveAndPendingDialogs(); | 2298 CancelActiveAndPendingDialogs(); |
| 2299 | 2299 |
| 2300 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2300 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2301 DidAttachInterstitialPage()); | 2301 DidAttachInterstitialPage()); |
| 2302 | |
| 2303 // Stop the throbber if needed while the interstitial page is shown. | |
| 2304 if (IsLoading()) { | |
|
nasko
2016/01/16 00:13:51
No need for {} in one line if statements.
clamy
2016/01/19 13:31:18
Done.
| |
| 2305 LoadingStateChanged(false, true, nullptr); | |
| 2306 } | |
| 2307 paused_throbber_for_interstitial_ = true; | |
| 2308 } | |
| 2309 | |
| 2310 void WebContentsImpl::DidProceedOnInterstitial() { | |
| 2311 // Restart the throbber now that the interstitial page is going away. | |
| 2312 if (paused_throbber_for_interstitial_) { | |
| 2313 paused_throbber_for_interstitial_ = false; | |
| 2314 if (frame_tree_.IsLoading()) | |
| 2315 LoadingStateChanged(true, true, NULL); | |
|
nasko
2016/01/16 00:13:51
nullptr in all new code.
clamy
2016/01/19 13:31:18
Done.
| |
| 2316 } | |
| 2302 } | 2317 } |
| 2303 | 2318 |
| 2304 void WebContentsImpl::DetachInterstitialPage() { | 2319 void WebContentsImpl::DetachInterstitialPage() { |
| 2305 if (ShowingInterstitialPage()) | 2320 if (ShowingInterstitialPage()) |
| 2306 GetRenderManager()->remove_interstitial_page(); | 2321 GetRenderManager()->remove_interstitial_page(); |
| 2307 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2322 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2308 DidDetachInterstitialPage()); | 2323 DidDetachInterstitialPage()); |
| 2324 // Restart the throbber now that the interstitial page is going away. | |
| 2325 if (paused_throbber_for_interstitial_) { | |
| 2326 paused_throbber_for_interstitial_ = false; | |
| 2327 if (frame_tree_.IsLoading()) | |
| 2328 LoadingStateChanged(true, true, NULL); | |
|
nasko
2016/01/16 00:13:51
nullptr in all new code.
clamy
2016/01/19 13:31:18
Done.
| |
| 2329 } | |
| 2309 } | 2330 } |
| 2310 | 2331 |
| 2311 void WebContentsImpl::SetHistoryOffsetAndLength(int history_offset, | 2332 void WebContentsImpl::SetHistoryOffsetAndLength(int history_offset, |
| 2312 int history_length) { | 2333 int history_length) { |
| 2313 SetHistoryOffsetAndLengthForView( | 2334 SetHistoryOffsetAndLengthForView( |
| 2314 GetRenderViewHost(), history_offset, history_length); | 2335 GetRenderViewHost(), history_offset, history_length); |
| 2315 } | 2336 } |
| 2316 | 2337 |
| 2317 void WebContentsImpl::SetHistoryOffsetAndLengthForView( | 2338 void WebContentsImpl::SetHistoryOffsetAndLengthForView( |
| 2318 RenderViewHost* render_view_host, | 2339 RenderViewHost* render_view_host, |
| (...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3573 if (delegate_) | 3594 if (delegate_) |
| 3574 delegate_->ShowRepostFormWarningDialog(this); | 3595 delegate_->ShowRepostFormWarningDialog(this); |
| 3575 } | 3596 } |
| 3576 | 3597 |
| 3577 bool WebContentsImpl::HasAccessedInitialDocument() { | 3598 bool WebContentsImpl::HasAccessedInitialDocument() { |
| 3578 return has_accessed_initial_document_; | 3599 return has_accessed_initial_document_; |
| 3579 } | 3600 } |
| 3580 | 3601 |
| 3581 // Notifies the RenderWidgetHost instance about the fact that the page is | 3602 // Notifies the RenderWidgetHost instance about the fact that the page is |
| 3582 // loading, or done loading. | 3603 // loading, or done loading. |
| 3583 void WebContentsImpl::SetIsLoading(bool is_loading, | 3604 void WebContentsImpl::LoadingStateChanged(bool is_loading, |
| 3584 bool to_different_document, | 3605 bool to_different_document, |
| 3585 LoadNotificationDetails* details) { | 3606 LoadNotificationDetails* details) { |
| 3586 if (is_loading == is_loading_) | 3607 // Do not send notifications about loading while the interstitial is showing. |
| 3608 if (paused_throbber_for_interstitial_) | |
| 3587 return; | 3609 return; |
| 3588 | 3610 |
| 3589 if (!is_loading) { | 3611 if (!is_loading) { |
| 3590 load_state_ = net::LoadStateWithParam(net::LOAD_STATE_IDLE, | 3612 load_state_ = net::LoadStateWithParam(net::LOAD_STATE_IDLE, |
| 3591 base::string16()); | 3613 base::string16()); |
| 3592 load_state_host_.clear(); | 3614 load_state_host_.clear(); |
| 3593 upload_size_ = 0; | 3615 upload_size_ = 0; |
| 3594 upload_position_ = 0; | 3616 upload_position_ = 0; |
| 3595 } | 3617 } |
| 3596 | 3618 |
| 3597 GetRenderManager()->SetIsLoading(is_loading); | 3619 GetRenderManager()->SetIsLoading(is_loading); |
| 3598 | 3620 |
| 3599 is_loading_ = is_loading; | |
| 3600 waiting_for_response_ = is_loading; | 3621 waiting_for_response_ = is_loading; |
| 3601 is_load_to_different_document_ = to_different_document; | 3622 is_load_to_different_document_ = to_different_document; |
| 3602 | 3623 |
| 3603 if (delegate_) | 3624 if (delegate_) |
| 3604 delegate_->LoadingStateChanged(this, to_different_document); | 3625 delegate_->LoadingStateChanged(this, to_different_document); |
| 3605 NotifyNavigationStateChanged(INVALIDATE_TYPE_LOAD); | 3626 NotifyNavigationStateChanged(INVALIDATE_TYPE_LOAD); |
| 3606 | 3627 |
| 3607 std::string url = (details ? details->url.possibly_invalid_spec() : "NULL"); | 3628 std::string url = (details ? details->url.possibly_invalid_spec() : "NULL"); |
| 3608 if (is_loading) { | 3629 if (is_loading) { |
| 3609 TRACE_EVENT_ASYNC_BEGIN2("browser,navigation", "WebContentsImpl Loading", | 3630 TRACE_EVENT_ASYNC_BEGIN2("browser,navigation", "WebContentsImpl Loading", |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3942 // renderer may not have made a clean exit. | 3963 // renderer may not have made a clean exit. |
| 3943 if (IsFullscreenForCurrentTab(GetRenderViewHost()->GetWidget())) | 3964 if (IsFullscreenForCurrentTab(GetRenderViewHost()->GetWidget())) |
| 3944 ExitFullscreenMode(); | 3965 ExitFullscreenMode(); |
| 3945 | 3966 |
| 3946 // Cancel any visible dialogs so they are not left dangling over the sad tab. | 3967 // Cancel any visible dialogs so they are not left dangling over the sad tab. |
| 3947 CancelActiveAndPendingDialogs(); | 3968 CancelActiveAndPendingDialogs(); |
| 3948 | 3969 |
| 3949 if (delegate_) | 3970 if (delegate_) |
| 3950 delegate_->HideValidationMessage(this); | 3971 delegate_->HideValidationMessage(this); |
| 3951 | 3972 |
| 3952 SetIsLoading(false, true, nullptr); | |
| 3953 NotifyDisconnected(); | 3973 NotifyDisconnected(); |
| 3954 SetIsCrashed(status, error_code); | 3974 SetIsCrashed(status, error_code); |
| 3955 | 3975 |
| 3956 // Reset the loading progress. TODO(avi): What does it mean to have a | |
| 3957 // "renderer crash" when there is more than one renderer process serving a | |
| 3958 // webpage? Once this function is called at a more granular frame level, we | |
| 3959 // probably will need to more granularly reset the state here. | |
| 3960 ResetLoadProgressState(); | |
| 3961 | |
| 3962 FOR_EACH_OBSERVER(WebContentsObserver, | 3976 FOR_EACH_OBSERVER(WebContentsObserver, |
| 3963 observers_, | 3977 observers_, |
| 3964 RenderProcessGone(GetCrashedStatus())); | 3978 RenderProcessGone(GetCrashedStatus())); |
| 3965 } | 3979 } |
| 3966 | 3980 |
| 3967 void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) { | 3981 void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) { |
| 3968 FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh)); | 3982 FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh)); |
| 3969 } | 3983 } |
| 3970 | 3984 |
| 3971 void WebContentsImpl::UpdateState(RenderViewHost* rvh, | 3985 void WebContentsImpl::UpdateState(RenderViewHost* rvh, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4044 delegate_->SwappedOut(this); | 4058 delegate_->SwappedOut(this); |
| 4045 } | 4059 } |
| 4046 | 4060 |
| 4047 void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { | 4061 void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { |
| 4048 if (delegate_ && delegate_->IsPopupOrPanel(this)) | 4062 if (delegate_ && delegate_->IsPopupOrPanel(this)) |
| 4049 delegate_->MoveContents(this, new_bounds); | 4063 delegate_->MoveContents(this, new_bounds); |
| 4050 } | 4064 } |
| 4051 | 4065 |
| 4052 void WebContentsImpl::DidStartLoading(FrameTreeNode* frame_tree_node, | 4066 void WebContentsImpl::DidStartLoading(FrameTreeNode* frame_tree_node, |
| 4053 bool to_different_document) { | 4067 bool to_different_document) { |
| 4054 SetIsLoading(true, to_different_document, nullptr); | 4068 LoadingStateChanged(true, to_different_document, nullptr); |
| 4055 | 4069 |
| 4056 // Notify accessibility that the user is navigating away from the | 4070 // Notify accessibility that the user is navigating away from the |
| 4057 // current document. | 4071 // current document. |
| 4058 // | 4072 // |
| 4059 // TODO(dmazzoni): do this using a WebContentsObserver. | 4073 // TODO(dmazzoni): do this using a WebContentsObserver. |
| 4060 BrowserAccessibilityManager* manager = | 4074 BrowserAccessibilityManager* manager = |
| 4061 frame_tree_node->current_frame_host()->browser_accessibility_manager(); | 4075 frame_tree_node->current_frame_host()->browser_accessibility_manager(); |
| 4062 if (manager) | 4076 if (manager) |
| 4063 manager->UserIsNavigatingAway(); | 4077 manager->UserIsNavigatingAway(); |
| 4064 } | 4078 } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 4078 base::TimeTicks::Now() - navigator->GetCurrentLoadStart(); | 4092 base::TimeTicks::Now() - navigator->GetCurrentLoadStart(); |
| 4079 | 4093 |
| 4080 details.reset(new LoadNotificationDetails( | 4094 details.reset(new LoadNotificationDetails( |
| 4081 entry->GetVirtualURL(), | 4095 entry->GetVirtualURL(), |
| 4082 entry->GetTransitionType(), | 4096 entry->GetTransitionType(), |
| 4083 elapsed, | 4097 elapsed, |
| 4084 &controller_, | 4098 &controller_, |
| 4085 controller_.GetCurrentEntryIndex())); | 4099 controller_.GetCurrentEntryIndex())); |
| 4086 } | 4100 } |
| 4087 | 4101 |
| 4088 SetIsLoading(false, true, details.get()); | 4102 LoadingStateChanged(false, true, details.get()); |
| 4089 } | 4103 } |
| 4090 | 4104 |
| 4091 void WebContentsImpl::DidChangeLoadProgress() { | 4105 void WebContentsImpl::DidChangeLoadProgress() { |
| 4092 double load_progress = frame_tree_.load_progress(); | 4106 double load_progress = frame_tree_.load_progress(); |
| 4093 | 4107 |
| 4094 // The delegate is notified immediately for the first and last updates. Also, | 4108 // The delegate is notified immediately for the first and last updates. Also, |
| 4095 // since the message loop may be pretty busy when a page is loaded, it might | 4109 // since the message loop may be pretty busy when a page is loaded, it might |
| 4096 // not execute a posted task in a timely manner so the progress report is sent | 4110 // not execute a posted task in a timely manner so the progress report is sent |
| 4097 // immediately if enough time has passed. | 4111 // immediately if enough time has passed. |
| 4098 base::TimeDelta min_delay = | 4112 base::TimeDelta min_delay = |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4615 int render_frame_id, | 4629 int render_frame_id, |
| 4616 IPC::Message* reply_msg, | 4630 IPC::Message* reply_msg, |
| 4617 bool dialog_was_suppressed, | 4631 bool dialog_was_suppressed, |
| 4618 bool success, | 4632 bool success, |
| 4619 const base::string16& user_input) { | 4633 const base::string16& user_input) { |
| 4620 RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(render_process_id, | 4634 RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(render_process_id, |
| 4621 render_frame_id); | 4635 render_frame_id); |
| 4622 last_dialog_suppressed_ = dialog_was_suppressed; | 4636 last_dialog_suppressed_ = dialog_was_suppressed; |
| 4623 | 4637 |
| 4624 if (is_showing_before_unload_dialog_ && !success) { | 4638 if (is_showing_before_unload_dialog_ && !success) { |
| 4625 // If a beforeunload dialog is canceled, we need to stop the throbber from | |
| 4626 // spinning, since we forced it to start spinning in Navigate. | |
| 4627 if (rfh) | 4639 if (rfh) |
| 4628 DidStopLoading(); | 4640 rfh->frame_tree_node()->BeforeUnloadCanceled(); |
|
nasko
2016/01/16 00:13:51
I wonder if this is the right place to dispatch th
clamy
2016/01/19 13:31:18
As explained in the other comments about BeforeUnl
| |
| 4629 controller_.DiscardNonCommittedEntries(); | 4641 controller_.DiscardNonCommittedEntries(); |
| 4630 | 4642 |
| 4631 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 4643 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 4632 BeforeUnloadDialogCancelled()); | 4644 BeforeUnloadDialogCancelled()); |
| 4633 } | 4645 } |
| 4634 | 4646 |
| 4635 is_showing_before_unload_dialog_ = false; | 4647 is_showing_before_unload_dialog_ = false; |
| 4636 if (rfh) { | 4648 if (rfh) { |
| 4637 rfh->JavaScriptDialogClosed(reply_msg, success, user_input, | 4649 rfh->JavaScriptDialogClosed(reply_msg, success, user_input, |
| 4638 dialog_was_suppressed); | 4650 dialog_was_suppressed); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4744 const WebContentsObserver::MediaPlayerId& id) { | 4756 const WebContentsObserver::MediaPlayerId& id) { |
| 4745 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); | 4757 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); |
| 4746 } | 4758 } |
| 4747 | 4759 |
| 4748 void WebContentsImpl::MediaStoppedPlaying( | 4760 void WebContentsImpl::MediaStoppedPlaying( |
| 4749 const WebContentsObserver::MediaPlayerId& id) { | 4761 const WebContentsObserver::MediaPlayerId& id) { |
| 4750 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); | 4762 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); |
| 4751 } | 4763 } |
| 4752 | 4764 |
| 4753 } // namespace content | 4765 } // namespace content |
| OLD | NEW |