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 <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 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1262 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) | 1262 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) |
| 1263 g_created_callbacks.Get().at(i).Run(this); | 1263 g_created_callbacks.Get().at(i).Run(this); |
| 1264 | 1264 |
| 1265 // If the WebContents creation was renderer-initiated, it means that the | 1265 // If the WebContents creation was renderer-initiated, it means that the |
| 1266 // corresponding RenderView and main RenderFrame have already been created. | 1266 // corresponding RenderView and main RenderFrame have already been created. |
| 1267 // Ensure observers are notified about this. | 1267 // Ensure observers are notified about this. |
| 1268 if (params.renderer_initiated_creation) { | 1268 if (params.renderer_initiated_creation) { |
| 1269 RenderViewCreated(GetRenderViewHost()); | 1269 RenderViewCreated(GetRenderViewHost()); |
| 1270 GetRenderManager()->current_frame_host()->SetRenderFrameCreated(true); | 1270 GetRenderManager()->current_frame_host()->SetRenderFrameCreated(true); |
| 1271 } | 1271 } |
| 1272 | |
| 1273 // Ensure that observers are notified of the creation of this WebContents' | |
|
Charlie Reis
2015/03/02 18:38:26
nit: WebContents's
nasko
2015/03/02 19:30:54
Done.
| |
| 1274 // main RenderFrameHost. It must be done here for main frames, since the | |
| 1275 // NotifySwappedFromRenderManager expects view_ to be created and it happens | |
|
Charlie Reis
2015/03/02 18:38:26
nit: to already be
nit: and that happens
nasko
2015/03/02 19:30:54
Done.
| |
| 1276 // after RenderFrameHostManager::Init. | |
| 1277 NotifySwappedFromRenderManager( | |
| 1278 nullptr, GetRenderManager()->current_frame_host(), true); | |
| 1272 } | 1279 } |
| 1273 | 1280 |
| 1274 void WebContentsImpl::OnWebContentsDestroyed(WebContentsImpl* web_contents) { | 1281 void WebContentsImpl::OnWebContentsDestroyed(WebContentsImpl* web_contents) { |
| 1275 RemoveDestructionObserver(web_contents); | 1282 RemoveDestructionObserver(web_contents); |
| 1276 | 1283 |
| 1277 // Clear the opener if it has been closed. | 1284 // Clear the opener if it has been closed. |
| 1278 if (web_contents == opener_) { | 1285 if (web_contents == opener_) { |
| 1279 opener_ = NULL; | 1286 opener_ = NULL; |
| 1280 return; | 1287 return; |
| 1281 } | 1288 } |
| (...skipping 2892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4174 // We need to cancel modal dialogs when doing a process swap, since the load | 4181 // We need to cancel modal dialogs when doing a process swap, since the load |
| 4175 // deferrer would prevent us from swapping out. | 4182 // deferrer would prevent us from swapping out. |
| 4176 if (dialog_manager_) | 4183 if (dialog_manager_) |
| 4177 dialog_manager_->CancelActiveAndPendingDialogs(this); | 4184 dialog_manager_->CancelActiveAndPendingDialogs(this); |
| 4178 } | 4185 } |
| 4179 | 4186 |
| 4180 void WebContentsImpl::NotifySwappedFromRenderManager(RenderFrameHost* old_host, | 4187 void WebContentsImpl::NotifySwappedFromRenderManager(RenderFrameHost* old_host, |
| 4181 RenderFrameHost* new_host, | 4188 RenderFrameHost* new_host, |
| 4182 bool is_main_frame) { | 4189 bool is_main_frame) { |
| 4183 if (is_main_frame) { | 4190 if (is_main_frame) { |
| 4184 NotifyViewSwapped(old_host ? old_host->GetRenderViewHost() : NULL, | 4191 NotifyViewSwapped(old_host ? old_host->GetRenderViewHost() : nullptr, |
| 4185 new_host->GetRenderViewHost()); | 4192 new_host->GetRenderViewHost()); |
| 4186 | 4193 |
| 4187 // Make sure the visible RVH reflects the new delegate's preferences. | 4194 // Make sure the visible RVH reflects the new delegate's preferences. |
| 4188 if (delegate_) | 4195 if (delegate_) |
| 4189 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4196 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4190 | 4197 |
| 4191 view_->RenderViewSwappedIn(new_host->GetRenderViewHost()); | 4198 view_->RenderViewSwappedIn(new_host->GetRenderViewHost()); |
| 4192 } | 4199 } |
| 4193 | 4200 |
| 4194 NotifyFrameSwapped(old_host, new_host); | 4201 NotifyFrameSwapped(old_host, new_host); |
| 4195 } | 4202 } |
| 4196 | 4203 |
| 4204 void WebContentsImpl::NotifyMainFrameSwappedFromRenderManager( | |
| 4205 RenderFrameHost* old_host, | |
| 4206 RenderFrameHost* new_host) { | |
| 4207 NotifyViewSwapped(old_host ? old_host->GetRenderViewHost() : nullptr, | |
| 4208 new_host->GetRenderViewHost()); | |
| 4209 } | |
| 4210 | |
| 4197 int WebContentsImpl::CreateOpenerRenderViewsForRenderManager( | 4211 int WebContentsImpl::CreateOpenerRenderViewsForRenderManager( |
| 4198 SiteInstance* instance) { | 4212 SiteInstance* instance) { |
| 4199 if (!opener_) | 4213 if (!opener_) |
| 4200 return MSG_ROUTING_NONE; | 4214 return MSG_ROUTING_NONE; |
| 4201 | 4215 |
| 4202 // Recursively create RenderViews for anything else in the opener chain. | 4216 // Recursively create RenderViews for anything else in the opener chain. |
| 4203 return opener_->CreateOpenerRenderViews(instance); | 4217 return opener_->CreateOpenerRenderViews(instance); |
| 4204 } | 4218 } |
| 4205 | 4219 |
| 4206 int WebContentsImpl::CreateOpenerRenderViews(SiteInstance* instance) { | 4220 int WebContentsImpl::CreateOpenerRenderViews(SiteInstance* instance) { |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4513 node->render_manager()->ResumeResponseDeferredAtStart(); | 4527 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4514 } | 4528 } |
| 4515 | 4529 |
| 4516 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4530 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4517 force_disable_overscroll_content_ = force_disable; | 4531 force_disable_overscroll_content_ = force_disable; |
| 4518 if (view_) | 4532 if (view_) |
| 4519 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4533 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4520 } | 4534 } |
| 4521 | 4535 |
| 4522 } // namespace content | 4536 } // namespace content |
| OLD | NEW |