| 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 3761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3772 return; | 3772 return; |
| 3773 | 3773 |
| 3774 if (delegate_) | 3774 if (delegate_) |
| 3775 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 3775 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 3776 | 3776 |
| 3777 NotificationService::current()->Notify( | 3777 NotificationService::current()->Notify( |
| 3778 NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED, | 3778 NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED, |
| 3779 Source<WebContents>(this), | 3779 Source<WebContents>(this), |
| 3780 Details<RenderViewHost>(render_view_host)); | 3780 Details<RenderViewHost>(render_view_host)); |
| 3781 | 3781 |
| 3782 // When we're creating views, we're still doing initial setup, so we always | |
| 3783 // use the pending Web UI rather than any possibly existing committed one. | |
| 3784 if (GetRenderManager()->pending_web_ui()) | |
| 3785 GetRenderManager()->pending_web_ui()->RenderViewCreated(render_view_host); | |
| 3786 | |
| 3787 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 3788 switches::kEnableBrowserSideNavigation) && | |
| 3789 GetRenderManager()->speculative_web_ui()) { | |
| 3790 GetRenderManager()->speculative_web_ui()->RenderViewCreated( | |
| 3791 render_view_host); | |
| 3792 } | |
| 3793 | |
| 3794 NavigationEntry* entry = controller_.GetPendingEntry(); | 3782 NavigationEntry* entry = controller_.GetPendingEntry(); |
| 3795 if (entry && entry->IsViewSourceMode()) { | 3783 if (entry && entry->IsViewSourceMode()) { |
| 3796 // Put the renderer in view source mode. | 3784 // Put the renderer in view source mode. |
| 3797 render_view_host->Send( | 3785 render_view_host->Send( |
| 3798 new ViewMsg_EnableViewSourceMode(render_view_host->GetRoutingID())); | 3786 new ViewMsg_EnableViewSourceMode(render_view_host->GetRoutingID())); |
| 3799 } | 3787 } |
| 3800 | 3788 |
| 3801 view_->RenderViewCreated(render_view_host); | 3789 view_->RenderViewCreated(render_view_host); |
| 3802 | 3790 |
| 3803 FOR_EACH_OBSERVER( | 3791 FOR_EACH_OBSERVER( |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4171 source_id); | 4159 source_id); |
| 4172 } | 4160 } |
| 4173 | 4161 |
| 4174 int WebContentsImpl::CreateSwappedOutRenderView( | 4162 int WebContentsImpl::CreateSwappedOutRenderView( |
| 4175 SiteInstance* instance) { | 4163 SiteInstance* instance) { |
| 4176 int render_view_routing_id = MSG_ROUTING_NONE; | 4164 int render_view_routing_id = MSG_ROUTING_NONE; |
| 4177 if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) { | 4165 if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) { |
| 4178 GetRenderManager()->CreateRenderFrameProxy(instance); | 4166 GetRenderManager()->CreateRenderFrameProxy(instance); |
| 4179 } else { | 4167 } else { |
| 4180 GetRenderManager()->CreateRenderFrame( | 4168 GetRenderManager()->CreateRenderFrame( |
| 4181 instance, nullptr, CREATE_RF_SWAPPED_OUT | CREATE_RF_HIDDEN, | 4169 instance, CREATE_RF_SWAPPED_OUT | CREATE_RF_HIDDEN, |
| 4182 &render_view_routing_id); | 4170 &render_view_routing_id); |
| 4183 } | 4171 } |
| 4184 return render_view_routing_id; | 4172 return render_view_routing_id; |
| 4185 } | 4173 } |
| 4186 | 4174 |
| 4187 void WebContentsImpl::OnUserGesture() { | 4175 void WebContentsImpl::OnUserGesture() { |
| 4188 // Notify observers. | 4176 // Notify observers. |
| 4189 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetUserGesture()); | 4177 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetUserGesture()); |
| 4190 | 4178 |
| 4191 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); | 4179 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4333 void WebContentsImpl::NotifyMainFrameSwappedFromRenderManager( | 4321 void WebContentsImpl::NotifyMainFrameSwappedFromRenderManager( |
| 4334 RenderViewHost* old_host, | 4322 RenderViewHost* old_host, |
| 4335 RenderViewHost* new_host) { | 4323 RenderViewHost* new_host) { |
| 4336 NotifyViewSwapped(old_host, new_host); | 4324 NotifyViewSwapped(old_host, new_host); |
| 4337 } | 4325 } |
| 4338 | 4326 |
| 4339 NavigationControllerImpl& WebContentsImpl::GetControllerForRenderManager() { | 4327 NavigationControllerImpl& WebContentsImpl::GetControllerForRenderManager() { |
| 4340 return GetController(); | 4328 return GetController(); |
| 4341 } | 4329 } |
| 4342 | 4330 |
| 4343 scoped_ptr<WebUIImpl> WebContentsImpl::CreateWebUIForRenderManager( | 4331 scoped_ptr<WebUIImpl> WebContentsImpl::CreateMainFrameWebUI(const GURL& url) { |
| 4344 const GURL& url) { | |
| 4345 return scoped_ptr<WebUIImpl>(static_cast<WebUIImpl*>(CreateWebUI( | 4332 return scoped_ptr<WebUIImpl>(static_cast<WebUIImpl*>(CreateWebUI( |
| 4346 url, std::string()))); | 4333 url, std::string()))); |
| 4347 } | 4334 } |
| 4348 | 4335 |
| 4349 NavigationEntry* | 4336 NavigationEntry* |
| 4350 WebContentsImpl::GetLastCommittedNavigationEntryForRenderManager() { | 4337 WebContentsImpl::GetLastCommittedNavigationEntryForRenderManager() { |
| 4351 return controller_.GetLastCommittedEntry(); | 4338 return controller_.GetLastCommittedEntry(); |
| 4352 } | 4339 } |
| 4353 | 4340 |
| 4354 void WebContentsImpl::CreateRenderWidgetHostViewForRenderManager( | 4341 void WebContentsImpl::CreateRenderWidgetHostViewForRenderManager( |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4650 return NULL; | 4637 return NULL; |
| 4651 } | 4638 } |
| 4652 | 4639 |
| 4653 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4640 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4654 force_disable_overscroll_content_ = force_disable; | 4641 force_disable_overscroll_content_ = force_disable; |
| 4655 if (view_) | 4642 if (view_) |
| 4656 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4643 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4657 } | 4644 } |
| 4658 | 4645 |
| 4659 } // namespace content | 4646 } // namespace content |
| OLD | NEW |