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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 BrowserContext* browser_context, | 229 BrowserContext* browser_context, |
230 SiteInstance* site_instance, | 230 SiteInstance* site_instance, |
231 int routing_id, | 231 int routing_id, |
232 const WebContents* base_web_contents, | 232 const WebContents* base_web_contents, |
233 SessionStorageNamespace* session_storage_namespace) { | 233 SessionStorageNamespace* session_storage_namespace) { |
234 return new WebContentsImpl( | 234 return new WebContentsImpl( |
235 browser_context, | 235 browser_context, |
236 site_instance, | 236 site_instance, |
237 routing_id, | 237 routing_id, |
238 static_cast<const WebContentsImpl*>(base_web_contents), | 238 static_cast<const WebContentsImpl*>(base_web_contents), |
239 NULL, | |
239 static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace)); | 240 static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace)); |
240 } | 241 } |
241 } | 242 } |
242 | 243 |
243 // WebContentsImpl ------------------------------------------------------------- | 244 // WebContentsImpl ------------------------------------------------------------- |
244 | 245 |
245 WebContentsImpl::WebContentsImpl( | 246 WebContentsImpl::WebContentsImpl( |
246 content::BrowserContext* browser_context, | 247 content::BrowserContext* browser_context, |
247 SiteInstance* site_instance, | 248 SiteInstance* site_instance, |
248 int routing_id, | 249 int routing_id, |
249 const WebContentsImpl* base_web_contents, | 250 const WebContentsImpl* base_web_contents, |
251 WebContentsImpl* opener, | |
250 SessionStorageNamespaceImpl* session_storage_namespace) | 252 SessionStorageNamespaceImpl* session_storage_namespace) |
251 : delegate_(NULL), | 253 : delegate_(NULL), |
252 ALLOW_THIS_IN_INITIALIZER_LIST(controller_( | 254 ALLOW_THIS_IN_INITIALIZER_LIST(controller_( |
253 this, browser_context, session_storage_namespace)), | 255 this, browser_context, session_storage_namespace)), |
256 opener_(opener), | |
254 ALLOW_THIS_IN_INITIALIZER_LIST(render_manager_(this, this)), | 257 ALLOW_THIS_IN_INITIALIZER_LIST(render_manager_(this, this)), |
255 is_loading_(false), | 258 is_loading_(false), |
256 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 259 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
257 crashed_error_code_(0), | 260 crashed_error_code_(0), |
258 waiting_for_response_(false), | 261 waiting_for_response_(false), |
259 load_state_(net::LOAD_STATE_IDLE, string16()), | 262 load_state_(net::LOAD_STATE_IDLE, string16()), |
260 upload_size_(0), | 263 upload_size_(0), |
261 upload_position_(0), | 264 upload_position_(0), |
262 displayed_insecure_content_(false), | 265 displayed_insecure_content_(false), |
263 capturing_contents_(false), | 266 capturing_contents_(false), |
264 is_being_destroyed_(false), | 267 is_being_destroyed_(false), |
265 notify_disconnection_(false), | 268 notify_disconnection_(false), |
266 dialog_creator_(NULL), | 269 dialog_creator_(NULL), |
267 #if defined(OS_WIN) | 270 #if defined(OS_WIN) |
268 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), | 271 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), |
269 #endif | 272 #endif |
270 is_showing_before_unload_dialog_(false), | 273 is_showing_before_unload_dialog_(false), |
271 opener_web_ui_type_(WebUI::kNoWebUI), | 274 opener_web_ui_type_(WebUI::kNoWebUI), |
272 closed_by_user_gesture_(false), | 275 closed_by_user_gesture_(false), |
273 minimum_zoom_percent_( | 276 minimum_zoom_percent_( |
274 static_cast<int>(content::kMinimumZoomFactor * 100)), | 277 static_cast<int>(content::kMinimumZoomFactor * 100)), |
275 maximum_zoom_percent_( | 278 maximum_zoom_percent_( |
276 static_cast<int>(content::kMaximumZoomFactor * 100)), | 279 static_cast<int>(content::kMaximumZoomFactor * 100)), |
277 temporary_zoom_settings_(false), | 280 temporary_zoom_settings_(false), |
278 content_restrictions_(0), | 281 content_restrictions_(0), |
279 view_type_(content::VIEW_TYPE_WEB_CONTENTS), | 282 view_type_(content::VIEW_TYPE_WEB_CONTENTS), |
280 has_opener_(false), | |
281 color_chooser_(NULL) { | 283 color_chooser_(NULL) { |
282 render_manager_.Init(browser_context, site_instance, routing_id); | 284 render_manager_.Init(browser_context, site_instance, routing_id); |
283 | 285 |
284 view_.reset(content::GetContentClient()->browser()-> | 286 view_.reset(content::GetContentClient()->browser()-> |
285 OverrideCreateWebContentsView(this)); | 287 OverrideCreateWebContentsView(this)); |
286 if (!view_.get()) { | 288 if (!view_.get()) { |
287 content::WebContentsViewDelegate* delegate = | 289 content::WebContentsViewDelegate* delegate = |
288 content::GetContentClient()->browser()->GetWebContentsViewDelegate( | 290 content::GetContentClient()->browser()->GetWebContentsViewDelegate( |
289 this); | 291 this); |
290 #if defined(USE_AURA) | 292 #if defined(USE_AURA) |
291 view_.reset(new WebContentsViewAura(this, delegate)); | 293 view_.reset(new WebContentsViewAura(this, delegate)); |
292 #elif defined(OS_WIN) | 294 #elif defined(OS_WIN) |
293 view_.reset(new WebContentsViewWin(this, delegate)); | 295 view_.reset(new WebContentsViewWin(this, delegate)); |
294 #elif defined(TOOLKIT_GTK) | 296 #elif defined(TOOLKIT_GTK) |
295 view_.reset(new content::WebContentsViewGtk(this, delegate)); | 297 view_.reset(new content::WebContentsViewGtk(this, delegate)); |
296 #elif defined(OS_MACOSX) | 298 #elif defined(OS_MACOSX) |
297 view_.reset(web_contents_view_mac::CreateWebContentsView(this, delegate)); | 299 view_.reset(web_contents_view_mac::CreateWebContentsView(this, delegate)); |
298 #elif defined(OS_ANDROID) | 300 #elif defined(OS_ANDROID) |
299 view_.reset(new WebContentsViewAndroid(this)); | 301 view_.reset(new WebContentsViewAndroid(this)); |
300 #endif | 302 #endif |
301 (void)delegate; | 303 (void)delegate; |
302 } | 304 } |
303 CHECK(view_.get()); | 305 CHECK(view_.get()); |
304 | 306 |
305 // We have the initial size of the view be based on the size of the view of | 307 // We have the initial size of the view be based on the size of the view of |
306 // the passed in WebContents. | 308 // the passed in WebContents. |
307 view_->CreateView(base_web_contents ? | 309 view_->CreateView(base_web_contents ? |
308 base_web_contents->GetView()->GetContainerSize() : gfx::Size()); | 310 base_web_contents->GetView()->GetContainerSize() : gfx::Size()); |
309 | 311 |
312 // Listen for whether our opener gets destroyed. | |
313 if (opener_) { | |
314 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | |
315 content::Source<WebContents>(opener_)); | |
316 } | |
317 | |
310 #if defined(ENABLE_JAVA_BRIDGE) | 318 #if defined(ENABLE_JAVA_BRIDGE) |
311 java_bridge_dispatcher_host_manager_.reset( | 319 java_bridge_dispatcher_host_manager_.reset( |
312 new JavaBridgeDispatcherHostManager(this)); | 320 new JavaBridgeDispatcherHostManager(this)); |
313 #endif | 321 #endif |
314 | 322 |
315 browser_plugin_web_contents_observer_.reset( | 323 browser_plugin_web_contents_observer_.reset( |
316 new content::BrowserPluginWebContentsObserver(this)); | 324 new content::BrowserPluginWebContentsObserver(this)); |
317 } | 325 } |
318 | 326 |
319 WebContentsImpl::~WebContentsImpl() { | 327 WebContentsImpl::~WebContentsImpl() { |
320 is_being_destroyed_ = true; | 328 is_being_destroyed_ = true; |
321 | 329 |
322 // Clear out any JavaScript state. | 330 // Clear out any JavaScript state. |
323 if (dialog_creator_) | 331 if (dialog_creator_) |
324 dialog_creator_->ResetJavaScriptState(this); | 332 dialog_creator_->ResetJavaScriptState(this); |
325 | 333 |
326 if (color_chooser_) | 334 if (color_chooser_) |
327 color_chooser_->End(); | 335 color_chooser_->End(); |
328 | 336 |
337 if (opener_) { | |
338 registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | |
Matt Perry
2012/05/01 20:45:17
You don't need to explicitly remove the notificati
Charlie Reis
2012/05/01 21:25:53
This one's different. We're listening to when our
Matt Perry
2012/05/01 21:45:56
We're in the WebContents destructor. Are you sayin
Charlie Reis
2012/05/01 21:57:06
D'oh! That's what I get for not looking closely.
| |
339 content::Source<WebContents>(opener_)); | |
340 opener_ = NULL; | |
341 } | |
342 | |
329 NotifyDisconnected(); | 343 NotifyDisconnected(); |
330 | 344 |
331 // Notify any observer that have a reference on this WebContents. | 345 // Notify any observer that have a reference on this WebContents. |
332 content::NotificationService::current()->Notify( | 346 content::NotificationService::current()->Notify( |
333 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 347 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
334 content::Source<WebContents>(this), | 348 content::Source<WebContents>(this), |
335 content::NotificationService::NoDetails()); | 349 content::NotificationService::NoDetails()); |
336 | 350 |
337 // TODO(brettw) this should be moved to the view. | 351 // TODO(brettw) this should be moved to the view. |
338 #if defined(OS_WIN) && !defined(USE_AURA) | 352 #if defined(OS_WIN) && !defined(USE_AURA) |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
901 !static_cast<RenderViewHostImpl*>( | 915 !static_cast<RenderViewHostImpl*>( |
902 GetRenderViewHost())->SuddenTerminationAllowed(); | 916 GetRenderViewHost())->SuddenTerminationAllowed(); |
903 } | 917 } |
904 | 918 |
905 void WebContentsImpl::Stop() { | 919 void WebContentsImpl::Stop() { |
906 render_manager_.Stop(); | 920 render_manager_.Stop(); |
907 FOR_EACH_OBSERVER(WebContentsObserver, observers_, StopNavigation()); | 921 FOR_EACH_OBSERVER(WebContentsObserver, observers_, StopNavigation()); |
908 } | 922 } |
909 | 923 |
910 WebContents* WebContentsImpl::Clone() { | 924 WebContents* WebContentsImpl::Clone() { |
911 // We create a new SiteInstance so that the new tab won't share processes | 925 // We use our current SiteInstance since the cloned entry will use it anyway. |
912 // with the old one. This can be changed in the future if we need it to share | 926 // We pass |this| for the |base_web_contents| to size the view correctly, and |
913 // processes for some reason. | 927 // our own opener so that the cloned page can access it if it was before. |
914 WebContentsImpl* tc = new WebContentsImpl( | 928 WebContentsImpl* tc = new WebContentsImpl( |
915 GetBrowserContext(), | 929 GetBrowserContext(), GetSiteInstance(), |
916 SiteInstance::Create(GetBrowserContext()), | 930 MSG_ROUTING_NONE, this, opener_, NULL); |
917 MSG_ROUTING_NONE, this, NULL); | |
918 tc->GetControllerImpl().CopyStateFrom(controller_); | 931 tc->GetControllerImpl().CopyStateFrom(controller_); |
919 return tc; | 932 return tc; |
920 } | 933 } |
921 | 934 |
922 void WebContentsImpl::AddNewContents(WebContents* new_contents, | 935 void WebContentsImpl::AddNewContents(WebContents* new_contents, |
923 WindowOpenDisposition disposition, | 936 WindowOpenDisposition disposition, |
924 const gfx::Rect& initial_pos, | 937 const gfx::Rect& initial_pos, |
925 bool user_gesture) { | 938 bool user_gesture) { |
926 if (!delegate_) | 939 if (!delegate_) |
927 return; | 940 return; |
(...skipping 11 matching lines...) Expand all Loading... | |
939 } | 952 } |
940 | 953 |
941 void WebContentsImpl::GetContainerBounds(gfx::Rect* out) const { | 954 void WebContentsImpl::GetContainerBounds(gfx::Rect* out) const { |
942 view_->GetContainerBounds(out); | 955 view_->GetContainerBounds(out); |
943 } | 956 } |
944 | 957 |
945 void WebContentsImpl::Focus() { | 958 void WebContentsImpl::Focus() { |
946 view_->Focus(); | 959 view_->Focus(); |
947 } | 960 } |
948 | 961 |
962 void WebContentsImpl::Observe(int type, | |
963 const content::NotificationSource& source, | |
964 const content::NotificationDetails& details) { | |
965 switch (type) { | |
966 case content::NOTIFICATION_WEB_CONTENTS_DESTROYED: | |
967 OnWebContentsDestroyed( | |
968 content::Source<content::WebContents>(source).ptr()); | |
969 break; | |
970 default: | |
971 NOTREACHED(); | |
972 } | |
973 } | |
974 | |
975 void WebContentsImpl::OnWebContentsDestroyed(WebContents* web_contents) { | |
976 // Clear the opener if it has been closed. | |
977 if (web_contents == opener_) { | |
978 registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | |
979 content::Source<WebContents>(opener_)); | |
980 opener_ = NULL; | |
981 } | |
982 } | |
983 | |
949 void WebContentsImpl::AddObserver(WebContentsObserver* observer) { | 984 void WebContentsImpl::AddObserver(WebContentsObserver* observer) { |
950 observers_.AddObserver(observer); | 985 observers_.AddObserver(observer); |
951 } | 986 } |
952 | 987 |
953 void WebContentsImpl::RemoveObserver(WebContentsObserver* observer) { | 988 void WebContentsImpl::RemoveObserver(WebContentsObserver* observer) { |
954 observers_.RemoveObserver(observer); | 989 observers_.RemoveObserver(observer); |
955 } | 990 } |
956 | 991 |
957 void WebContentsImpl::Activate() { | 992 void WebContentsImpl::Activate() { |
958 if (delegate_) | 993 if (delegate_) |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1389 return render_manager_.pending_web_ui(); | 1424 return render_manager_.pending_web_ui(); |
1390 return render_manager_.web_ui(); | 1425 return render_manager_.web_ui(); |
1391 } | 1426 } |
1392 | 1427 |
1393 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { | 1428 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { |
1394 return GetRenderViewHost() ? | 1429 return GetRenderViewHost() ? |
1395 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false; | 1430 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false; |
1396 } | 1431 } |
1397 | 1432 |
1398 bool WebContentsImpl::HasOpener() const { | 1433 bool WebContentsImpl::HasOpener() const { |
1399 return has_opener_; | 1434 return opener_ != NULL; |
1400 } | 1435 } |
1401 | 1436 |
1402 void WebContentsImpl::DidChooseColorInColorChooser(int color_chooser_id, | 1437 void WebContentsImpl::DidChooseColorInColorChooser(int color_chooser_id, |
1403 SkColor color) { | 1438 SkColor color) { |
1404 GetRenderViewHost()->Send(new ViewMsg_DidChooseColorResponse( | 1439 GetRenderViewHost()->Send(new ViewMsg_DidChooseColorResponse( |
1405 GetRenderViewHost()->GetRoutingID(), color_chooser_id, color)); | 1440 GetRenderViewHost()->GetRoutingID(), color_chooser_id, color)); |
1406 } | 1441 } |
1407 | 1442 |
1408 void WebContentsImpl::DidEndColorChooser(int color_chooser_id) { | 1443 void WebContentsImpl::DidEndColorChooser(int color_chooser_id) { |
1409 GetRenderViewHost()->Send(new ViewMsg_DidEndColorChooser( | 1444 GetRenderViewHost()->Send(new ViewMsg_DidEndColorChooser( |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1981 return view_type_; | 2016 return view_type_; |
1982 } | 2017 } |
1983 | 2018 |
1984 gfx::Rect WebContentsImpl::GetRootWindowResizerRect() const { | 2019 gfx::Rect WebContentsImpl::GetRootWindowResizerRect() const { |
1985 if (delegate_) | 2020 if (delegate_) |
1986 return delegate_->GetRootWindowResizerRect(); | 2021 return delegate_->GetRootWindowResizerRect(); |
1987 return gfx::Rect(); | 2022 return gfx::Rect(); |
1988 } | 2023 } |
1989 | 2024 |
1990 void WebContentsImpl::RenderViewCreated(RenderViewHost* render_view_host) { | 2025 void WebContentsImpl::RenderViewCreated(RenderViewHost* render_view_host) { |
2026 // Don't send notifications if we are just creating a swapped-out RVH for | |
2027 // the opener chain. These won't be used for view-source or WebUI, so it's | |
2028 // ok to return early. | |
2029 if (static_cast<RenderViewHostImpl*>(render_view_host)->is_swapped_out()) | |
2030 return; | |
2031 | |
1991 content::NotificationService::current()->Notify( | 2032 content::NotificationService::current()->Notify( |
1992 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, | 2033 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, |
1993 content::Source<WebContents>(this), | 2034 content::Source<WebContents>(this), |
1994 content::Details<RenderViewHost>(render_view_host)); | 2035 content::Details<RenderViewHost>(render_view_host)); |
1995 NavigationEntry* entry = controller_.GetActiveEntry(); | 2036 NavigationEntry* entry = controller_.GetActiveEntry(); |
1996 if (!entry) | 2037 if (!entry) |
1997 return; | 2038 return; |
1998 | 2039 |
1999 // When we're creating views, we're still doing initial setup, so we always | 2040 // When we're creating views, we're still doing initial setup, so we always |
2000 // use the pending Web UI rather than any possibly existing committed one. | 2041 // use the pending Web UI rather than any possibly existing committed one. |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2528 // later. In case of tab duplication this resizing to 0x0 prevents setting | 2569 // later. In case of tab duplication this resizing to 0x0 prevents setting |
2529 // normal size later so just ignore it. | 2570 // normal size later so just ignore it. |
2530 if (!size.IsEmpty()) | 2571 if (!size.IsEmpty()) |
2531 view_->SizeContents(size); | 2572 view_->SizeContents(size); |
2532 } | 2573 } |
2533 | 2574 |
2534 void WebContentsImpl::NotifySwappedFromRenderManager() { | 2575 void WebContentsImpl::NotifySwappedFromRenderManager() { |
2535 NotifySwapped(); | 2576 NotifySwapped(); |
2536 } | 2577 } |
2537 | 2578 |
2579 int WebContentsImpl::CreateOpenerRenderViewsForRenderManager( | |
2580 SiteInstance* instance) { | |
2581 if (!opener_) | |
2582 return MSG_ROUTING_NONE; | |
2583 | |
2584 // Recursively create RenderViews for anything else in the opener chain. | |
2585 return opener_->CreateOpenerRenderViews(instance); | |
2586 } | |
2587 | |
2588 int WebContentsImpl::CreateOpenerRenderViews(SiteInstance* instance) { | |
2589 int opener_route_id = MSG_ROUTING_NONE; | |
2590 | |
2591 // If this tab has an opener, ensure it has a RenderView in the given | |
2592 // SiteInstance as well. | |
Matt Perry
2012/05/01 20:45:17
I'm confused.. Doesn't this mean the opener Render
Charlie Reis
2012/05/01 21:25:53
There's only one RVH per SiteInstance, for a given
Matt Perry
2012/05/01 21:45:56
Where I was getting confused was that each tab has
| |
2593 if (opener_) | |
2594 opener_route_id = opener_->CreateOpenerRenderViews(instance); | |
2595 | |
2596 // Create a swapped out RenderView in the given SiteInstance if none exists, | |
2597 // setting its opener to the given route_id. Return the new view's route_id. | |
2598 return render_manager_.CreateRenderView(instance, opener_route_id, true); | |
2599 } | |
2600 | |
2538 NavigationControllerImpl& WebContentsImpl::GetControllerForRenderManager() { | 2601 NavigationControllerImpl& WebContentsImpl::GetControllerForRenderManager() { |
2539 return GetControllerImpl(); | 2602 return GetControllerImpl(); |
2540 } | 2603 } |
2541 | 2604 |
2542 WebUIImpl* WebContentsImpl::CreateWebUIForRenderManager(const GURL& url) { | 2605 WebUIImpl* WebContentsImpl::CreateWebUIForRenderManager(const GURL& url) { |
2543 return static_cast<WebUIImpl*>(CreateWebUI(url)); | 2606 return static_cast<WebUIImpl*>(CreateWebUI(url)); |
2544 } | 2607 } |
2545 | 2608 |
2546 NavigationEntry* | 2609 NavigationEntry* |
2547 WebContentsImpl::GetLastCommittedNavigationEntryForRenderManager() { | 2610 WebContentsImpl::GetLastCommittedNavigationEntryForRenderManager() { |
2548 return controller_.GetLastCommittedEntry(); | 2611 return controller_.GetLastCommittedEntry(); |
2549 } | 2612 } |
2550 | 2613 |
2551 bool WebContentsImpl::CreateRenderViewForRenderManager( | 2614 bool WebContentsImpl::CreateRenderViewForRenderManager( |
2552 RenderViewHost* render_view_host) { | 2615 RenderViewHost* render_view_host, int opener_route_id) { |
2553 // Can be NULL during tests. | 2616 // Can be NULL during tests. |
2554 RenderWidgetHostView* rwh_view = view_->CreateViewForWidget(render_view_host); | 2617 RenderWidgetHostView* rwh_view = view_->CreateViewForWidget(render_view_host); |
2555 | 2618 |
2556 // Now that the RenderView has been created, we need to tell it its size. | 2619 // Now that the RenderView has been created, we need to tell it its size. |
2557 if (rwh_view) | 2620 if (rwh_view) |
2558 rwh_view->SetSize(view_->GetContainerSize()); | 2621 rwh_view->SetSize(view_->GetContainerSize()); |
2559 | 2622 |
2560 // Make sure we use the correct starting page_id in the new RenderView. | 2623 // Make sure we use the correct starting page_id in the new RenderView. |
2561 UpdateMaxPageIDIfNecessary(render_view_host); | 2624 UpdateMaxPageIDIfNecessary(render_view_host); |
2562 int32 max_page_id = | 2625 int32 max_page_id = |
2563 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance()); | 2626 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance()); |
2564 | 2627 |
2565 if (!static_cast<RenderViewHostImpl*>( | 2628 if (!static_cast<RenderViewHostImpl*>( |
2566 render_view_host)->CreateRenderView(string16(), max_page_id)) | 2629 render_view_host)->CreateRenderView(string16(), opener_route_id, |
2630 max_page_id)) { | |
2567 return false; | 2631 return false; |
2632 } | |
2568 | 2633 |
2569 #if defined(OS_LINUX) || defined(OS_OPENBSD) | 2634 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
2570 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on | 2635 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on |
2571 // linux. See crbug.com/83941. | 2636 // linux. See crbug.com/83941. |
2572 if (rwh_view) { | 2637 if (rwh_view) { |
2573 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) | 2638 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) |
2574 render_widget_host->WasResized(); | 2639 render_widget_host->WasResized(); |
2575 } | 2640 } |
2576 #endif | 2641 #endif |
2577 | 2642 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2626 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2691 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2627 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2692 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
2628 // Can be NULL during tests. | 2693 // Can be NULL during tests. |
2629 if (rwh_view) | 2694 if (rwh_view) |
2630 rwh_view->SetSize(GetView()->GetContainerSize()); | 2695 rwh_view->SetSize(GetView()->GetContainerSize()); |
2631 } | 2696 } |
2632 | 2697 |
2633 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { | 2698 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { |
2634 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); | 2699 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); |
2635 } | 2700 } |
OLD | NEW |