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 CHECK(!params.opener || params.opener_render_frame_id != MSG_ROUTING_NONE); |
209 if (params.opener_render_frame_id != MSG_ROUTING_NONE) { | |
210 RenderFrameHostImpl* opener_rfh = RenderFrameHostImpl::FromID( | |
211 params.opener->GetRenderProcessHost()->GetID(), | |
alexmos
2015/06/01 17:44:55
I didn't remove "opener" from WebContents::CreateP
Charlie Reis
2015/06/03 20:01:37
CreateParams is public, so we shouldn't put FrameT
alexmos
2015/06/05 22:34:31
Done.
| |
212 params.opener_render_frame_id); | |
213 // TODO: Is this null check needed? Seems like opener could navigate away. | |
Charlie Reis
2015/06/03 20:01:37
Good question. I *think* opener_rfh would be the
alexmos
2015/06/05 22:34:31
Acknowledged.
| |
214 if (opener_rfh) | |
215 opener_node = opener_rfh->frame_tree_node(); | |
216 } | |
217 return WebContentsImpl::CreateWithOpener(params, opener_node); | |
209 } | 218 } |
210 | 219 |
211 WebContents* WebContents::CreateWithSessionStorage( | 220 WebContents* WebContents::CreateWithSessionStorage( |
212 const WebContents::CreateParams& params, | 221 const WebContents::CreateParams& params, |
213 const SessionStorageNamespaceMap& session_storage_namespace_map) { | 222 const SessionStorageNamespaceMap& session_storage_namespace_map) { |
214 WebContentsImpl* new_contents = new WebContentsImpl( | 223 WebContentsImpl* new_contents = new WebContentsImpl(params.browser_context); |
215 params.browser_context, NULL); | |
216 | 224 |
217 for (SessionStorageNamespaceMap::const_iterator it = | 225 for (SessionStorageNamespaceMap::const_iterator it = |
218 session_storage_namespace_map.begin(); | 226 session_storage_namespace_map.begin(); |
219 it != session_storage_namespace_map.end(); | 227 it != session_storage_namespace_map.end(); |
220 ++it) { | 228 ++it) { |
221 new_contents->GetController() | 229 new_contents->GetController() |
222 .SetSessionStorageNamespace(it->first, it->second.get()); | 230 .SetSessionStorageNamespace(it->first, it->second.get()); |
223 } | 231 } |
224 | 232 |
225 new_contents->Init(params); | 233 new_contents->Init(params); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 render_frame_id(render_frame_id), | 289 render_frame_id(render_frame_id), |
282 chooser(chooser), | 290 chooser(chooser), |
283 identifier(identifier) { | 291 identifier(identifier) { |
284 } | 292 } |
285 | 293 |
286 WebContentsImpl::ColorChooserInfo::~ColorChooserInfo() { | 294 WebContentsImpl::ColorChooserInfo::~ColorChooserInfo() { |
287 } | 295 } |
288 | 296 |
289 // WebContentsImpl ------------------------------------------------------------- | 297 // WebContentsImpl ------------------------------------------------------------- |
290 | 298 |
291 WebContentsImpl::WebContentsImpl(BrowserContext* browser_context, | 299 WebContentsImpl::WebContentsImpl(BrowserContext* browser_context) |
292 WebContentsImpl* opener) | |
293 : delegate_(NULL), | 300 : delegate_(NULL), |
294 controller_(this, browser_context), | 301 controller_(this, browser_context), |
295 render_view_host_delegate_view_(NULL), | 302 render_view_host_delegate_view_(NULL), |
296 opener_(opener), | 303 created_with_opener_(false), |
297 created_with_opener_(!!opener), | |
298 #if defined(OS_WIN) | 304 #if defined(OS_WIN) |
299 accessible_parent_(NULL), | 305 accessible_parent_(NULL), |
300 #endif | 306 #endif |
301 frame_tree_(new NavigatorImpl(&controller_, this), | 307 frame_tree_(new NavigatorImpl(&controller_, this), |
302 this, | 308 this, |
303 this, | 309 this, |
304 this, | 310 this, |
305 this), | 311 this), |
306 is_loading_(false), | 312 is_loading_(false), |
307 is_load_to_different_document_(false), | 313 is_load_to_different_document_(false), |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
415 ResetWebContents()); | 421 ResetWebContents()); |
416 | 422 |
417 SetDelegate(NULL); | 423 SetDelegate(NULL); |
418 | 424 |
419 STLDeleteContainerPairSecondPointers(destruction_observers_.begin(), | 425 STLDeleteContainerPairSecondPointers(destruction_observers_.begin(), |
420 destruction_observers_.end()); | 426 destruction_observers_.end()); |
421 } | 427 } |
422 | 428 |
423 WebContentsImpl* WebContentsImpl::CreateWithOpener( | 429 WebContentsImpl* WebContentsImpl::CreateWithOpener( |
424 const WebContents::CreateParams& params, | 430 const WebContents::CreateParams& params, |
425 WebContentsImpl* opener) { | 431 FrameTreeNode* opener) { |
426 TRACE_EVENT0("browser", "WebContentsImpl::CreateWithOpener"); | 432 TRACE_EVENT0("browser", "WebContentsImpl::CreateWithOpener"); |
427 WebContentsImpl* new_contents = new WebContentsImpl( | 433 WebContentsImpl* new_contents = new WebContentsImpl(params.browser_context); |
428 params.browser_context, params.opener_suppressed ? NULL : opener); | 434 |
435 if (!params.opener_suppressed && opener) { | |
436 new_contents->GetFrameTree()->root()->SetOpener(opener); | |
437 new_contents->created_with_opener_ = true; | |
438 } | |
429 | 439 |
430 if (params.created_with_opener) | 440 if (params.created_with_opener) |
431 new_contents->created_with_opener_ = true; | 441 new_contents->created_with_opener_ = true; |
Charlie Reis
2015/06/03 20:01:37
Why do we need both this and the case above? If t
alexmos
2015/06/05 22:34:32
I added a comment. It's needed in the case of all
| |
432 | 442 |
433 if (params.guest_delegate) { | 443 if (params.guest_delegate) { |
434 // This makes |new_contents| act as a guest. | 444 // This makes |new_contents| act as a guest. |
435 // For more info, see comment above class BrowserPluginGuest. | 445 // For more info, see comment above class BrowserPluginGuest. |
436 BrowserPluginGuest::Create(new_contents, params.guest_delegate); | 446 BrowserPluginGuest::Create(new_contents, params.guest_delegate); |
437 // We are instantiating a WebContents for browser plugin. Set its subframe | 447 // We are instantiating a WebContents for browser plugin. Set its subframe |
438 // bit to true. | 448 // bit to true. |
439 new_contents->is_subframe_ = true; | 449 new_contents->is_subframe_ = true; |
440 } | 450 } |
441 new_contents->Init(params); | 451 new_contents->Init(params); |
(...skipping 24 matching lines...) Expand all Loading... | |
466 return result; | 476 return result; |
467 } | 477 } |
468 | 478 |
469 // static | 479 // static |
470 WebContentsImpl* WebContentsImpl::FromFrameTreeNode( | 480 WebContentsImpl* WebContentsImpl::FromFrameTreeNode( |
471 FrameTreeNode* frame_tree_node) { | 481 FrameTreeNode* frame_tree_node) { |
472 return static_cast<WebContentsImpl*>( | 482 return static_cast<WebContentsImpl*>( |
473 WebContents::FromRenderFrameHost(frame_tree_node->current_frame_host())); | 483 WebContents::FromRenderFrameHost(frame_tree_node->current_frame_host())); |
474 } | 484 } |
475 | 485 |
486 WebContentsImpl* WebContentsImpl::opener() const { | |
487 FrameTreeNode* opener_ftn = frame_tree_.root()->opener(); | |
488 // TODO(alexmos): what if opener_ftn->current_frame_host() is null? This | |
489 // will return nullptr, but can we ever have a valid WebContents w/o a RFH? | |
alexmos
2015/06/01 17:44:55
I think that's impossible, but just wanted to doub
Charlie Reis
2015/06/03 20:01:37
I *think* the RFH is only null before WebContentsI
alexmos
2015/06/05 22:34:32
Yes, CreateWithOpener only has a few lines between
| |
490 return opener_ftn ? FromFrameTreeNode(opener_ftn) : nullptr; | |
491 } | |
492 | |
476 RenderFrameHostManager* WebContentsImpl::GetRenderManagerForTesting() { | 493 RenderFrameHostManager* WebContentsImpl::GetRenderManagerForTesting() { |
477 return GetRenderManager(); | 494 return GetRenderManager(); |
478 } | 495 } |
479 | 496 |
480 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, | 497 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, |
481 const IPC::Message& message) { | 498 const IPC::Message& message) { |
482 return OnMessageReceived(render_view_host, NULL, message); | 499 return OnMessageReceived(render_view_host, NULL, message); |
483 } | 500 } |
484 | 501 |
485 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, | 502 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1153 GetMainFrame()->DispatchBeforeUnload(for_cross_site_transition); | 1170 GetMainFrame()->DispatchBeforeUnload(for_cross_site_transition); |
1154 } | 1171 } |
1155 | 1172 |
1156 void WebContentsImpl::Stop() { | 1173 void WebContentsImpl::Stop() { |
1157 GetRenderManager()->Stop(); | 1174 GetRenderManager()->Stop(); |
1158 FOR_EACH_OBSERVER(WebContentsObserver, observers_, NavigationStopped()); | 1175 FOR_EACH_OBSERVER(WebContentsObserver, observers_, NavigationStopped()); |
1159 } | 1176 } |
1160 | 1177 |
1161 WebContents* WebContentsImpl::Clone() { | 1178 WebContents* WebContentsImpl::Clone() { |
1162 // We use our current SiteInstance since the cloned entry will use it anyway. | 1179 // We use our current SiteInstance since the cloned entry will use it anyway. |
1163 // We pass our own opener so that the cloned page can access it if it was | 1180 // We pass our own opener so that the cloned page can access it if it was set |
1164 // before. | 1181 // before. |
1165 CreateParams create_params(GetBrowserContext(), GetSiteInstance()); | 1182 CreateParams create_params(GetBrowserContext(), GetSiteInstance()); |
1166 create_params.initial_size = GetContainerBounds().size(); | 1183 create_params.initial_size = GetContainerBounds().size(); |
1167 WebContentsImpl* tc = CreateWithOpener(create_params, opener_); | 1184 WebContentsImpl* tc = |
1185 CreateWithOpener(create_params, frame_tree_.root()->opener()); | |
alexmos
2015/06/01 17:44:55
Uncovered an interesting bug here which I haven't
Charlie Reis
2015/06/03 20:01:37
Nice. Worth filing it so that we make sure it get
alexmos
2015/06/05 22:34:32
Done. Filed issue 497382.
| |
1168 tc->GetController().CopyStateFrom(controller_); | 1186 tc->GetController().CopyStateFrom(controller_); |
1169 FOR_EACH_OBSERVER(WebContentsObserver, | 1187 FOR_EACH_OBSERVER(WebContentsObserver, |
1170 observers_, | 1188 observers_, |
1171 DidCloneToNewWebContents(this, tc)); | 1189 DidCloneToNewWebContents(this, tc)); |
1172 return tc; | 1190 return tc; |
1173 } | 1191 } |
1174 | 1192 |
1175 void WebContentsImpl::Observe(int type, | 1193 void WebContentsImpl::Observe(int type, |
1176 const NotificationSource& source, | 1194 const NotificationSource& source, |
1177 const NotificationDetails& details) { | 1195 const NotificationDetails& details) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1238 // Regular WebContentsView. | 1256 // Regular WebContentsView. |
1239 view_.reset(CreateWebContentsView( | 1257 view_.reset(CreateWebContentsView( |
1240 this, delegate, &render_view_host_delegate_view_)); | 1258 this, delegate, &render_view_host_delegate_view_)); |
1241 } | 1259 } |
1242 CHECK(render_view_host_delegate_view_); | 1260 CHECK(render_view_host_delegate_view_); |
1243 CHECK(view_.get()); | 1261 CHECK(view_.get()); |
1244 | 1262 |
1245 gfx::Size initial_size = params.initial_size; | 1263 gfx::Size initial_size = params.initial_size; |
1246 view_->CreateView(initial_size, params.context); | 1264 view_->CreateView(initial_size, params.context); |
1247 | 1265 |
1248 // Listen for whether our opener gets destroyed. | |
1249 if (opener_) | |
1250 AddDestructionObserver(opener_); | |
1251 | |
1252 #if defined(ENABLE_PLUGINS) | 1266 #if defined(ENABLE_PLUGINS) |
1253 plugin_content_origin_whitelist_.reset( | 1267 plugin_content_origin_whitelist_.reset( |
1254 new PluginContentOriginWhitelist(this)); | 1268 new PluginContentOriginWhitelist(this)); |
1255 #endif | 1269 #endif |
1256 | 1270 |
1257 registrar_.Add(this, | 1271 registrar_.Add(this, |
1258 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, | 1272 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, |
1259 NotificationService::AllBrowserContextsAndSources()); | 1273 NotificationService::AllBrowserContextsAndSources()); |
1260 | 1274 |
1261 screen_orientation_dispatcher_host_.reset( | 1275 screen_orientation_dispatcher_host_.reset( |
(...skipping 25 matching lines...) Expand all Loading... | |
1287 // main RenderFrameHost. It must be done here for main frames, since the | 1301 // main RenderFrameHost. It must be done here for main frames, since the |
1288 // NotifySwappedFromRenderManager expects view_ to already be created and that | 1302 // NotifySwappedFromRenderManager expects view_ to already be created and that |
1289 // happens after RenderFrameHostManager::Init. | 1303 // happens after RenderFrameHostManager::Init. |
1290 NotifySwappedFromRenderManager( | 1304 NotifySwappedFromRenderManager( |
1291 nullptr, GetRenderManager()->current_frame_host(), true); | 1305 nullptr, GetRenderManager()->current_frame_host(), true); |
1292 } | 1306 } |
1293 | 1307 |
1294 void WebContentsImpl::OnWebContentsDestroyed(WebContentsImpl* web_contents) { | 1308 void WebContentsImpl::OnWebContentsDestroyed(WebContentsImpl* web_contents) { |
1295 RemoveDestructionObserver(web_contents); | 1309 RemoveDestructionObserver(web_contents); |
1296 | 1310 |
1297 // Clear the opener if it has been closed. | |
1298 if (web_contents == opener_) { | |
1299 opener_ = NULL; | |
1300 return; | |
1301 } | |
1302 // Clear a pending contents that has been closed before being shown. | 1311 // Clear a pending contents that has been closed before being shown. |
1303 for (PendingContents::iterator iter = pending_contents_.begin(); | 1312 for (PendingContents::iterator iter = pending_contents_.begin(); |
1304 iter != pending_contents_.end(); | 1313 iter != pending_contents_.end(); |
1305 ++iter) { | 1314 ++iter) { |
1306 if (iter->second != web_contents) | 1315 if (iter->second != web_contents) |
1307 continue; | 1316 continue; |
1308 pending_contents_.erase(iter); | 1317 pending_contents_.erase(iter); |
1309 return; | 1318 return; |
1310 } | 1319 } |
1311 NOTREACHED(); | 1320 NOTREACHED(); |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1594 return; | 1603 return; |
1595 } | 1604 } |
1596 | 1605 |
1597 // Create the new web contents. This will automatically create the new | 1606 // Create the new web contents. This will automatically create the new |
1598 // WebContentsView. In the future, we may want to create the view separately. | 1607 // WebContentsView. In the future, we may want to create the view separately. |
1599 CreateParams create_params(GetBrowserContext(), site_instance.get()); | 1608 CreateParams create_params(GetBrowserContext(), site_instance.get()); |
1600 create_params.routing_id = route_id; | 1609 create_params.routing_id = route_id; |
1601 create_params.main_frame_routing_id = main_frame_route_id; | 1610 create_params.main_frame_routing_id = main_frame_route_id; |
1602 create_params.main_frame_name = base::UTF16ToUTF8(params.frame_name); | 1611 create_params.main_frame_name = base::UTF16ToUTF8(params.frame_name); |
1603 create_params.opener = this; | 1612 create_params.opener = this; |
1613 create_params.opener_render_frame_id = params.opener_render_frame_id; | |
1604 create_params.opener_suppressed = params.opener_suppressed; | 1614 create_params.opener_suppressed = params.opener_suppressed; |
1605 if (params.disposition == NEW_BACKGROUND_TAB) | 1615 if (params.disposition == NEW_BACKGROUND_TAB) |
1606 create_params.initially_hidden = true; | 1616 create_params.initially_hidden = true; |
1607 create_params.renderer_initiated_creation = true; | 1617 create_params.renderer_initiated_creation = true; |
1608 | 1618 |
1609 WebContentsImpl* new_contents = NULL; | 1619 WebContentsImpl* new_contents = NULL; |
1610 if (!is_guest) { | 1620 if (!is_guest) { |
1611 create_params.context = view_->GetNativeView(); | 1621 create_params.context = view_->GetNativeView(); |
1612 create_params.initial_size = GetContainerBounds().size(); | 1622 create_params.initial_size = GetContainerBounds().size(); |
1613 new_contents = static_cast<WebContentsImpl*>( | 1623 new_contents = static_cast<WebContentsImpl*>( |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2462 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { | 2472 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { |
2463 if (GetBrowserPluginGuest()) | 2473 if (GetBrowserPluginGuest()) |
2464 return GetBrowserPluginGuest()->LockMouse(allowed); | 2474 return GetBrowserPluginGuest()->LockMouse(allowed); |
2465 | 2475 |
2466 return GetRenderViewHost() | 2476 return GetRenderViewHost() |
2467 ? GetRenderViewHost()->GotResponseToLockMouseRequest(allowed) | 2477 ? GetRenderViewHost()->GotResponseToLockMouseRequest(allowed) |
2468 : false; | 2478 : false; |
2469 } | 2479 } |
2470 | 2480 |
2471 bool WebContentsImpl::HasOpener() const { | 2481 bool WebContentsImpl::HasOpener() const { |
2472 return opener_ != NULL; | 2482 return opener() != NULL; |
2473 } | 2483 } |
2474 | 2484 |
2475 WebContents* WebContentsImpl::GetOpener() const { | 2485 WebContents* WebContentsImpl::GetOpener() const { |
2476 return static_cast<WebContents*>(opener_); | 2486 return static_cast<WebContents*>(opener()); |
2477 } | 2487 } |
2478 | 2488 |
2479 void WebContentsImpl::DidChooseColorInColorChooser(SkColor color) { | 2489 void WebContentsImpl::DidChooseColorInColorChooser(SkColor color) { |
2480 if (!color_chooser_info_.get()) | 2490 if (!color_chooser_info_.get()) |
2481 return; | 2491 return; |
2482 RenderFrameHost* rfh = RenderFrameHost::FromID( | 2492 RenderFrameHost* rfh = RenderFrameHost::FromID( |
2483 color_chooser_info_->render_process_id, | 2493 color_chooser_info_->render_process_id, |
2484 color_chooser_info_->render_frame_id); | 2494 color_chooser_info_->render_frame_id); |
2485 if (!rfh) | 2495 if (!rfh) |
2486 return; | 2496 return; |
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3801 // Update the URL display. | 3811 // Update the URL display. |
3802 NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); | 3812 NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); |
3803 } | 3813 } |
3804 | 3814 |
3805 void WebContentsImpl::DidChangeName(RenderFrameHost* render_frame_host, | 3815 void WebContentsImpl::DidChangeName(RenderFrameHost* render_frame_host, |
3806 const std::string& name) { | 3816 const std::string& name) { |
3807 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3817 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
3808 FrameNameChanged(render_frame_host, name)); | 3818 FrameNameChanged(render_frame_host, name)); |
3809 } | 3819 } |
3810 | 3820 |
3811 void WebContentsImpl::DidDisownOpener(RenderFrameHost* render_frame_host) { | |
3812 // No action is necessary if the opener has already been cleared. | |
3813 if (!opener_) | |
3814 return; | |
3815 | |
3816 // Clear our opener so that future cross-process navigations don't have an | |
3817 // opener assigned. | |
3818 RemoveDestructionObserver(opener_); | |
3819 opener_ = NULL; | |
3820 | |
3821 // Notify all swapped out RenderViewHosts for this tab. This is important | |
3822 // in case we go back to them, or if another window in those processes tries | |
3823 // to access window.opener. | |
3824 GetRenderManager()->DidDisownOpener(render_frame_host); | |
3825 } | |
3826 | |
3827 void WebContentsImpl::DocumentOnLoadCompleted( | 3821 void WebContentsImpl::DocumentOnLoadCompleted( |
3828 RenderFrameHost* render_frame_host) { | 3822 RenderFrameHost* render_frame_host) { |
3829 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3823 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
3830 DocumentOnLoadCompletedInMainFrame()); | 3824 DocumentOnLoadCompletedInMainFrame()); |
3831 | 3825 |
3832 // TODO(avi): Remove. http://crbug.com/170921 | 3826 // TODO(avi): Remove. http://crbug.com/170921 |
3833 NotificationService::current()->Notify( | 3827 NotificationService::current()->Notify( |
3834 NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 3828 NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
3835 Source<WebContents>(this), | 3829 Source<WebContents>(this), |
3836 NotificationService::NoDetails()); | 3830 NotificationService::NoDetails()); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4088 } | 4082 } |
4089 | 4083 |
4090 void WebContentsImpl::NotifyMainFrameSwappedFromRenderManager( | 4084 void WebContentsImpl::NotifyMainFrameSwappedFromRenderManager( |
4091 RenderViewHost* old_host, | 4085 RenderViewHost* old_host, |
4092 RenderViewHost* new_host) { | 4086 RenderViewHost* new_host) { |
4093 NotifyViewSwapped(old_host, new_host); | 4087 NotifyViewSwapped(old_host, new_host); |
4094 } | 4088 } |
4095 | 4089 |
4096 int WebContentsImpl::CreateOpenerRenderViewsForRenderManager( | 4090 int WebContentsImpl::CreateOpenerRenderViewsForRenderManager( |
4097 SiteInstance* instance) { | 4091 SiteInstance* instance) { |
4098 if (!opener_) | 4092 if (!opener()) |
4099 return MSG_ROUTING_NONE; | 4093 return MSG_ROUTING_NONE; |
4100 | 4094 |
4101 // Recursively create RenderViews for anything else in the opener chain. | 4095 // Recursively create RenderViews for anything else in the opener chain. |
4102 return opener_->CreateOpenerRenderViews(instance); | 4096 return opener()->CreateOpenerRenderViews(instance); |
4103 } | 4097 } |
4104 | 4098 |
4105 int WebContentsImpl::CreateOpenerRenderViews(SiteInstance* instance) { | 4099 int WebContentsImpl::CreateOpenerRenderViews(SiteInstance* instance) { |
4106 int opener_route_id = MSG_ROUTING_NONE; | 4100 int opener_route_id = MSG_ROUTING_NONE; |
4107 | 4101 |
4108 // If this tab has an opener, ensure it has a RenderView in the given | 4102 // If this tab has an opener, ensure it has a RenderView in the given |
4109 // SiteInstance as well. | 4103 // SiteInstance as well. |
4110 if (opener_) | 4104 if (opener()) |
4111 opener_route_id = opener_->CreateOpenerRenderViews(instance); | 4105 opener_route_id = opener()->CreateOpenerRenderViews(instance); |
4112 | 4106 |
4113 // If any of the renderers (current, pending, or swapped out) for this | 4107 // If any of the renderers (current, pending, or swapped out) for this |
4114 // WebContents has the same SiteInstance, use it. | 4108 // WebContents has the same SiteInstance, use it. |
4115 if (GetRenderManager()->current_host()->GetSiteInstance() == instance) | 4109 if (GetRenderManager()->current_host()->GetSiteInstance() == instance) |
4116 return GetRenderManager()->current_host()->GetRoutingID(); | 4110 return GetRenderManager()->current_host()->GetRoutingID(); |
4117 | 4111 |
4118 if (GetRenderManager()->pending_render_view_host() && | 4112 if (GetRenderManager()->pending_render_view_host() && |
4119 GetRenderManager()->pending_render_view_host()->GetSiteInstance() == | 4113 GetRenderManager()->pending_render_view_host()->GetSiteInstance() == |
4120 instance) | 4114 instance) |
4121 return GetRenderManager()->pending_render_view_host()->GetRoutingID(); | 4115 return GetRenderManager()->pending_render_view_host()->GetRoutingID(); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4411 player_map->erase(it); | 4405 player_map->erase(it); |
4412 } | 4406 } |
4413 | 4407 |
4414 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4408 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4415 force_disable_overscroll_content_ = force_disable; | 4409 force_disable_overscroll_content_ = force_disable; |
4416 if (view_) | 4410 if (view_) |
4417 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4411 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4418 } | 4412 } |
4419 | 4413 |
4420 } // namespace content | 4414 } // namespace content |
OLD | NEW |