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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
222 | 222 |
223 void SetAccessibilityModeOnFrame(AccessibilityMode mode, | 223 void SetAccessibilityModeOnFrame(AccessibilityMode mode, |
224 RenderFrameHost* frame_host) { | 224 RenderFrameHost* frame_host) { |
225 static_cast<RenderFrameHostImpl*>(frame_host)->SetAccessibilityMode(mode); | 225 static_cast<RenderFrameHostImpl*>(frame_host)->SetAccessibilityMode(mode); |
226 } | 226 } |
227 | 227 |
228 void ResetAccessibility(RenderFrameHost* rfh) { | 228 void ResetAccessibility(RenderFrameHost* rfh) { |
229 static_cast<RenderFrameHostImpl*>(rfh)->AccessibilityReset(); | 229 static_cast<RenderFrameHostImpl*>(rfh)->AccessibilityReset(); |
230 } | 230 } |
231 | 231 |
232 bool NotifyRenderViewTerminated(RenderViewHostImpl* rvh, FrameTreeNode* ftn) { | |
233 ftn->RenderViewTerminated(rvh); | |
234 return true; | |
235 } | |
236 | |
232 } // namespace | 237 } // namespace |
233 | 238 |
234 WebContents* WebContents::Create(const WebContents::CreateParams& params) { | 239 WebContents* WebContents::Create(const WebContents::CreateParams& params) { |
235 FrameTreeNode* opener_node = nullptr; | 240 FrameTreeNode* opener_node = nullptr; |
236 if (params.opener_render_frame_id != MSG_ROUTING_NONE) { | 241 if (params.opener_render_frame_id != MSG_ROUTING_NONE) { |
237 RenderFrameHostImpl* opener_rfh = RenderFrameHostImpl::FromID( | 242 RenderFrameHostImpl* opener_rfh = RenderFrameHostImpl::FromID( |
238 params.opener_render_process_id, params.opener_render_frame_id); | 243 params.opener_render_process_id, params.opener_render_frame_id); |
239 if (opener_rfh) | 244 if (opener_rfh) |
240 opener_node = opener_rfh->frame_tree_node(); | 245 opener_node = opener_rfh->frame_tree_node(); |
241 } | 246 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
366 render_view_host_delegate_view_(NULL), | 371 render_view_host_delegate_view_(NULL), |
367 created_with_opener_(false), | 372 created_with_opener_(false), |
368 #if defined(OS_WIN) | 373 #if defined(OS_WIN) |
369 accessible_parent_(NULL), | 374 accessible_parent_(NULL), |
370 #endif | 375 #endif |
371 frame_tree_(new NavigatorImpl(&controller_, this), | 376 frame_tree_(new NavigatorImpl(&controller_, this), |
372 this, | 377 this, |
373 this, | 378 this, |
374 this, | 379 this, |
375 this), | 380 this), |
376 is_loading_(false), | |
377 is_load_to_different_document_(false), | 381 is_load_to_different_document_(false), |
378 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 382 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
379 crashed_error_code_(0), | 383 crashed_error_code_(0), |
380 waiting_for_response_(false), | 384 waiting_for_response_(false), |
381 load_state_(net::LOAD_STATE_IDLE, base::string16()), | 385 load_state_(net::LOAD_STATE_IDLE, base::string16()), |
382 upload_size_(0), | 386 upload_size_(0), |
383 upload_position_(0), | 387 upload_position_(0), |
384 is_resume_pending_(false), | 388 is_resume_pending_(false), |
389 pause_throbber_for_interstitial_(false), | |
385 displayed_insecure_content_(false), | 390 displayed_insecure_content_(false), |
386 has_accessed_initial_document_(false), | 391 has_accessed_initial_document_(false), |
387 theme_color_(SK_ColorTRANSPARENT), | 392 theme_color_(SK_ColorTRANSPARENT), |
388 last_sent_theme_color_(SK_ColorTRANSPARENT), | 393 last_sent_theme_color_(SK_ColorTRANSPARENT), |
389 did_first_visually_non_empty_paint_(false), | 394 did_first_visually_non_empty_paint_(false), |
390 capturer_count_(0), | 395 capturer_count_(0), |
391 should_normally_be_visible_(true), | 396 should_normally_be_visible_(true), |
392 is_being_destroyed_(false), | 397 is_being_destroyed_(false), |
393 notify_disconnection_(false), | 398 notify_disconnection_(false), |
394 dialog_manager_(NULL), | 399 dialog_manager_(NULL), |
395 is_showing_before_unload_dialog_(false), | 400 is_showing_before_unload_dialog_(false), |
396 last_active_time_(base::TimeTicks::Now()), | 401 last_active_time_(base::TimeTicks::Now()), |
397 closed_by_user_gesture_(false), | 402 closed_by_user_gesture_(false), |
398 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), | 403 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), |
399 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), | 404 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), |
400 zoom_scroll_remainder_(0), | 405 zoom_scroll_remainder_(0), |
401 render_view_message_source_(NULL), | 406 render_view_message_source_(NULL), |
402 render_frame_message_source_(NULL), | 407 render_frame_message_source_(NULL), |
403 fullscreen_widget_routing_id_(MSG_ROUTING_NONE), | 408 fullscreen_widget_routing_id_(MSG_ROUTING_NONE), |
404 fullscreen_widget_had_focus_at_shutdown_(false), | 409 fullscreen_widget_had_focus_at_shutdown_(false), |
405 is_subframe_(false), | 410 is_subframe_(false), |
406 force_disable_overscroll_content_(false), | 411 force_disable_overscroll_content_(false), |
407 last_dialog_suppressed_(false), | 412 last_dialog_suppressed_(false), |
408 geolocation_service_context_(new GeolocationServiceContext()), | 413 geolocation_service_context_(new GeolocationServiceContext()), |
409 accessibility_mode_( | 414 accessibility_mode_(BrowserAccessibilityStateImpl::GetInstance() |
410 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), | 415 ->accessibility_mode()), |
411 audio_stream_monitor_(this), | 416 audio_stream_monitor_(this), |
412 virtual_keyboard_requested_(false), | 417 virtual_keyboard_requested_(false), |
413 page_scale_factor_is_one_(true), | 418 page_scale_factor_is_one_(true), |
414 loading_weak_factory_(this) { | 419 loading_weak_factory_(this) { |
415 frame_tree_.SetFrameRemoveListener( | 420 frame_tree_.SetFrameRemoveListener( |
416 base::Bind(&WebContentsImpl::OnFrameRemoved, | 421 base::Bind(&WebContentsImpl::OnFrameRemoved, |
417 base::Unretained(this))); | 422 base::Unretained(this))); |
418 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); | 423 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); |
419 wake_lock_service_context_.reset(new WakeLockServiceContext(this)); | 424 wake_lock_service_context_.reset(new WakeLockServiceContext(this)); |
420 } | 425 } |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
886 renderer_preferences_.user_agent_override = override; | 891 renderer_preferences_.user_agent_override = override; |
887 | 892 |
888 // Send the new override string to the renderer. | 893 // Send the new override string to the renderer. |
889 RenderViewHost* host = GetRenderViewHost(); | 894 RenderViewHost* host = GetRenderViewHost(); |
890 if (host) | 895 if (host) |
891 host->SyncRendererPrefs(); | 896 host->SyncRendererPrefs(); |
892 | 897 |
893 // 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 |
894 // different parts of the page loaded using different user agents. | 899 // different parts of the page loaded using different user agents. |
895 NavigationEntry* entry = controller_.GetVisibleEntry(); | 900 NavigationEntry* entry = controller_.GetVisibleEntry(); |
896 if (is_loading_ && entry != NULL && entry->GetIsOverridingUserAgent()) | 901 if (IsLoading() && entry != NULL && entry->GetIsOverridingUserAgent()) |
897 controller_.ReloadIgnoringCache(true); | 902 controller_.ReloadIgnoringCache(true); |
898 | 903 |
899 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 904 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
900 UserAgentOverrideSet(override)); | 905 UserAgentOverrideSet(override)); |
901 } | 906 } |
902 | 907 |
903 const std::string& WebContentsImpl::GetUserAgentOverride() const { | 908 const std::string& WebContentsImpl::GetUserAgentOverride() const { |
904 return renderer_preferences_.user_agent_override; | 909 return renderer_preferences_.user_agent_override; |
905 } | 910 } |
906 | 911 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1024 | 1029 |
1025 SiteInstanceImpl* WebContentsImpl::GetPendingSiteInstance() const { | 1030 SiteInstanceImpl* WebContentsImpl::GetPendingSiteInstance() const { |
1026 RenderViewHostImpl* dest_rvh = | 1031 RenderViewHostImpl* dest_rvh = |
1027 GetRenderManager()->pending_render_view_host() ? | 1032 GetRenderManager()->pending_render_view_host() ? |
1028 GetRenderManager()->pending_render_view_host() : | 1033 GetRenderManager()->pending_render_view_host() : |
1029 GetRenderManager()->current_host(); | 1034 GetRenderManager()->current_host(); |
1030 return dest_rvh->GetSiteInstance(); | 1035 return dest_rvh->GetSiteInstance(); |
1031 } | 1036 } |
1032 | 1037 |
1033 bool WebContentsImpl::IsLoading() const { | 1038 bool WebContentsImpl::IsLoading() const { |
1034 return is_loading_; | 1039 return frame_tree_.IsLoading() && !pause_throbber_for_interstitial_; |
nasko
2016/01/15 01:19:16
I still think the page is in loading state, even i
clamy
2016/01/15 16:47:44
I'm just matching the current behavior here. When
| |
1035 } | 1040 } |
1036 | 1041 |
1037 bool WebContentsImpl::IsLoadingToDifferentDocument() const { | 1042 bool WebContentsImpl::IsLoadingToDifferentDocument() const { |
1038 return is_loading_ && is_load_to_different_document_; | 1043 return IsLoading() && is_load_to_different_document_; |
1039 } | 1044 } |
1040 | 1045 |
1041 bool WebContentsImpl::IsWaitingForResponse() const { | 1046 bool WebContentsImpl::IsWaitingForResponse() const { |
1042 return waiting_for_response_ && is_load_to_different_document_; | 1047 return waiting_for_response_ && is_load_to_different_document_; |
1043 } | 1048 } |
1044 | 1049 |
1045 const net::LoadStateWithParam& WebContentsImpl::GetLoadState() const { | 1050 const net::LoadStateWithParam& WebContentsImpl::GetLoadState() const { |
1046 return load_state_; | 1051 return load_state_; |
1047 } | 1052 } |
1048 | 1053 |
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2287 InterstitialPageImpl* interstitial_page) { | 2292 InterstitialPageImpl* interstitial_page) { |
2288 DCHECK(interstitial_page); | 2293 DCHECK(interstitial_page); |
2289 GetRenderManager()->set_interstitial_page(interstitial_page); | 2294 GetRenderManager()->set_interstitial_page(interstitial_page); |
2290 | 2295 |
2291 // 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 |
2292 // interstitial. | 2297 // interstitial. |
2293 CancelActiveAndPendingDialogs(); | 2298 CancelActiveAndPendingDialogs(); |
2294 | 2299 |
2295 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2300 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
2296 DidAttachInterstitialPage()); | 2301 DidAttachInterstitialPage()); |
2302 | |
2303 // Stop the throbber if needed while the interstitial page is shown. | |
2304 if (frame_tree_.IsLoading()) { | |
nasko
2016/01/15 01:19:16
What if it is already paused?
clamy
2016/01/15 16:47:44
Done.
| |
2305 LoadingStateChanged(false, true, NULL); | |
nasko
2016/01/15 01:19:16
nullptr
clamy
2016/01/15 16:47:44
Done.
| |
2306 } | |
2307 pause_throbber_for_interstitial_ = true; | |
nasko
2016/01/15 01:19:16
If this is state, then it should be "paused".
clamy
2016/01/15 16:47:44
Done.
| |
2308 } | |
2309 | |
2310 void WebContentsImpl::DidProceedOnIntertitial() { | |
2311 // Restart the throbber now that the interstitial page is going away. | |
2312 if (pause_throbber_for_interstitial_) { | |
2313 pause_throbber_for_interstitial_ = false; | |
2314 if (frame_tree_.IsLoading()) | |
2315 LoadingStateChanged(true, true, NULL); | |
2316 } | |
2297 } | 2317 } |
2298 | 2318 |
2299 void WebContentsImpl::DetachInterstitialPage() { | 2319 void WebContentsImpl::DetachInterstitialPage() { |
2300 if (ShowingInterstitialPage()) | 2320 if (ShowingInterstitialPage()) |
2301 GetRenderManager()->remove_interstitial_page(); | 2321 GetRenderManager()->remove_interstitial_page(); |
2302 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2322 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
2303 DidDetachInterstitialPage()); | 2323 DidDetachInterstitialPage()); |
2324 // Restart the throbber now that the interstitial page is going away. | |
2325 if (pause_throbber_for_interstitial_) { | |
nasko
2016/01/15 01:19:16
Looking at the usage here, isn't this equivalent t
clamy
2016/01/15 16:47:44
No if the user starts a new navigation, DidProceed
| |
2326 pause_throbber_for_interstitial_ = false; | |
2327 if (frame_tree_.IsLoading()) | |
2328 LoadingStateChanged(true, true, NULL); | |
2329 } | |
2304 } | 2330 } |
2305 | 2331 |
2306 void WebContentsImpl::SetHistoryOffsetAndLength(int history_offset, | 2332 void WebContentsImpl::SetHistoryOffsetAndLength(int history_offset, |
2307 int history_length) { | 2333 int history_length) { |
2308 SetHistoryOffsetAndLengthForView( | 2334 SetHistoryOffsetAndLengthForView( |
2309 GetRenderViewHost(), history_offset, history_length); | 2335 GetRenderViewHost(), history_offset, history_length); |
2310 } | 2336 } |
2311 | 2337 |
2312 void WebContentsImpl::SetHistoryOffsetAndLengthForView( | 2338 void WebContentsImpl::SetHistoryOffsetAndLengthForView( |
2313 RenderViewHost* render_view_host, | 2339 RenderViewHost* render_view_host, |
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3568 if (delegate_) | 3594 if (delegate_) |
3569 delegate_->ShowRepostFormWarningDialog(this); | 3595 delegate_->ShowRepostFormWarningDialog(this); |
3570 } | 3596 } |
3571 | 3597 |
3572 bool WebContentsImpl::HasAccessedInitialDocument() { | 3598 bool WebContentsImpl::HasAccessedInitialDocument() { |
3573 return has_accessed_initial_document_; | 3599 return has_accessed_initial_document_; |
3574 } | 3600 } |
3575 | 3601 |
3576 // Notifies the RenderWidgetHost instance about the fact that the page is | 3602 // Notifies the RenderWidgetHost instance about the fact that the page is |
3577 // loading, or done loading. | 3603 // loading, or done loading. |
3578 void WebContentsImpl::SetIsLoading(bool is_loading, | 3604 void WebContentsImpl::LoadingStateChanged(bool is_loading, |
3579 bool to_different_document, | 3605 bool to_different_document, |
3580 LoadNotificationDetails* details) { | 3606 LoadNotificationDetails* details) { |
3581 if (is_loading == is_loading_) | 3607 // Do not send notifications about loading while the interstitial is showing. |
3608 if (pause_throbber_for_interstitial_) | |
3582 return; | 3609 return; |
3583 | 3610 |
3584 if (!is_loading) { | 3611 if (!is_loading) { |
3585 load_state_ = net::LoadStateWithParam(net::LOAD_STATE_IDLE, | 3612 load_state_ = net::LoadStateWithParam(net::LOAD_STATE_IDLE, |
3586 base::string16()); | 3613 base::string16()); |
3587 load_state_host_.clear(); | 3614 load_state_host_.clear(); |
3588 upload_size_ = 0; | 3615 upload_size_ = 0; |
3589 upload_position_ = 0; | 3616 upload_position_ = 0; |
3590 } | 3617 } |
3591 | 3618 |
3592 GetRenderManager()->SetIsLoading(is_loading); | 3619 GetRenderManager()->SetIsLoading(is_loading); |
3593 | 3620 |
3594 is_loading_ = is_loading; | |
3595 waiting_for_response_ = is_loading; | 3621 waiting_for_response_ = is_loading; |
3596 is_load_to_different_document_ = to_different_document; | 3622 is_load_to_different_document_ = to_different_document; |
3597 | 3623 |
3598 if (delegate_) | 3624 if (delegate_) |
3599 delegate_->LoadingStateChanged(this, to_different_document); | 3625 delegate_->LoadingStateChanged(this, to_different_document); |
3600 NotifyNavigationStateChanged(INVALIDATE_TYPE_LOAD); | 3626 NotifyNavigationStateChanged(INVALIDATE_TYPE_LOAD); |
3601 | 3627 |
3602 std::string url = (details ? details->url.possibly_invalid_spec() : "NULL"); | 3628 std::string url = (details ? details->url.possibly_invalid_spec() : "NULL"); |
3603 if (is_loading) { | 3629 if (is_loading) { |
3604 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... | |
3937 // renderer may not have made a clean exit. | 3963 // renderer may not have made a clean exit. |
3938 if (IsFullscreenForCurrentTab(GetRenderViewHost()->GetWidget())) | 3964 if (IsFullscreenForCurrentTab(GetRenderViewHost()->GetWidget())) |
3939 ExitFullscreenMode(); | 3965 ExitFullscreenMode(); |
3940 | 3966 |
3941 // 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. |
3942 CancelActiveAndPendingDialogs(); | 3968 CancelActiveAndPendingDialogs(); |
3943 | 3969 |
3944 if (delegate_) | 3970 if (delegate_) |
3945 delegate_->HideValidationMessage(this); | 3971 delegate_->HideValidationMessage(this); |
3946 | 3972 |
3947 SetIsLoading(false, true, nullptr); | 3973 frame_tree_.ForEach(base::Bind(&NotifyRenderViewTerminated, |
3974 static_cast<RenderViewHostImpl*>(rvh))); | |
nasko
2016/01/15 01:19:16
This method (RenderViewTerminated) is called when
clamy
2016/01/15 16:47:44
Done.
| |
3948 NotifyDisconnected(); | 3975 NotifyDisconnected(); |
3949 SetIsCrashed(status, error_code); | 3976 SetIsCrashed(status, error_code); |
3950 | 3977 |
3951 // Reset the loading progress. TODO(avi): What does it mean to have a | |
3952 // "renderer crash" when there is more than one renderer process serving a | |
3953 // webpage? Once this function is called at a more granular frame level, we | |
3954 // probably will need to more granularly reset the state here. | |
3955 ResetLoadProgressState(); | |
3956 | |
3957 FOR_EACH_OBSERVER(WebContentsObserver, | 3978 FOR_EACH_OBSERVER(WebContentsObserver, |
3958 observers_, | 3979 observers_, |
3959 RenderProcessGone(GetCrashedStatus())); | 3980 RenderProcessGone(GetCrashedStatus())); |
3960 } | 3981 } |
3961 | 3982 |
3962 void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) { | 3983 void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) { |
3963 FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh)); | 3984 FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh)); |
3964 } | 3985 } |
3965 | 3986 |
3966 void WebContentsImpl::UpdateState(RenderViewHost* rvh, | 3987 void WebContentsImpl::UpdateState(RenderViewHost* rvh, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4039 delegate_->SwappedOut(this); | 4060 delegate_->SwappedOut(this); |
4040 } | 4061 } |
4041 | 4062 |
4042 void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { | 4063 void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { |
4043 if (delegate_ && delegate_->IsPopupOrPanel(this)) | 4064 if (delegate_ && delegate_->IsPopupOrPanel(this)) |
4044 delegate_->MoveContents(this, new_bounds); | 4065 delegate_->MoveContents(this, new_bounds); |
4045 } | 4066 } |
4046 | 4067 |
4047 void WebContentsImpl::DidStartLoading(FrameTreeNode* frame_tree_node, | 4068 void WebContentsImpl::DidStartLoading(FrameTreeNode* frame_tree_node, |
4048 bool to_different_document) { | 4069 bool to_different_document) { |
4049 SetIsLoading(true, to_different_document, nullptr); | 4070 LoadingStateChanged(true, to_different_document, nullptr); |
4050 | 4071 |
4051 // Notify accessibility that the user is navigating away from the | 4072 // Notify accessibility that the user is navigating away from the |
4052 // current document. | 4073 // current document. |
4053 // | 4074 // |
4054 // TODO(dmazzoni): do this using a WebContentsObserver. | 4075 // TODO(dmazzoni): do this using a WebContentsObserver. |
4055 BrowserAccessibilityManager* manager = | 4076 BrowserAccessibilityManager* manager = |
4056 frame_tree_node->current_frame_host()->browser_accessibility_manager(); | 4077 frame_tree_node->current_frame_host()->browser_accessibility_manager(); |
4057 if (manager) | 4078 if (manager) |
4058 manager->UserIsNavigatingAway(); | 4079 manager->UserIsNavigatingAway(); |
4059 } | 4080 } |
(...skipping 13 matching lines...) Expand all Loading... | |
4073 base::TimeTicks::Now() - navigator->GetCurrentLoadStart(); | 4094 base::TimeTicks::Now() - navigator->GetCurrentLoadStart(); |
4074 | 4095 |
4075 details.reset(new LoadNotificationDetails( | 4096 details.reset(new LoadNotificationDetails( |
4076 entry->GetVirtualURL(), | 4097 entry->GetVirtualURL(), |
4077 entry->GetTransitionType(), | 4098 entry->GetTransitionType(), |
4078 elapsed, | 4099 elapsed, |
4079 &controller_, | 4100 &controller_, |
4080 controller_.GetCurrentEntryIndex())); | 4101 controller_.GetCurrentEntryIndex())); |
4081 } | 4102 } |
4082 | 4103 |
4083 SetIsLoading(false, true, details.get()); | 4104 LoadingStateChanged(false, true, details.get()); |
4084 } | 4105 } |
4085 | 4106 |
4086 void WebContentsImpl::DidChangeLoadProgress() { | 4107 void WebContentsImpl::DidChangeLoadProgress() { |
4087 double load_progress = frame_tree_.load_progress(); | 4108 double load_progress = frame_tree_.load_progress(); |
4088 | 4109 |
4089 // The delegate is notified immediately for the first and last updates. Also, | 4110 // The delegate is notified immediately for the first and last updates. Also, |
4090 // since the message loop may be pretty busy when a page is loaded, it might | 4111 // since the message loop may be pretty busy when a page is loaded, it might |
4091 // not execute a posted task in a timely manner so the progress report is sent | 4112 // not execute a posted task in a timely manner so the progress report is sent |
4092 // immediately if enough time has passed. | 4113 // immediately if enough time has passed. |
4093 base::TimeDelta min_delay = | 4114 base::TimeDelta min_delay = |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4610 int render_frame_id, | 4631 int render_frame_id, |
4611 IPC::Message* reply_msg, | 4632 IPC::Message* reply_msg, |
4612 bool dialog_was_suppressed, | 4633 bool dialog_was_suppressed, |
4613 bool success, | 4634 bool success, |
4614 const base::string16& user_input) { | 4635 const base::string16& user_input) { |
4615 RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(render_process_id, | 4636 RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(render_process_id, |
4616 render_frame_id); | 4637 render_frame_id); |
4617 last_dialog_suppressed_ = dialog_was_suppressed; | 4638 last_dialog_suppressed_ = dialog_was_suppressed; |
4618 | 4639 |
4619 if (is_showing_before_unload_dialog_ && !success) { | 4640 if (is_showing_before_unload_dialog_ && !success) { |
4620 // If a beforeunload dialog is canceled, we need to stop the throbber from | |
4621 // spinning, since we forced it to start spinning in Navigate. | |
4622 if (rfh) | 4641 if (rfh) |
4623 DidStopLoading(); | 4642 rfh->frame_tree_node()->BeforeUnloadCanceled(); |
4624 controller_.DiscardNonCommittedEntries(); | 4643 controller_.DiscardNonCommittedEntries(); |
4625 | 4644 |
4626 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 4645 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
4627 BeforeUnloadDialogCancelled()); | 4646 BeforeUnloadDialogCancelled()); |
4628 } | 4647 } |
4629 | 4648 |
4630 is_showing_before_unload_dialog_ = false; | 4649 is_showing_before_unload_dialog_ = false; |
4631 if (rfh) { | 4650 if (rfh) { |
4632 rfh->JavaScriptDialogClosed(reply_msg, success, user_input, | 4651 rfh->JavaScriptDialogClosed(reply_msg, success, user_input, |
4633 dialog_was_suppressed); | 4652 dialog_was_suppressed); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4739 const WebContentsObserver::MediaPlayerId& id) { | 4758 const WebContentsObserver::MediaPlayerId& id) { |
4740 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); | 4759 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); |
4741 } | 4760 } |
4742 | 4761 |
4743 void WebContentsImpl::MediaStoppedPlaying( | 4762 void WebContentsImpl::MediaStoppedPlaying( |
4744 const WebContentsObserver::MediaPlayerId& id) { | 4763 const WebContentsObserver::MediaPlayerId& id) { |
4745 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); | 4764 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); |
4746 } | 4765 } |
4747 | 4766 |
4748 } // namespace content | 4767 } // namespace content |
OLD | NEW |