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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 } | 197 } |
| 198 | 198 |
| 199 void SetAccessibilityModeOnFrame(AccessibilityMode mode, | 199 void SetAccessibilityModeOnFrame(AccessibilityMode mode, |
| 200 RenderFrameHost* frame_host) { | 200 RenderFrameHost* frame_host) { |
| 201 static_cast<RenderFrameHostImpl*>(frame_host)->SetAccessibilityMode(mode); | 201 static_cast<RenderFrameHostImpl*>(frame_host)->SetAccessibilityMode(mode); |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace | 204 } // namespace |
| 205 | 205 |
| 206 WebContents* WebContents::Create(const WebContents::CreateParams& params) { | 206 WebContents* WebContents::Create(const WebContents::CreateParams& params) { |
| 207 return WebContentsImpl::CreateWithOpener( | 207 FrameTreeNode* opener_node = nullptr; |
| 208 params, static_cast<WebContentsImpl*>(params.opener)); | 208 if (params.opener_render_frame_id != MSG_ROUTING_NONE) { |
| 209 RenderFrameHostImpl* opener_rfh = RenderFrameHostImpl::FromID( | |
| 210 params.opener_render_process_id, params.opener_render_frame_id); | |
| 211 if (opener_rfh) | |
| 212 opener_node = opener_rfh->frame_tree_node(); | |
| 213 } | |
| 214 return WebContentsImpl::CreateWithOpener(params, opener_node); | |
| 209 } | 215 } |
| 210 | 216 |
| 211 WebContents* WebContents::CreateWithSessionStorage( | 217 WebContents* WebContents::CreateWithSessionStorage( |
| 212 const WebContents::CreateParams& params, | 218 const WebContents::CreateParams& params, |
| 213 const SessionStorageNamespaceMap& session_storage_namespace_map) { | 219 const SessionStorageNamespaceMap& session_storage_namespace_map) { |
| 214 WebContentsImpl* new_contents = new WebContentsImpl( | 220 WebContentsImpl* new_contents = new WebContentsImpl(params.browser_context); |
| 215 params.browser_context, NULL); | |
| 216 | 221 |
| 217 for (SessionStorageNamespaceMap::const_iterator it = | 222 for (SessionStorageNamespaceMap::const_iterator it = |
| 218 session_storage_namespace_map.begin(); | 223 session_storage_namespace_map.begin(); |
| 219 it != session_storage_namespace_map.end(); | 224 it != session_storage_namespace_map.end(); |
| 220 ++it) { | 225 ++it) { |
| 221 new_contents->GetController() | 226 new_contents->GetController() |
| 222 .SetSessionStorageNamespace(it->first, it->second.get()); | 227 .SetSessionStorageNamespace(it->first, it->second.get()); |
| 223 } | 228 } |
| 224 | 229 |
| 225 new_contents->Init(params); | 230 new_contents->Init(params); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 render_frame_id(render_frame_id), | 286 render_frame_id(render_frame_id), |
| 282 chooser(chooser), | 287 chooser(chooser), |
| 283 identifier(identifier) { | 288 identifier(identifier) { |
| 284 } | 289 } |
| 285 | 290 |
| 286 WebContentsImpl::ColorChooserInfo::~ColorChooserInfo() { | 291 WebContentsImpl::ColorChooserInfo::~ColorChooserInfo() { |
| 287 } | 292 } |
| 288 | 293 |
| 289 // WebContentsImpl ------------------------------------------------------------- | 294 // WebContentsImpl ------------------------------------------------------------- |
| 290 | 295 |
| 291 WebContentsImpl::WebContentsImpl(BrowserContext* browser_context, | 296 WebContentsImpl::WebContentsImpl(BrowserContext* browser_context) |
| 292 WebContentsImpl* opener) | |
| 293 : delegate_(NULL), | 297 : delegate_(NULL), |
| 294 controller_(this, browser_context), | 298 controller_(this, browser_context), |
| 295 render_view_host_delegate_view_(NULL), | 299 render_view_host_delegate_view_(NULL), |
| 296 opener_(opener), | 300 created_with_opener_(false), |
| 297 created_with_opener_(!!opener), | |
| 298 #if defined(OS_WIN) | 301 #if defined(OS_WIN) |
| 299 accessible_parent_(NULL), | 302 accessible_parent_(NULL), |
| 300 #endif | 303 #endif |
| 301 frame_tree_(new NavigatorImpl(&controller_, this), | 304 frame_tree_(new NavigatorImpl(&controller_, this), |
| 302 this, | 305 this, |
| 303 this, | 306 this, |
| 304 this, | 307 this, |
| 305 this), | 308 this), |
| 306 is_loading_(false), | 309 is_loading_(false), |
| 307 is_load_to_different_document_(false), | 310 is_load_to_different_document_(false), |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 416 ResetWebContents()); | 419 ResetWebContents()); |
| 417 | 420 |
| 418 SetDelegate(NULL); | 421 SetDelegate(NULL); |
| 419 | 422 |
| 420 STLDeleteContainerPairSecondPointers(destruction_observers_.begin(), | 423 STLDeleteContainerPairSecondPointers(destruction_observers_.begin(), |
| 421 destruction_observers_.end()); | 424 destruction_observers_.end()); |
| 422 } | 425 } |
| 423 | 426 |
| 424 WebContentsImpl* WebContentsImpl::CreateWithOpener( | 427 WebContentsImpl* WebContentsImpl::CreateWithOpener( |
| 425 const WebContents::CreateParams& params, | 428 const WebContents::CreateParams& params, |
| 426 WebContentsImpl* opener) { | 429 FrameTreeNode* opener) { |
| 427 TRACE_EVENT0("browser", "WebContentsImpl::CreateWithOpener"); | 430 TRACE_EVENT0("browser", "WebContentsImpl::CreateWithOpener"); |
| 428 WebContentsImpl* new_contents = new WebContentsImpl( | 431 WebContentsImpl* new_contents = new WebContentsImpl(params.browser_context); |
| 429 params.browser_context, params.opener_suppressed ? NULL : opener); | |
| 430 | 432 |
| 433 if (!params.opener_suppressed && opener) { | |
| 434 new_contents->GetFrameTree()->root()->SetOpener(opener); | |
| 435 new_contents->created_with_opener_ = true; | |
| 436 } | |
| 437 | |
| 438 // This may be true even when opener is null, such as when opening blocked | |
| 439 // popups. | |
| 431 if (params.created_with_opener) | 440 if (params.created_with_opener) |
| 432 new_contents->created_with_opener_ = true; | 441 new_contents->created_with_opener_ = true; |
| 433 | 442 |
| 434 if (params.guest_delegate) { | 443 if (params.guest_delegate) { |
| 435 // This makes |new_contents| act as a guest. | 444 // This makes |new_contents| act as a guest. |
| 436 // For more info, see comment above class BrowserPluginGuest. | 445 // For more info, see comment above class BrowserPluginGuest. |
| 437 BrowserPluginGuest::Create(new_contents, params.guest_delegate); | 446 BrowserPluginGuest::Create(new_contents, params.guest_delegate); |
| 438 // We are instantiating a WebContents for browser plugin. Set its subframe | 447 // We are instantiating a WebContents for browser plugin. Set its subframe |
| 439 // bit to true. | 448 // bit to true. |
| 440 new_contents->is_subframe_ = true; | 449 new_contents->is_subframe_ = true; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 467 return result; | 476 return result; |
| 468 } | 477 } |
| 469 | 478 |
| 470 // static | 479 // static |
| 471 WebContentsImpl* WebContentsImpl::FromFrameTreeNode( | 480 WebContentsImpl* WebContentsImpl::FromFrameTreeNode( |
| 472 FrameTreeNode* frame_tree_node) { | 481 FrameTreeNode* frame_tree_node) { |
| 473 return static_cast<WebContentsImpl*>( | 482 return static_cast<WebContentsImpl*>( |
| 474 WebContents::FromRenderFrameHost(frame_tree_node->current_frame_host())); | 483 WebContents::FromRenderFrameHost(frame_tree_node->current_frame_host())); |
| 475 } | 484 } |
| 476 | 485 |
| 486 WebContentsImpl* WebContentsImpl::GetOpenerWebContents() const { | |
| 487 FrameTreeNode* opener_ftn = frame_tree_.root()->opener(); | |
| 488 return opener_ftn ? FromFrameTreeNode(opener_ftn) : nullptr; | |
| 489 } | |
| 490 | |
| 477 RenderFrameHostManager* WebContentsImpl::GetRenderManagerForTesting() { | 491 RenderFrameHostManager* WebContentsImpl::GetRenderManagerForTesting() { |
| 478 return GetRenderManager(); | 492 return GetRenderManager(); |
| 479 } | 493 } |
| 480 | 494 |
| 481 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, | 495 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, |
| 482 const IPC::Message& message) { | 496 const IPC::Message& message) { |
| 483 return OnMessageReceived(render_view_host, NULL, message); | 497 return OnMessageReceived(render_view_host, NULL, message); |
| 484 } | 498 } |
| 485 | 499 |
| 486 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, | 500 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1163 GetMainFrame()->DispatchBeforeUnload(for_cross_site_transition); | 1177 GetMainFrame()->DispatchBeforeUnload(for_cross_site_transition); |
| 1164 } | 1178 } |
| 1165 | 1179 |
| 1166 void WebContentsImpl::Stop() { | 1180 void WebContentsImpl::Stop() { |
| 1167 GetRenderManager()->Stop(); | 1181 GetRenderManager()->Stop(); |
| 1168 FOR_EACH_OBSERVER(WebContentsObserver, observers_, NavigationStopped()); | 1182 FOR_EACH_OBSERVER(WebContentsObserver, observers_, NavigationStopped()); |
| 1169 } | 1183 } |
| 1170 | 1184 |
| 1171 WebContents* WebContentsImpl::Clone() { | 1185 WebContents* WebContentsImpl::Clone() { |
| 1172 // We use our current SiteInstance since the cloned entry will use it anyway. | 1186 // We use our current SiteInstance since the cloned entry will use it anyway. |
| 1173 // We pass our own opener so that the cloned page can access it if it was | 1187 // We pass our own opener so that the cloned page can access it if it was set |
| 1174 // before. | 1188 // before. |
| 1175 CreateParams create_params(GetBrowserContext(), GetSiteInstance()); | 1189 CreateParams create_params(GetBrowserContext(), GetSiteInstance()); |
| 1176 create_params.initial_size = GetContainerBounds().size(); | 1190 create_params.initial_size = GetContainerBounds().size(); |
| 1177 WebContentsImpl* tc = CreateWithOpener(create_params, opener_); | 1191 WebContentsImpl* tc = |
| 1192 CreateWithOpener(create_params, frame_tree_.root()->opener()); | |
| 1178 tc->GetController().CopyStateFrom(controller_); | 1193 tc->GetController().CopyStateFrom(controller_); |
| 1179 FOR_EACH_OBSERVER(WebContentsObserver, | 1194 FOR_EACH_OBSERVER(WebContentsObserver, |
| 1180 observers_, | 1195 observers_, |
| 1181 DidCloneToNewWebContents(this, tc)); | 1196 DidCloneToNewWebContents(this, tc)); |
| 1182 return tc; | 1197 return tc; |
| 1183 } | 1198 } |
| 1184 | 1199 |
| 1185 void WebContentsImpl::Observe(int type, | 1200 void WebContentsImpl::Observe(int type, |
| 1186 const NotificationSource& source, | 1201 const NotificationSource& source, |
| 1187 const NotificationDetails& details) { | 1202 const NotificationDetails& details) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1248 // Regular WebContentsView. | 1263 // Regular WebContentsView. |
| 1249 view_.reset(CreateWebContentsView( | 1264 view_.reset(CreateWebContentsView( |
| 1250 this, delegate, &render_view_host_delegate_view_)); | 1265 this, delegate, &render_view_host_delegate_view_)); |
| 1251 } | 1266 } |
| 1252 CHECK(render_view_host_delegate_view_); | 1267 CHECK(render_view_host_delegate_view_); |
| 1253 CHECK(view_.get()); | 1268 CHECK(view_.get()); |
| 1254 | 1269 |
| 1255 gfx::Size initial_size = params.initial_size; | 1270 gfx::Size initial_size = params.initial_size; |
| 1256 view_->CreateView(initial_size, params.context); | 1271 view_->CreateView(initial_size, params.context); |
| 1257 | 1272 |
| 1258 // Listen for whether our opener gets destroyed. | |
| 1259 if (opener_) | |
| 1260 AddDestructionObserver(opener_); | |
| 1261 | |
| 1262 #if defined(ENABLE_PLUGINS) | 1273 #if defined(ENABLE_PLUGINS) |
| 1263 plugin_content_origin_whitelist_.reset( | 1274 plugin_content_origin_whitelist_.reset( |
| 1264 new PluginContentOriginWhitelist(this)); | 1275 new PluginContentOriginWhitelist(this)); |
| 1265 #endif | 1276 #endif |
| 1266 | 1277 |
| 1267 registrar_.Add(this, | 1278 registrar_.Add(this, |
| 1268 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, | 1279 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, |
| 1269 NotificationService::AllBrowserContextsAndSources()); | 1280 NotificationService::AllBrowserContextsAndSources()); |
| 1270 | 1281 |
| 1271 screen_orientation_dispatcher_host_.reset( | 1282 screen_orientation_dispatcher_host_.reset( |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 1297 // main RenderFrameHost. It must be done here for main frames, since the | 1308 // main RenderFrameHost. It must be done here for main frames, since the |
| 1298 // NotifySwappedFromRenderManager expects view_ to already be created and that | 1309 // NotifySwappedFromRenderManager expects view_ to already be created and that |
| 1299 // happens after RenderFrameHostManager::Init. | 1310 // happens after RenderFrameHostManager::Init. |
| 1300 NotifySwappedFromRenderManager( | 1311 NotifySwappedFromRenderManager( |
| 1301 nullptr, GetRenderManager()->current_frame_host(), true); | 1312 nullptr, GetRenderManager()->current_frame_host(), true); |
| 1302 } | 1313 } |
| 1303 | 1314 |
| 1304 void WebContentsImpl::OnWebContentsDestroyed(WebContentsImpl* web_contents) { | 1315 void WebContentsImpl::OnWebContentsDestroyed(WebContentsImpl* web_contents) { |
| 1305 RemoveDestructionObserver(web_contents); | 1316 RemoveDestructionObserver(web_contents); |
| 1306 | 1317 |
| 1307 // Clear the opener if it has been closed. | |
| 1308 if (web_contents == opener_) { | |
| 1309 opener_ = NULL; | |
| 1310 return; | |
| 1311 } | |
| 1312 // Clear a pending contents that has been closed before being shown. | 1318 // Clear a pending contents that has been closed before being shown. |
| 1313 for (PendingContents::iterator iter = pending_contents_.begin(); | 1319 for (PendingContents::iterator iter = pending_contents_.begin(); |
| 1314 iter != pending_contents_.end(); | 1320 iter != pending_contents_.end(); |
| 1315 ++iter) { | 1321 ++iter) { |
| 1316 if (iter->second != web_contents) | 1322 if (iter->second != web_contents) |
| 1317 continue; | 1323 continue; |
| 1318 pending_contents_.erase(iter); | 1324 pending_contents_.erase(iter); |
| 1319 return; | 1325 return; |
| 1320 } | 1326 } |
| 1321 NOTREACHED(); | 1327 NOTREACHED(); |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1603 main_frame_route_id); | 1609 main_frame_route_id); |
| 1604 return; | 1610 return; |
| 1605 } | 1611 } |
| 1606 | 1612 |
| 1607 // Create the new web contents. This will automatically create the new | 1613 // Create the new web contents. This will automatically create the new |
| 1608 // WebContentsView. In the future, we may want to create the view separately. | 1614 // WebContentsView. In the future, we may want to create the view separately. |
| 1609 CreateParams create_params(GetBrowserContext(), site_instance.get()); | 1615 CreateParams create_params(GetBrowserContext(), site_instance.get()); |
| 1610 create_params.routing_id = route_id; | 1616 create_params.routing_id = route_id; |
| 1611 create_params.main_frame_routing_id = main_frame_route_id; | 1617 create_params.main_frame_routing_id = main_frame_route_id; |
| 1612 create_params.main_frame_name = base::UTF16ToUTF8(params.frame_name); | 1618 create_params.main_frame_name = base::UTF16ToUTF8(params.frame_name); |
| 1613 create_params.opener = this; | 1619 create_params.opener_render_process_id = GetRenderProcessHost()->GetID(); |
| 1620 create_params.opener_render_frame_id = params.opener_render_frame_id; | |
| 1614 create_params.opener_suppressed = params.opener_suppressed; | 1621 create_params.opener_suppressed = params.opener_suppressed; |
| 1615 if (params.disposition == NEW_BACKGROUND_TAB) | 1622 if (params.disposition == NEW_BACKGROUND_TAB) |
| 1616 create_params.initially_hidden = true; | 1623 create_params.initially_hidden = true; |
| 1617 create_params.renderer_initiated_creation = true; | 1624 create_params.renderer_initiated_creation = true; |
| 1618 | 1625 |
| 1619 WebContentsImpl* new_contents = NULL; | 1626 WebContentsImpl* new_contents = NULL; |
| 1620 if (!is_guest) { | 1627 if (!is_guest) { |
| 1621 create_params.context = view_->GetNativeView(); | 1628 create_params.context = view_->GetNativeView(); |
| 1622 create_params.initial_size = GetContainerBounds().size(); | 1629 create_params.initial_size = GetContainerBounds().size(); |
| 1623 new_contents = static_cast<WebContentsImpl*>( | 1630 new_contents = static_cast<WebContentsImpl*>( |
| (...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2472 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { | 2479 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { |
| 2473 if (GetBrowserPluginGuest()) | 2480 if (GetBrowserPluginGuest()) |
| 2474 return GetBrowserPluginGuest()->LockMouse(allowed); | 2481 return GetBrowserPluginGuest()->LockMouse(allowed); |
| 2475 | 2482 |
| 2476 return GetRenderViewHost() | 2483 return GetRenderViewHost() |
| 2477 ? GetRenderViewHost()->GotResponseToLockMouseRequest(allowed) | 2484 ? GetRenderViewHost()->GotResponseToLockMouseRequest(allowed) |
| 2478 : false; | 2485 : false; |
| 2479 } | 2486 } |
| 2480 | 2487 |
| 2481 bool WebContentsImpl::HasOpener() const { | 2488 bool WebContentsImpl::HasOpener() const { |
| 2482 return opener_ != NULL; | 2489 return GetOpenerWebContents() != NULL; |
| 2483 } | 2490 } |
| 2484 | 2491 |
| 2485 WebContents* WebContentsImpl::GetOpener() const { | 2492 WebContents* WebContentsImpl::GetOpener() const { |
| 2486 return static_cast<WebContents*>(opener_); | 2493 return static_cast<WebContents*>(GetOpenerWebContents()); |
|
Charlie Reis
2015/06/09 04:38:38
Yeah, just put the new GetOpenerWebContents logic
alexmos
2015/06/09 20:13:05
Done.
| |
| 2487 } | 2494 } |
| 2488 | 2495 |
| 2489 void WebContentsImpl::DidChooseColorInColorChooser(SkColor color) { | 2496 void WebContentsImpl::DidChooseColorInColorChooser(SkColor color) { |
| 2490 if (!color_chooser_info_.get()) | 2497 if (!color_chooser_info_.get()) |
| 2491 return; | 2498 return; |
| 2492 RenderFrameHost* rfh = RenderFrameHost::FromID( | 2499 RenderFrameHost* rfh = RenderFrameHost::FromID( |
| 2493 color_chooser_info_->render_process_id, | 2500 color_chooser_info_->render_process_id, |
| 2494 color_chooser_info_->render_frame_id); | 2501 color_chooser_info_->render_frame_id); |
| 2495 if (!rfh) | 2502 if (!rfh) |
| 2496 return; | 2503 return; |
| (...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3830 // Update the URL display. | 3837 // Update the URL display. |
| 3831 NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); | 3838 NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); |
| 3832 } | 3839 } |
| 3833 | 3840 |
| 3834 void WebContentsImpl::DidChangeName(RenderFrameHost* render_frame_host, | 3841 void WebContentsImpl::DidChangeName(RenderFrameHost* render_frame_host, |
| 3835 const std::string& name) { | 3842 const std::string& name) { |
| 3836 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3843 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 3837 FrameNameChanged(render_frame_host, name)); | 3844 FrameNameChanged(render_frame_host, name)); |
| 3838 } | 3845 } |
| 3839 | 3846 |
| 3840 void WebContentsImpl::DidDisownOpener(RenderFrameHost* render_frame_host) { | |
| 3841 // No action is necessary if the opener has already been cleared. | |
| 3842 if (!opener_) | |
| 3843 return; | |
| 3844 | |
| 3845 // Clear our opener so that future cross-process navigations don't have an | |
| 3846 // opener assigned. | |
| 3847 RemoveDestructionObserver(opener_); | |
| 3848 opener_ = NULL; | |
| 3849 | |
| 3850 // Notify all swapped out RenderViewHosts for this tab. This is important | |
| 3851 // in case we go back to them, or if another window in those processes tries | |
| 3852 // to access window.opener. | |
| 3853 GetRenderManager()->DidDisownOpener(render_frame_host); | |
| 3854 } | |
| 3855 | |
| 3856 void WebContentsImpl::DocumentOnLoadCompleted( | 3847 void WebContentsImpl::DocumentOnLoadCompleted( |
| 3857 RenderFrameHost* render_frame_host) { | 3848 RenderFrameHost* render_frame_host) { |
| 3858 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3849 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 3859 DocumentOnLoadCompletedInMainFrame()); | 3850 DocumentOnLoadCompletedInMainFrame()); |
| 3860 | 3851 |
| 3861 // TODO(avi): Remove. http://crbug.com/170921 | 3852 // TODO(avi): Remove. http://crbug.com/170921 |
| 3862 NotificationService::current()->Notify( | 3853 NotificationService::current()->Notify( |
| 3863 NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 3854 NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 3864 Source<WebContents>(this), | 3855 Source<WebContents>(this), |
| 3865 NotificationService::NoDetails()); | 3856 NotificationService::NoDetails()); |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4117 } | 4108 } |
| 4118 | 4109 |
| 4119 void WebContentsImpl::NotifyMainFrameSwappedFromRenderManager( | 4110 void WebContentsImpl::NotifyMainFrameSwappedFromRenderManager( |
| 4120 RenderViewHost* old_host, | 4111 RenderViewHost* old_host, |
| 4121 RenderViewHost* new_host) { | 4112 RenderViewHost* new_host) { |
| 4122 NotifyViewSwapped(old_host, new_host); | 4113 NotifyViewSwapped(old_host, new_host); |
| 4123 } | 4114 } |
| 4124 | 4115 |
| 4125 int WebContentsImpl::CreateOpenerRenderViewsForRenderManager( | 4116 int WebContentsImpl::CreateOpenerRenderViewsForRenderManager( |
| 4126 SiteInstance* instance) { | 4117 SiteInstance* instance) { |
| 4127 if (!opener_) | 4118 WebContentsImpl* opener = GetOpenerWebContents(); |
| 4119 if (!opener) | |
| 4128 return MSG_ROUTING_NONE; | 4120 return MSG_ROUTING_NONE; |
| 4129 | 4121 |
| 4130 // Recursively create RenderViews for anything else in the opener chain. | 4122 // Recursively create RenderViews for anything else in the opener chain. |
| 4131 return opener_->CreateOpenerRenderViews(instance); | 4123 return opener->CreateOpenerRenderViews(instance); |
| 4132 } | 4124 } |
| 4133 | 4125 |
| 4134 int WebContentsImpl::CreateOpenerRenderViews(SiteInstance* instance) { | 4126 int WebContentsImpl::CreateOpenerRenderViews(SiteInstance* instance) { |
| 4135 int opener_route_id = MSG_ROUTING_NONE; | 4127 int opener_route_id = MSG_ROUTING_NONE; |
| 4136 | 4128 |
| 4137 // If this tab has an opener, ensure it has a RenderView in the given | 4129 // If this tab has an opener, ensure it has a RenderView in the given |
| 4138 // SiteInstance as well. | 4130 // SiteInstance as well. |
| 4139 if (opener_) | 4131 WebContentsImpl* opener = GetOpenerWebContents(); |
| 4140 opener_route_id = opener_->CreateOpenerRenderViews(instance); | 4132 if (opener) |
| 4133 opener_route_id = opener->CreateOpenerRenderViews(instance); | |
| 4141 | 4134 |
| 4142 // If any of the renderers (current, pending, or swapped out) for this | 4135 // If any of the renderers (current, pending, or swapped out) for this |
| 4143 // WebContents has the same SiteInstance, use it. | 4136 // WebContents has the same SiteInstance, use it. |
| 4144 if (GetRenderManager()->current_host()->GetSiteInstance() == instance) | 4137 if (GetRenderManager()->current_host()->GetSiteInstance() == instance) |
| 4145 return GetRenderManager()->current_host()->GetRoutingID(); | 4138 return GetRenderManager()->current_host()->GetRoutingID(); |
| 4146 | 4139 |
| 4147 if (GetRenderManager()->pending_render_view_host() && | 4140 if (GetRenderManager()->pending_render_view_host() && |
| 4148 GetRenderManager()->pending_render_view_host()->GetSiteInstance() == | 4141 GetRenderManager()->pending_render_view_host()->GetSiteInstance() == |
| 4149 instance) | 4142 instance) |
| 4150 return GetRenderManager()->pending_render_view_host()->GetRoutingID(); | 4143 return GetRenderManager()->pending_render_view_host()->GetRoutingID(); |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4440 player_map->erase(it); | 4433 player_map->erase(it); |
| 4441 } | 4434 } |
| 4442 | 4435 |
| 4443 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4436 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4444 force_disable_overscroll_content_ = force_disable; | 4437 force_disable_overscroll_content_ = force_disable; |
| 4445 if (view_) | 4438 if (view_) |
| 4446 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4439 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4447 } | 4440 } |
| 4448 | 4441 |
| 4449 } // namespace content | 4442 } // namespace content |
| OLD | NEW |