| 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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 3075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3086 is_loading_ = is_loading; | 3086 is_loading_ = is_loading; |
| 3087 waiting_for_response_ = is_loading; | 3087 waiting_for_response_ = is_loading; |
| 3088 is_load_to_different_document_ = to_different_document; | 3088 is_load_to_different_document_ = to_different_document; |
| 3089 | 3089 |
| 3090 if (delegate_) | 3090 if (delegate_) |
| 3091 delegate_->LoadingStateChanged(this, to_different_document); | 3091 delegate_->LoadingStateChanged(this, to_different_document); |
| 3092 NotifyNavigationStateChanged(INVALIDATE_TYPE_LOAD); | 3092 NotifyNavigationStateChanged(INVALIDATE_TYPE_LOAD); |
| 3093 | 3093 |
| 3094 std::string url = (details ? details->url.possibly_invalid_spec() : "NULL"); | 3094 std::string url = (details ? details->url.possibly_invalid_spec() : "NULL"); |
| 3095 if (is_loading) { | 3095 if (is_loading) { |
| 3096 TRACE_EVENT_ASYNC_BEGIN1("browser", "WebContentsImpl Loading", this, | 3096 TRACE_EVENT_ASYNC_BEGIN1("browser,navigation", "WebContentsImpl Loading", |
| 3097 "URL", url); | 3097 this, "URL", url); |
| 3098 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3098 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 3099 DidStartLoading(render_view_host)); | 3099 DidStartLoading(render_view_host)); |
| 3100 } else { | 3100 } else { |
| 3101 TRACE_EVENT_ASYNC_END1("browser", "WebContentsImpl Loading", this, | 3101 TRACE_EVENT_ASYNC_END1("browser,navigation", "WebContentsImpl Loading", |
| 3102 "URL", url); | 3102 this, "URL", url); |
| 3103 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3103 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 3104 DidStopLoading(render_view_host)); | 3104 DidStopLoading(render_view_host)); |
| 3105 } | 3105 } |
| 3106 | 3106 |
| 3107 // TODO(avi): Remove. http://crbug.com/170921 | 3107 // TODO(avi): Remove. http://crbug.com/170921 |
| 3108 int type = is_loading ? NOTIFICATION_LOAD_START : NOTIFICATION_LOAD_STOP; | 3108 int type = is_loading ? NOTIFICATION_LOAD_START : NOTIFICATION_LOAD_STOP; |
| 3109 NotificationDetails det = NotificationService::NoDetails(); | 3109 NotificationDetails det = NotificationService::NoDetails(); |
| 3110 if (details) | 3110 if (details) |
| 3111 det = Details<LoadNotificationDetails>(details); | 3111 det = Details<LoadNotificationDetails>(details); |
| 3112 NotificationService::current()->Notify( | 3112 NotificationService::current()->Notify( |
| (...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4020 NavigationEntry* | 4020 NavigationEntry* |
| 4021 WebContentsImpl::GetLastCommittedNavigationEntryForRenderManager() { | 4021 WebContentsImpl::GetLastCommittedNavigationEntryForRenderManager() { |
| 4022 return controller_.GetLastCommittedEntry(); | 4022 return controller_.GetLastCommittedEntry(); |
| 4023 } | 4023 } |
| 4024 | 4024 |
| 4025 bool WebContentsImpl::CreateRenderViewForRenderManager( | 4025 bool WebContentsImpl::CreateRenderViewForRenderManager( |
| 4026 RenderViewHost* render_view_host, | 4026 RenderViewHost* render_view_host, |
| 4027 int opener_route_id, | 4027 int opener_route_id, |
| 4028 int proxy_routing_id, | 4028 int proxy_routing_id, |
| 4029 bool for_main_frame_navigation) { | 4029 bool for_main_frame_navigation) { |
| 4030 TRACE_EVENT0("browser", "WebContentsImpl::CreateRenderViewForRenderManager"); | 4030 TRACE_EVENT0("browser,navigation", |
| 4031 "WebContentsImpl::CreateRenderViewForRenderManager"); |
| 4031 // Can be NULL during tests. | 4032 // Can be NULL during tests. |
| 4032 RenderWidgetHostViewBase* rwh_view; | 4033 RenderWidgetHostViewBase* rwh_view; |
| 4033 // TODO(kenrb): RenderWidgetHostViewChildFrame special casing is temporary | 4034 // TODO(kenrb): RenderWidgetHostViewChildFrame special casing is temporary |
| 4034 // until RenderWidgetHost is attached to RenderFrameHost. We need to special | 4035 // until RenderWidgetHost is attached to RenderFrameHost. We need to special |
| 4035 // case this because RWH is still a base class of RenderViewHost, and child | 4036 // case this because RWH is still a base class of RenderViewHost, and child |
| 4036 // frame RWHVs are unique in that they do not have their own WebContents. | 4037 // frame RWHVs are unique in that they do not have their own WebContents. |
| 4037 if (!for_main_frame_navigation) { | 4038 if (!for_main_frame_navigation) { |
| 4038 RenderWidgetHostViewChildFrame* rwh_view_child = | 4039 RenderWidgetHostViewChildFrame* rwh_view_child = |
| 4039 new RenderWidgetHostViewChildFrame(render_view_host); | 4040 new RenderWidgetHostViewChildFrame(render_view_host); |
| 4040 rwh_view = rwh_view_child; | 4041 rwh_view = rwh_view_child; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 4068 render_widget_host->WasResized(); | 4069 render_widget_host->WasResized(); |
| 4069 } | 4070 } |
| 4070 #endif | 4071 #endif |
| 4071 | 4072 |
| 4072 return true; | 4073 return true; |
| 4073 } | 4074 } |
| 4074 | 4075 |
| 4075 bool WebContentsImpl::CreateRenderFrameForRenderManager( | 4076 bool WebContentsImpl::CreateRenderFrameForRenderManager( |
| 4076 RenderFrameHost* render_frame_host, | 4077 RenderFrameHost* render_frame_host, |
| 4077 int parent_routing_id) { | 4078 int parent_routing_id) { |
| 4078 TRACE_EVENT0("browser", "WebContentsImpl::CreateRenderFrameForRenderManager"); | 4079 TRACE_EVENT0("browser,navigation", |
| 4080 "WebContentsImpl::CreateRenderFrameForRenderManager"); |
| 4079 | 4081 |
| 4080 RenderFrameHostImpl* rfh = | 4082 RenderFrameHostImpl* rfh = |
| 4081 static_cast<RenderFrameHostImpl*>(render_frame_host); | 4083 static_cast<RenderFrameHostImpl*>(render_frame_host); |
| 4082 if (!rfh->CreateRenderFrame(parent_routing_id)) | 4084 if (!rfh->CreateRenderFrame(parent_routing_id)) |
| 4083 return false; | 4085 return false; |
| 4084 | 4086 |
| 4085 // TODO(nasko): When RenderWidgetHost is owned by RenderFrameHost, the passed | 4087 // TODO(nasko): When RenderWidgetHost is owned by RenderFrameHost, the passed |
| 4086 // RenderFrameHost will have to be associated with the appropriate | 4088 // RenderFrameHost will have to be associated with the appropriate |
| 4087 // RenderWidgetHostView or a new one should be created here. | 4089 // RenderWidgetHostView or a new one should be created here. |
| 4088 | 4090 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4242 node->render_manager()->ResumeResponseDeferredAtStart(); | 4244 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4243 } | 4245 } |
| 4244 | 4246 |
| 4245 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4247 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4246 force_disable_overscroll_content_ = force_disable; | 4248 force_disable_overscroll_content_ = force_disable; |
| 4247 if (view_) | 4249 if (view_) |
| 4248 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4250 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4249 } | 4251 } |
| 4250 | 4252 |
| 4251 } // namespace content | 4253 } // namespace content |
| OLD | NEW |